Documentation
¶
Index ¶
- Constants
- Variables
- func IsFieldDupError(err error) bool
- type Cfg
- type Config
- func (cfg *Config) AfterCreate(tx *gorm.DB)
- func (cfg *Config) AfterDelete(tx *gorm.DB)
- func (cfg *Config) AfterQuery(tx *gorm.DB)
- func (cfg *Config) AfterUpdate(tx *gorm.DB)
- func (cfg *Config) BeforeCreate(tx *gorm.DB)
- func (cfg *Config) BeforeDelete(tx *gorm.DB)
- func (cfg *Config) BeforeQuery(tx *gorm.DB)
- func (cfg *Config) BeforeUpdate(tx *gorm.DB)
- func (cfg *Config) FieldDupCheck(tx *gorm.DB, forUpdate bool)
- func (cfg *Config) FieldDupInfo(tx *gorm.DB) *FieldDup
- func (cfg *Config) GraspSchema(tx *gorm.DB, zeroList ...any)
- func (cfg *Config) Initialize(tx *gorm.DB) error
- func (cfg *Config) Name() string
- func (cfg *Config) ParseSchema(tx *gorm.DB)
- func (cfg *Config) TenantInfo(tx *gorm.DB) *Tenant
- type Field
- type FieldDup
- type FieldDupError
- type SessionConfig
- type Tenant
Constants ¶
View Source
const SessionCfg = "session_config"
Variables ¶
View Source
var ErrDeleteTenantAllNotAllowed = errors.New("delete tenant all rows or global update is not allowed")
View Source
var ErrUpdateTenantAllNotAllowed = errors.New("update tenant all rows or global update is not allowed")
Functions ¶
func IsFieldDupError ¶
Types ¶
type Config ¶
type Config struct { PluginName string // no default value, "" will be error, plugin will not be effect TagKey string // default: mt TagTenantKey string // default: tenant TagUniqueKey string // default: unique TxTenantKey string // default: tenant_id TxTenantsKey string // default: tenant_ids TxSkipKey string // default: skip_tenant GlobalCfg *SessionConfig // can be overSensed by SessionCfg UseTableParseSchema bool // contains filtered or unexported fields }
func (*Config) AfterCreate ¶
func (*Config) AfterDelete ¶
func (*Config) AfterQuery ¶
func (*Config) AfterUpdate ¶
func (*Config) BeforeCreate ¶
func (*Config) BeforeDelete ¶
func (*Config) BeforeQuery ¶
func (*Config) BeforeUpdate ¶
func (*Config) FieldDupInfo ¶
FieldDupInfo Create(&Struct), Create(&[]Struct), Create(&[N]Struct) Create(&map[string]any{}), Create(&[]map[string]any{}) Create map[string]any ~ Map[K]V, K(string) is FieldName, V(any) is FieldValue Updates(&Struct) Updates(&map[string]any{}) Updates map[string]any ~ Map[K]V, K(string) is ColumnName, V(any) is FieldValue
func (*Config) GraspSchema ¶ added in v1.2.49
func (*Config) ParseSchema ¶
type Field ¶
func DeletedAt
deprecated
func DeletedAt(schema *gormschema.Schema) *Field
Deprecated: use clause.Interface instead
func FieldFromSchema ¶
func FieldFromSchema(field *gormschema.Field) Field
func (Field) Clause ¶
func (f Field) Clause() clause.Expression
type FieldDup ¶
type FieldDupError ¶
type SessionConfig ¶
type SessionConfig struct { DisableFieldDup bool // effect on create and update ComplexFieldDup bool // effect on create DeleteAllowTenantAll bool // effect on delete, only tenant and soft_delete, no other where clause BeforeDeleteDoQuery bool // effect on delete UpdateAllowTenantAll bool // effect on update, only tenant and soft_delete, no other where clause UpdateOmitMapZeroElemKey bool // effect on update AfterCreateShowTenant bool // effect on create AfterQueryShowTenant bool // effect on query BeforeQueryOmitField bool // effect on query }
func GetSessionConfig ¶
func GetSessionConfig(cfg *Config, tx *gorm.DB) SessionConfig
type Tenant ¶
type Tenant struct {
Field Field
}
func (*Tenant) MergeClause ¶ added in v1.2.49
func (*Tenant) ModifyStatement ¶ added in v1.2.49
Click to show internal directories.
Click to hide internal directories.