Documentation ¶
Index ¶
- Constants
- Variables
- func New(ctx context.Context, cfg *config.Config) (*sqlx.DB, func(), error)
- type Beginner
- type Execer
- type KVS
- type Preparer
- type Queryer
- type Repository
- func (r *Repository) AddTask(ctx context.Context, db Execer, t *entity.Task) error
- func (r *Repository) GetUser(ctx context.Context, db Queryer, name string) (*entity.User, error)
- func (r *Repository) ListTasks(ctx context.Context, db Queryer, id entity.UserID) (entity.Tasks, error)
- func (r *Repository) RegisterUser(ctx context.Context, db Execer, u *entity.User) error
- type TaskStore
Constants ¶
View Source
const ( // ErrCodeMySQLDuplicateEntry はMySQL系のDUPLICATEエラーコード // https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html // Error number: 1062; Symbol: ER_DUP_ENTRY; SQLSTATE: 23000 ErrCodeMySQLDuplicateEntry = 1062 )
Variables ¶
View Source
var ( Tasks = &TaskStore{Tasks: map[entity.TaskID]*entity.Task{}} ErrNotFound = errors.New("not found") )
View Source
var (
ErrAlreadyEntry = errors.New("duplicate entry")
)
Functions ¶
Types ¶
type Queryer ¶
type Queryer interface { Preparer QueryxContext(ctx context.Context, query string, args ...any) (*sqlx.Rows, error) QueryRowxContext(ctx context.Context, query string, args ...any) *sqlx.Row GetContext(ctx context.Context, dest interface{}, query string, args ...any) error SelectContext(ctx context.Context, dest interface{}, query string, args ...any) error }
type Repository ¶
func (*Repository) RegisterUser ¶
Click to show internal directories.
Click to hide internal directories.