Documentation
¶
Index ¶
- Constants
- Variables
- func NewBlocks(t *testing.T) (*Block, *Block, *Block)
- type Block
- type MockQueries
- func (m *MockQueries) CreateUser(ctx context.Context, params db.CreateUserParams) (db.User, error)
- func (m *MockQueries) DeleteUser(ctx context.Context, id int64) error
- func (m *MockQueries) GetUser(ctx context.Context, id int64) (db.User, error)
- func (m *MockQueries) ListUsers(ctx context.Context, params db.ListUsersParams) ([]db.User, error)
- func (m *MockQueries) UpdateUser(ctx context.Context, params db.UpdateUserParams) (db.User, error)
- type Service
- func (s *Service) CreateUser(ctx context.Context, user User) (*User, error)
- func (s *Service) DeleteUserByID(ctx context.Context, id int64) error
- func (s *Service) GetUserByID(ctx context.Context, id int64) (*User, error)
- func (s *Service) ListUsers(ctx context.Context, limit, offset int32) (*UsersResponse, error)
- func (s *Service) UpdateUserByID(ctx context.Context, id int64, user User) (*User, error)
- type User
- type UsersResponse
Constants ¶
View Source
const DuplicateErrorCode = "23505"
Variables ¶
View Source
var ErrUserAlreadyExists = errors.New("user already exists")
View Source
var ErrUserNameEmpty = errors.New("user name empty")
View Source
var ErrUserNotFound = errors.New("user not found")
Functions ¶
Types ¶
type MockQueries ¶
type MockQueries struct {
// contains filtered or unexported fields
}
func (*MockQueries) CreateUser ¶
func (m *MockQueries) CreateUser(ctx context.Context, params db.CreateUserParams) (db.User, error)
func (*MockQueries) DeleteUser ¶
func (m *MockQueries) DeleteUser(ctx context.Context, id int64) error
func (*MockQueries) ListUsers ¶
func (m *MockQueries) ListUsers(ctx context.Context, params db.ListUsersParams) ([]db.User, error)
func (*MockQueries) UpdateUser ¶
func (m *MockQueries) UpdateUser(ctx context.Context, params db.UpdateUserParams) (db.User, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(userRepo userRepo) *Service
func (*Service) CreateUser ¶
func (*Service) DeleteUserByID ¶
func (*Service) GetUserByID ¶
type User ¶
type User struct {
ID int64 `json:"id"`
Name string `json:"name"`
Other string `json:"other"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
func FromDBUser ¶
type UsersResponse ¶
func FromDBUsers ¶
func FromDBUsers(dbUser []db.User) *UsersResponse
Click to show internal directories.
Click to hide internal directories.