Documentation ¶
Index ¶
- Constants
- Variables
- func LogoBlob(ctx context.Context, factory blob.Factory) blob.Blob
- type AdminInfo
- type ConfigConnStrGenerator
- type ConnStrGenerator
- type Tenant
- type TenantConn
- type TenantFeature
- type TenantReadyEventHandler
- type TenantRepo
- type TenantUseCase
- func (t *TenantUseCase) Count(ctx context.Context, query *v1.ListTenantRequest) (total int64, filtered int64, err error)
- func (t *TenantUseCase) Create(ctx context.Context, entity *Tenant) error
- func (t *TenantUseCase) CreateWithAdmin(ctx context.Context, entity *Tenant, adminInfo *AdminInfo) error
- func (t *TenantUseCase) Delete(ctx context.Context, id string) error
- func (t *TenantUseCase) FindByIdOrName(ctx context.Context, idOrName string) (*Tenant, error)
- func (t *TenantUseCase) First(ctx context.Context, query *v1.ListTenantRequest) (*Tenant, error)
- func (t *TenantUseCase) Get(ctx context.Context, id string) (*Tenant, error)
- func (t *TenantUseCase) List(ctx context.Context, query *v1.ListTenantRequest) ([]*Tenant, error)
- func (t *TenantUseCase) Update(ctx context.Context, entity *Tenant, p query.Select) error
Constants ¶
View Source
const ConnName dal.ConnName = "saas"
Variables ¶
View Source
var ProviderSet = wire.NewSet( NewTenantUserCase, NewTenantReadyEventHandler, NewConfigConnStrGenerator, )
ProviderSet is biz providers.
Functions ¶
Types ¶
type ConfigConnStrGenerator ¶
type ConfigConnStrGenerator struct {
// contains filtered or unexported fields
}
func (*ConfigConnStrGenerator) Generate ¶
func (c *ConfigConnStrGenerator) Generate(ctx context.Context, tenant *Tenant) ([]TenantConn, error)
type ConnStrGenerator ¶
type ConnStrGenerator interface { //Generate connection string for tenant before creation Generate(ctx context.Context, tenant *Tenant) ([]TenantConn, error) }
func NewConfigConnStrGenerator ¶
func NewConfigConnStrGenerator(saasConf *conf.SaasConf) ConnStrGenerator
type Tenant ¶
type Tenant struct { gorm2.UIDBase concurrency.Version //unique name. usually for domain name Name string `gorm:"column:name;index;size:255;"` //localed display name DisplayName string `gorm:"column:display_name;index;size:255;"` //region of this tenant Region string `gorm:"column:region;index;size:255;"` Logo string CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` DeletedAt gg.DeletedAt `gorm:"column:deleted_at;index;"` SeparateDb bool //connection Conn []TenantConn `gorm:"foreignKey:TenantId"` //edition Features []TenantFeature `gorm:"foreignKey:TenantId"` Extra data.JSONMap }
type TenantConn ¶
type TenantConn struct { TenantId string `gorm:"column:tenant_id;primary_key;size:36;"` //key of connection string Key string `gorm:"column:key;primary_key;size:100;"` //connection string Value string `gorm:"column:value;size:1000;"` CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` Ready bool `gorm:"column:ready"` }
TenantConn connection string info
type TenantFeature ¶
type TenantFeature struct { TenantId string `gorm:"column:tenant_id;primary_key;size:36;"` //key of connection string Key string `gorm:"column:key;primary_key;size:100;"` //connection string Value string `gorm:"column:value;size:1000;"` CreatedAt time.Time `gorm:"column:created_at;index;"` UpdatedAt time.Time `gorm:"column:updated_at;index;"` }
type TenantReadyEventHandler ¶
type TenantReadyEventHandler event.ConsumerHandler
func NewTenantReadyEventHandler ¶
func NewTenantReadyEventHandler(useCase *TenantUseCase) TenantReadyEventHandler
type TenantRepo ¶
type TenantUseCase ¶
type TenantUseCase struct {
// contains filtered or unexported fields
}
func NewTenantUserCase ¶
func NewTenantUserCase(repo TenantRepo, connStrGenerator ConnStrGenerator, sender event.Producer) *TenantUseCase
func (*TenantUseCase) Count ¶
func (t *TenantUseCase) Count(ctx context.Context, query *v1.ListTenantRequest) (total int64, filtered int64, err error)
func (*TenantUseCase) Create ¶
func (t *TenantUseCase) Create(ctx context.Context, entity *Tenant) error
func (*TenantUseCase) CreateWithAdmin ¶
func (*TenantUseCase) FindByIdOrName ¶
func (*TenantUseCase) First ¶
func (t *TenantUseCase) First(ctx context.Context, query *v1.ListTenantRequest) (*Tenant, error)
func (*TenantUseCase) List ¶
func (t *TenantUseCase) List(ctx context.Context, query *v1.ListTenantRequest) ([]*Tenant, error)
Click to show internal directories.
Click to hide internal directories.