Documentation
¶
Index ¶
- type MySQLRepository
- func (repo MySQLRepository) Create(ctx context.Context, tenant Tenant) (int64, error)
- func (repo MySQLRepository) DeleteByTenantId(ctx context.Context, tenantId string) error
- func (repo MySQLRepository) GetById(ctx context.Context, id int64) (*Tenant, error)
- func (repo MySQLRepository) GetByTenantId(ctx context.Context, tenantId string) (*Tenant, error)
- func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Tenant, error)
- func (repo MySQLRepository) UpdateByTenantId(ctx context.Context, tenantId string, tenant Tenant) error
- type PostgresRepository
- func (repo PostgresRepository) Create(ctx context.Context, tenant Tenant) (int64, error)
- func (repo PostgresRepository) DeleteByTenantId(ctx context.Context, tenantId string) error
- func (repo PostgresRepository) GetById(ctx context.Context, id int64) (*Tenant, error)
- func (repo PostgresRepository) GetByTenantId(ctx context.Context, tenantId string) (*Tenant, error)
- func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Tenant, error)
- func (repo PostgresRepository) UpdateByTenantId(ctx context.Context, tenantId string, tenant Tenant) error
- type Tenant
- type TenantListParamParser
- type TenantRepository
- type TenantService
- func (svc TenantService) Create(ctx context.Context, tenantSpec TenantSpec) (*TenantSpec, error)
- func (svc TenantService) DeleteByTenantId(ctx context.Context, tenantId string) error
- func (svc TenantService) GetByTenantId(ctx context.Context, tenantId string) (*TenantSpec, error)
- func (svc TenantService) GetRoutes() []service.Route
- func (svc TenantService) List(ctx context.Context, listParams middleware.ListParams) ([]TenantSpec, error)
- func (svc TenantService) UpdateByTenantId(ctx context.Context, tenantId string, tenantSpec UpdateTenantSpec) (*TenantSpec, error)
- type TenantSpec
- type UpdateTenantSpec
Constants ¶
This section is empty.
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) DeleteByTenantId ¶
func (repo MySQLRepository) DeleteByTenantId(ctx context.Context, tenantId string) error
func (MySQLRepository) GetByTenantId ¶
func (MySQLRepository) List ¶
func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Tenant, error)
func (MySQLRepository) UpdateByTenantId ¶
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) DeleteByTenantId ¶ added in v0.4.0
func (repo PostgresRepository) DeleteByTenantId(ctx context.Context, tenantId string) error
func (PostgresRepository) GetByTenantId ¶ added in v0.4.0
func (PostgresRepository) List ¶ added in v0.4.0
func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Tenant, error)
func (PostgresRepository) UpdateByTenantId ¶ added in v0.4.0
type Tenant ¶
type Tenant struct {
ID int64 `mysql:"id" postgres:"id"`
ObjectId int64 `mysql:"objectId" postgres:"object_id"`
TenantId string `mysql:"tenantId" postgres:"tenant_id"`
Name database.NullString `mysql:"name" postgres:"name"`
CreatedAt time.Time `mysql:"createdAt" postgres:"created_at"`
UpdatedAt time.Time `mysql:"updatedAt" postgres:"updated_at"`
DeletedAt database.NullTime `mysql:"deletedAt" postgres:"deleted_at"`
}
Tenant model
func (Tenant) ToTenantSpec ¶
func (tenant Tenant) ToTenantSpec() *TenantSpec
type TenantListParamParser ¶
type TenantListParamParser struct{}
func (TenantListParamParser) GetDefaultSortBy ¶
func (parser TenantListParamParser) GetDefaultSortBy() string
func (TenantListParamParser) GetSupportedSortBys ¶
func (parser TenantListParamParser) GetSupportedSortBys() []string
func (TenantListParamParser) ParseValue ¶
func (parser TenantListParamParser) ParseValue(val string, sortBy string) (interface{}, error)
type TenantRepository ¶
type TenantRepository interface {
Create(ctx context.Context, tenant Tenant) (int64, error)
GetById(ctx context.Context, id int64) (*Tenant, error)
GetByTenantId(ctx context.Context, tenantId string) (*Tenant, error)
List(ctx context.Context, listParams middleware.ListParams) ([]Tenant, error)
UpdateByTenantId(ctx context.Context, tenantId string, tenant Tenant) error
DeleteByTenantId(ctx context.Context, tenantId string) error
}
func NewRepository ¶
func NewRepository(db database.Database) (TenantRepository, error)
type TenantService ¶
type TenantService struct {
service.BaseService
}
func NewService ¶
func NewService(env service.Env) TenantService
func (TenantService) Create ¶
func (svc TenantService) Create(ctx context.Context, tenantSpec TenantSpec) (*TenantSpec, error)
func (TenantService) DeleteByTenantId ¶
func (svc TenantService) DeleteByTenantId(ctx context.Context, tenantId string) error
func (TenantService) GetByTenantId ¶
func (svc TenantService) GetByTenantId(ctx context.Context, tenantId string) (*TenantSpec, error)
func (TenantService) GetRoutes ¶
func (svc TenantService) GetRoutes() []service.Route
GetRoutes registers all route handlers for this module
func (TenantService) List ¶
func (svc TenantService) List(ctx context.Context, listParams middleware.ListParams) ([]TenantSpec, error)
func (TenantService) UpdateByTenantId ¶
func (svc TenantService) UpdateByTenantId(ctx context.Context, tenantId string, tenantSpec UpdateTenantSpec) (*TenantSpec, error)
type TenantSpec ¶
type TenantSpec struct {
TenantId string `json:"tenantId"`
Name database.NullString `json:"name"`
CreatedAt time.Time `json:"createdAt"`
}
func (TenantSpec) ToObjectSpec ¶
func (spec TenantSpec) ToObjectSpec() *object.ObjectSpec
func (TenantSpec) ToTenant ¶
func (spec TenantSpec) ToTenant(objectId int64) *Tenant
type UpdateTenantSpec ¶
type UpdateTenantSpec struct {
Name database.NullString `json:"name"`
}
Click to show internal directories.
Click to hide internal directories.