Documentation ¶
Index ¶
- func NewDB(cfg Config, appName string) (*sqlx.DB, error)
- type Config
- type User
- type UserRepo
- func (u UserRepo) GetById(ctx context.Context, id int64) (User, error)
- func (u UserRepo) GetByLogin(ctx context.Context, login string) (User, error)
- func (u UserRepo) GetByLoginOrEmail(ctx context.Context, login, email string) (User, error)
- func (u UserRepo) Insert(ctx context.Context, user User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Host string `env:"DB_HOST"` Port int `env:"DB_PORT"` User string `env:"DB_USER"` Password string `env:"DB_PASSWORD"` DBName string `env:"DB_NAME"` Schema string `env:"DB_SCHEMA"` MaxIdleConns int `env:"DB_MAX_IDLE_CONNS" envDefault:"2"` MaxOpenConns int `env:"DB_MAX_OPEN_CONNS" envDefault:"4"` LogLevel string `env:"DB_LOG_LEVEL" envDefault:"error"` }
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
func NewUserRepo ¶
func (UserRepo) GetByLogin ¶
func (UserRepo) GetByLoginOrEmail ¶
Click to show internal directories.
Click to hide internal directories.