Documentation
¶
Index ¶
- Constants
- type MySQLRepository
- func (repo MySQLRepository) Create(ctx context.Context, role Role) (int64, error)
- func (repo MySQLRepository) DeleteByRoleId(ctx context.Context, roleId string) error
- func (repo MySQLRepository) GetById(ctx context.Context, id int64) (*Role, error)
- func (repo MySQLRepository) GetByRoleId(ctx context.Context, roleId string) (*Role, error)
- func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
- func (repo MySQLRepository) UpdateByRoleId(ctx context.Context, roleId string, role Role) error
- type PostgresRepository
- func (repo PostgresRepository) Create(ctx context.Context, role Role) (int64, error)
- func (repo PostgresRepository) DeleteByRoleId(ctx context.Context, roleId string) error
- func (repo PostgresRepository) GetById(ctx context.Context, id int64) (*Role, error)
- func (repo PostgresRepository) GetByRoleId(ctx context.Context, roleId string) (*Role, error)
- func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
- func (repo PostgresRepository) UpdateByRoleId(ctx context.Context, roleId string, role Role) error
- type Role
- type RoleListParamParser
- type RoleRepository
- type RoleService
- func (svc RoleService) Create(ctx context.Context, roleSpec RoleSpec) (*RoleSpec, error)
- func (svc RoleService) DeleteByRoleId(ctx context.Context, roleId string) error
- func (svc RoleService) GetByRoleId(ctx context.Context, roleId string) (*RoleSpec, error)
- func (svc RoleService) GetRoutes() []service.Route
- func (svc RoleService) List(ctx context.Context, listParams middleware.ListParams) ([]RoleSpec, error)
- func (svc RoleService) UpdateByRoleId(ctx context.Context, roleId string, roleSpec UpdateRoleSpec) (*RoleSpec, error)
- type RoleSpec
- type UpdateRoleSpec
Constants ¶
View Source
const ResourceTypeRole = "role"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLRepository ¶
type MySQLRepository struct {
database.SQLRepository
}
func NewMySQLRepository ¶
func NewMySQLRepository(db *database.MySQL) MySQLRepository
func (MySQLRepository) DeleteByRoleId ¶
func (repo MySQLRepository) DeleteByRoleId(ctx context.Context, roleId string) error
func (MySQLRepository) GetByRoleId ¶
func (MySQLRepository) List ¶
func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
func (MySQLRepository) UpdateByRoleId ¶
type PostgresRepository ¶ added in v0.4.0
type PostgresRepository struct {
database.SQLRepository
}
func NewPostgresRepository ¶ added in v0.4.0
func NewPostgresRepository(db *database.Postgres) PostgresRepository
func (PostgresRepository) DeleteByRoleId ¶ added in v0.4.0
func (repo PostgresRepository) DeleteByRoleId(ctx context.Context, roleId string) error
func (PostgresRepository) GetByRoleId ¶ added in v0.4.0
func (PostgresRepository) List ¶ added in v0.4.0
func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
func (PostgresRepository) UpdateByRoleId ¶ added in v0.4.0
type Role ¶
type Role struct {
ID int64 `mysql:"id" postgres:"id"`
ObjectId int64 `mysql:"objectId" postgres:"object_id"`
RoleId string `mysql:"roleId" postgres:"role_id"`
Name database.NullString `mysql:"name" postgres:"name"`
Description database.NullString `mysql:"description" postgres:"description"`
CreatedAt time.Time `mysql:"createdAt" postgres:"created_at"`
UpdatedAt time.Time `mysql:"updatedAt" postgres:"updated_at"`
DeletedAt database.NullTime `mysql:"deletedAt" postgres:"deleted_at"`
}
func (Role) ToRoleSpec ¶
type RoleListParamParser ¶
type RoleListParamParser struct{}
func (RoleListParamParser) GetDefaultSortBy ¶
func (parser RoleListParamParser) GetDefaultSortBy() string
func (RoleListParamParser) GetSupportedSortBys ¶
func (parser RoleListParamParser) GetSupportedSortBys() []string
func (RoleListParamParser) ParseValue ¶
func (parser RoleListParamParser) ParseValue(val string, sortBy string) (interface{}, error)
type RoleRepository ¶
type RoleRepository interface {
Create(ctx context.Context, role Role) (int64, error)
GetById(ctx context.Context, id int64) (*Role, error)
GetByRoleId(ctx context.Context, roleId string) (*Role, error)
List(ctx context.Context, listParams middleware.ListParams) ([]Role, error)
UpdateByRoleId(ctx context.Context, roleId string, role Role) error
DeleteByRoleId(ctx context.Context, roleId string) error
}
func NewRepository ¶
func NewRepository(db database.Database) (RoleRepository, error)
type RoleService ¶
type RoleService struct {
service.BaseService
}
func NewService ¶
func NewService(env service.Env) RoleService
func (RoleService) DeleteByRoleId ¶
func (svc RoleService) DeleteByRoleId(ctx context.Context, roleId string) error
func (RoleService) GetByRoleId ¶
func (RoleService) GetRoutes ¶
func (svc RoleService) GetRoutes() []service.Route
GetRoutes registers all route handlers for this module
func (RoleService) List ¶
func (svc RoleService) List(ctx context.Context, listParams middleware.ListParams) ([]RoleSpec, error)
func (RoleService) UpdateByRoleId ¶
func (svc RoleService) UpdateByRoleId(ctx context.Context, roleId string, roleSpec UpdateRoleSpec) (*RoleSpec, error)
type RoleSpec ¶
type RoleSpec struct {
RoleId string `json:"roleId" validate:"required"`
Name database.NullString `json:"name"`
Description database.NullString `json:"description"`
Context context.ContextSetSpec `json:"context,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
func (RoleSpec) ToObjectSpec ¶
func (spec RoleSpec) ToObjectSpec() *object.ObjectSpec
type UpdateRoleSpec ¶
type UpdateRoleSpec struct {
Name database.NullString `json:"name"`
Description database.NullString `json:"description"`
}
Click to show internal directories.
Click to hide internal directories.