Documentation
¶
Overview ¶
Package repo provides a wrapper around database.
Index ¶
- Variables
- type Repo
- func (repo *Repo) Close() error
- func (repo *Repo) CreateUser(ctx context.Context, user *UserCore) (string, error)
- func (repo *Repo) DeleteUserById(ctx context.Context, id string) error
- func (repo *Repo) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (repo *Repo) GetUserById(ctx context.Context, userId string) (*User, error)
- func (repo *Repo) Migrate() error
- func (repo *Repo) Update(ctx context.Context, id string, updates map[string]any) error
- type Stmts
- type User
- type UserCore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserAlreadyExists = errors.New("user already exists") ErrUserNotFound = errors.New("user not found") )
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) CreateUser ¶
func (*Repo) DeleteUserById ¶
func (*Repo) GetUserByEmail ¶
func (*Repo) GetUserById ¶
type Stmts ¶
type User ¶
type User struct {
UserCore
Role string `json:"role"`
FullName string `json:"full_name,omitempty"`
Username string `json:"username,omitempty"`
DateOfBirth string `json:"date_of_birth"`
Gender string `json:"gender,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
AccountStatus string `json:"account_status"`
ImageUrl string `json:"image_url"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Id string `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.