Documentation ¶
Index ¶
- func CreateUmMigrationsFile(dir string) error
- type Config
- type GetUserParams
- type IRoleRepo
- type ISchema
- type IUserRepo
- type InsertUserParams
- type RegisterUserOpts
- type Role
- type RoleRepo
- func (r *RoleRepo) AssignRolesToUser(ctx context.Context, conn dbdriver.DBTX, p UserRoleAssignParams) error
- func (r *RoleRepo) Delete(ctx context.Context, conn dbdriver.DBTX, id int) error
- func (r *RoleRepo) Get(ctx context.Context, conn dbdriver.DBTX, id int) (Role, error)
- func (r *RoleRepo) Insert(ctx context.Context, conn dbdriver.DBTX, name ...string) ([]Role, error)
- func (r *RoleRepo) Select(ctx context.Context, conn dbdriver.DBTX, p RoleSelectParams) ([]Role, error)
- func (r *RoleRepo) Update(ctx context.Context, conn dbdriver.DBTX, p RoleUpdateParams) (Role, error)
- type RoleSelectParams
- type RoleUpdateParams
- type Schema
- type SelectUserParams
- type Service
- func (s *Service) DeleteUser(ctx context.Context, p GetUserParams) error
- func (s *Service) GetUserByUID(ctx context.Context, uid string) (User, error)
- func (s *Service) InitSchema(ctx context.Context) error
- func (s *Service) InsertRoles(ctx context.Context) error
- func (s *Service) Login(ctx context.Context, u string, p string) (User, error)
- func (s *Service) RegisterUser(ctx context.Context, p RegisterUserOpts) (User, error, error)
- func (s *Service) SelectUsers(ctx context.Context, p SelectUserParams) ([]User, error)
- type UpdateUserParams
- type User
- type UserLoginParams
- type UserRepo
- func (u *UserRepo) Delete(ctx context.Context, conn dbdriver.DBTX, p GetUserParams) error
- func (u *UserRepo) Get(ctx context.Context, conn dbdriver.DBTX, p GetUserParams) (User, error)
- func (u *UserRepo) Insert(ctx context.Context, conn dbdriver.DBTX, p InsertUserParams) (User, error)
- func (u *UserRepo) Login(ctx context.Context, conn dbdriver.DBTX, p UserLoginParams) (User, error)
- func (u *UserRepo) Select(ctx context.Context, conn dbdriver.DBTX, p SelectUserParams) ([]User, error)
- func (u *UserRepo) Update(ctx context.Context, conn dbdriver.DBTX, p UpdateUserParams) (User, error)
- type UserRoleAssignParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUmMigrationsFile ¶
Types ¶
type GetUserParams ¶
type IRoleRepo ¶
type IRoleRepo interface { Insert(ctx context.Context, conn dbdriver.DBTX, name ...string) ([]Role, error) Get(ctx context.Context, conn dbdriver.DBTX, id int) (Role, error) Select(ctx context.Context, conn dbdriver.DBTX, p RoleSelectParams) ([]Role, error) Delete(ctx context.Context, conn dbdriver.DBTX, id int) error Update(ctx context.Context, conn dbdriver.DBTX, p RoleUpdateParams) (Role, error) AssignRolesToUser(ctx context.Context, conn dbdriver.DBTX, p UserRoleAssignParams) error }
type IUserRepo ¶
type IUserRepo interface { Insert(ctx context.Context, conn dbdriver.DBTX, p InsertUserParams) (User, error) Get(ctx context.Context, conn dbdriver.DBTX, p GetUserParams) (User, error) Select(ctx context.Context, conn dbdriver.DBTX, p SelectUserParams) ([]User, error) Delete(ctx context.Context, conn dbdriver.DBTX, p GetUserParams) error Update(ctx context.Context, conn dbdriver.DBTX, p UpdateUserParams) (User, error) Login(ctx context.Context, conn dbdriver.DBTX, p UserLoginParams) (User, error) }
type InsertUserParams ¶
type RegisterUserOpts ¶
type Role ¶
type Role struct { ID int `json:"id"` Name string `json:"name"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Role the roles of the system
type RoleRepo ¶
type RoleRepo struct {
// contains filtered or unexported fields
}
func (*RoleRepo) AssignRolesToUser ¶
type RoleSelectParams ¶
type RoleUpdateParams ¶
type SelectUserParams ¶
type Service ¶
type Service struct { Schema ISchema Roles IRoleRepo Users IUserRepo // contains filtered or unexported fields }
func NewService ¶
func (*Service) DeleteUser ¶
func (s *Service) DeleteUser(ctx context.Context, p GetUserParams) error
func (*Service) GetUserByUID ¶
func (*Service) RegisterUser ¶
func (*Service) SelectUsers ¶
type UpdateUserParams ¶
type UpdateUserParams struct { }
type User ¶
type User struct { ID int `json:"-"` UID uuid.UUID `json:"uid"` Identity string `json:"identity"` EncPasswd string `json:"-"` Roles []Role `json:"roles"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
User represents a system user
func (*User) HasAnyRole ¶
type UserLoginParams ¶
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
type UserRoleAssignParams ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.