Documentation ¶
Index ¶
- Variables
- func IsSecretFound(res sql.Result) error
- func IsShareFound(res sql.Result) error
- func IsUserFound(res sql.Result) error
- func NewSecretRepository(db *sql.DB) secret.Repository
- func NewSharedRepository(db *sql.DB) shared.Repository
- func NewUserRepository(db *sql.DB) user.Repository
- func Open(path string) (*sql.DB, error)
- func ToSQLInt64[T constraints.Integer](v T) sql.NullInt64
- func ToSQLString(s string) sql.NullString
- func ToSQLTime(t time.Time) sql.NullTime
- type Executer
- type Querier
- type RowQuerier
- type RowsQuerier
- type Scanner
Constants ¶
This section is empty.
Variables ¶
var ( ErrDBError = errors.New("database error") ErrNotFoundUser = errors.New("user not found") )
var (
ErrNotFoundSecret = errors.New("secret not found")
)
var (
)Functions ¶
func IsSecretFound ¶
IsSecretFound returns an error if the entity is not found
func IsShareFound ¶
IsShareFound returns an error if the entity is not found
func IsUserFound ¶
IsUserFound returns an error if the entity is not found
func NewSecretRepository ¶
func NewSecretRepository(db *sql.DB) secret.Repository
NewSecretRepository creates a secret.Repository from the SQL DB `db`
func NewSharedRepository ¶
func NewSharedRepository(db *sql.DB) shared.Repository
NewSharedRepository creates a shared.Repository from the SQL DB `db`
func NewUserRepository ¶
func NewUserRepository(db *sql.DB) user.Repository
NewUserRepository creates a user.Repository from the SQL DB `db`
func Open ¶
Open will initialize a SQLite DB based on the `.sql` file in `path`, returning a pointer to a sql.DB and an error
It executes the initial migration, as well.
func ToSQLInt64 ¶
func ToSQLInt64[T constraints.Integer](v T) sql.NullInt64
ToSQLInt64 converts the generic integer into a sql.NullInt64
func ToSQLString ¶
func ToSQLString(s string) sql.NullString
ToSQLString converts the input string into a sql.NullString
Types ¶
type Executer ¶
type Executer interface {
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
}
Executer describes an object that executes a mutation in a SQL database
type Querier ¶
type Querier interface { RowQuerier RowsQuerier Executer }
Querier encapsulates a RowQuerier, RowsQuerier and Executer implementations
type RowQuerier ¶
type RowQuerier interface {
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
}
RowQuerier describes an object that queries a single row in a SQL database