Documentation
¶
Index ¶
- Constants
- type Model
- type MySQLRepository
- func (repo MySQLRepository) Create(ctx context.Context, role Model) (int64, error)
- func (repo MySQLRepository) DeleteByRoleId(ctx context.Context, roleId string) error
- func (repo MySQLRepository) GetById(ctx context.Context, id int64) (Model, error)
- func (repo MySQLRepository) GetByRoleId(ctx context.Context, roleId string) (Model, error)
- func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)
- func (repo MySQLRepository) UpdateByRoleId(ctx context.Context, roleId string, model Model) error
- type PostgresRepository
- func (repo PostgresRepository) Create(ctx context.Context, model Model) (int64, error)
- func (repo PostgresRepository) DeleteByRoleId(ctx context.Context, roleId string) error
- func (repo PostgresRepository) GetById(ctx context.Context, id int64) (Model, error)
- func (repo PostgresRepository) GetByRoleId(ctx context.Context, roleId string) (Model, error)
- func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)
- func (repo PostgresRepository) UpdateByRoleId(ctx context.Context, roleId string, model Model) error
- type Role
- func (role Role) GetCreatedAt() time.Time
- func (role Role) GetDeletedAt() database.NullTime
- func (role Role) GetDescription() database.NullString
- func (role Role) GetID() int64
- func (role Role) GetName() database.NullString
- func (role Role) GetObjectId() int64
- func (role Role) GetRoleId() string
- func (role Role) GetUpdatedAt() time.Time
- func (role *Role) SetDescription(newDescription database.NullString)
- func (role *Role) SetName(newName database.NullString)
- func (role Role) ToRoleSpec() *RoleSpec
- 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) List(ctx context.Context, listParams middleware.ListParams) ([]RoleSpec, error)
- func (svc RoleService) Routes() []service.Route
- 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 Model ¶ added in v0.8.0
type Model interface {
GetID() int64
GetObjectId() int64
GetRoleId() string
GetName() database.NullString
SetName(database.NullString)
GetDescription() database.NullString
SetDescription(database.NullString)
GetCreatedAt() time.Time
GetUpdatedAt() time.Time
GetDeletedAt() database.NullTime
ToRoleSpec() *RoleSpec
}
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) ([]Model, 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) ([]Model, 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) GetCreatedAt ¶ added in v0.8.0
func (Role) GetDeletedAt ¶ added in v0.8.0
func (Role) GetDescription ¶ added in v0.8.0
func (role Role) GetDescription() database.NullString
func (Role) GetName ¶ added in v0.8.0
func (role Role) GetName() database.NullString
func (Role) GetObjectId ¶ added in v0.8.0
func (Role) GetUpdatedAt ¶ added in v0.8.0
func (*Role) SetDescription ¶ added in v0.8.0
func (role *Role) SetDescription(newDescription database.NullString)
func (*Role) SetName ¶ added in v0.8.0
func (role *Role) SetName(newName database.NullString)
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 Model) (int64, error)
GetById(ctx context.Context, id int64) (Model, error)
GetByRoleId(ctx context.Context, roleId string) (Model, error)
List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)
UpdateByRoleId(ctx context.Context, roleId string, role Model) error
DeleteByRoleId(ctx context.Context, roleId string) error
}
func NewRepository ¶
func NewRepository(db database.Database) (RoleRepository, error)
type RoleService ¶
type RoleService struct {
service.BaseService
// contains filtered or unexported fields
}
func NewService ¶
func NewService(env service.Env, repo RoleRepository, eventSvc event.EventService, objectSvc object.ObjectService) RoleService
func (RoleService) DeleteByRoleId ¶
func (svc RoleService) DeleteByRoleId(ctx context.Context, roleId string) error
func (RoleService) GetByRoleId ¶
func (RoleService) List ¶
func (svc RoleService) List(ctx context.Context, listParams middleware.ListParams) ([]RoleSpec, error)
func (RoleService) Routes ¶ added in v0.8.0
func (svc RoleService) Routes() []service.Route
GetRoutes registers all route handlers for this module
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.