rexDatabase

package
v1.0.87 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

*

@author: taco
@Date: 2023/8/15
@Time: 10:37

*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(db *sql.DB)

func NewDbClient

func NewDbClient(c *DbConfig) (*gorm.DB, error)

func NewGormZapLogger

func NewGormZapLogger() gormLogger.Interface

func NewPgDbClient

func NewPgDbClient(c *PgDbConfig) (*gorm.DB, error)

Types

type AuditByStringModel

type AuditByStringModel struct {
	CreatedBy string `gorm:"index:idx_created_by;column:created_by;comment:创建者;type: varchar(255)" json:"created_by"`
	UpdatedBy string `gorm:"index:idx_updated_by;column:updated_by;comment:更新者;type: varchar(255)" json:"updated_by"`
	DeletedBy string `gorm:"index:idx_deleted_by;column:deleted_by;comment:删除者;type: varchar(255)" json:"-"`
}

note: 审计字段新版实现

type AuditByUintModel

type AuditByUintModel struct {
	CreatedBy uint `gorm:"index:idx_created_by;column:created_by;comment:创建者;type:int" json:"created_by"`
	UpdatedBy uint `gorm:"index:idx_updated_by;column:updated_by;comment:更新者;type:int" json:"updated_by"`
	DeletedBy uint `gorm:"index:idx_deleted_by;column:deleted_by;comment:删除者;type:int" json:"-"`
}

type AuditRpcByStringModel

type AuditRpcByStringModel struct {
	CreatedBy string `gorm:"index:idx_created_by;column:created_by;comment:创建者;type: varchar(255)" json:"createdBy"`
	UpdatedBy string `gorm:"index:idx_updated_by;column:updated_by;comment:更新者;type: varchar(255)" json:"updatedBy"`
	DeletedBy string `gorm:"index:idx_deleted_by;column:deleted_by;comment:删除者;type: varchar(255)" json:"-"`
}

type AuditRpcByUintModel

type AuditRpcByUintModel struct {
	CreatedBy string `gorm:"index:idx_created_by;column:created_by;comment:创建者;type:int" json:"createdBy"`
	UpdatedBy string `gorm:"index:idx_updated_by;column:updated_by;comment:更新者;type:int" json:"updatedBy"`
	DeletedBy string `gorm:"index:idx_deleted_by;column:deleted_by;comment:删除者;type:int" json:"-"`
}

type AuditTenantByUintModel

type AuditTenantByUintModel struct {
	CreatedTenantBy uint `gorm:"index:idx_created_tenant_by;column:created_tenant_by;comment:创建数据的租户;type:int" json:"created_tenant_by"`
	UpdatedTenantBy uint `gorm:"index:idx_updated_tenant_by;column:updated_tenant_by;comment:更新数据的租户;type:int" json:"updated_tenant_by"`
	DeletedTenantBy uint `gorm:"index:idx_deleted_tenant_by;column:deleted_tenant_by;comment:删除数据的租户;type:int" json:"-"`
}

type AuditTenantRpcByStringModel

type AuditTenantRpcByStringModel struct {
	CreatedTenantBy string `` /* 131-byte string literal not displayed */
	UpdatedTenantBy string `` /* 131-byte string literal not displayed */
	DeletedTenantBy string `gorm:"index:idx_deleted_tenant_by;column:deleted_tenant_by;comment:删除数据的租户;type: varchar(255)" json:"-"`
}

type AuditTenantRpcByUintModel

type AuditTenantRpcByUintModel struct {
	CreatedTenantBy uint `gorm:"index:idx_created_tenant_by;column:created_tenant_by;comment:创建数据的租户;type:int" json:"createdTenantBy"`
	UpdatedTenantBy uint `gorm:"index:idx_updated_tenant_by;column:updated_tenant_by;comment:更新数据的租户;type:int" json:"updatedTenantBy"`
	DeletedTenantBy uint `gorm:"index:idx_deleted_tenant_by;column:deleted_tenant_by;comment:删除数据的租户;type:int" json:"-"`
}

type AuditUserByStringModel added in v1.0.50

type AuditUserByStringModel struct {
	CreatedUserBy string `` /* 127-byte string literal not displayed */
	UpdatedUserBy string `` /* 127-byte string literal not displayed */
	DeletedUserBy string `gorm:"index:idx_deleted_user_by;column:deleted_user_by;comment:删除数据的用户;type: varchar(255)" json:"-"`
}

note: 审计模型租户版

type AuditUserByUintModel added in v1.0.65

type AuditUserByUintModel struct {
	CreatedUserBy uint `gorm:"index:idx_created_user_by;column:created_user_by;comment:创建数据的用户;" json:"created_user_by"`
	UpdatedUserBy uint `gorm:"index:idx_updated_user_by;column:updated_user_by;comment:更新数据的用户;" json:"updated_user_by"`
	DeletedUserBy uint `gorm:"index:idx_deleted_user_by;column:deleted_user_by;comment:删除数据的用户;" json:"-"`
}

type BaseAdminModel

type BaseAdminModel struct {
	CreatedBy uint `gorm:"column:created_by;comment:创建者;type: int" json:"created_by"`
	UpdatedBy uint `gorm:"column:updated_by;comment:更新者;type: int" json:"updated_by"`
	DeletedBy uint `gorm:"column:deleted_by;comment:删除者;type: int" json:"-"`
}

type BaseModel

type BaseModel struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;comment:创建时间;" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;comment:更新时间;" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

note: 兼容实现

type BaseRpcModel

type BaseRpcModel struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;comment:创建时间;" json:"createdAt"`
	UpdatedAt time.Time      `gorm:"column:updated_at;comment:更新时间;" json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

note: rpc新版实现

type BaseTenantModel

type BaseTenantModel struct {
	CreatedTenantBy string `` /* 133-byte string literal not displayed */
	UpdatedTenantBy string `` /* 133-byte string literal not displayed */
	DeletedTenantBy string `gorm:"index:idx_deleted_tenant_by;column:deleted_tenant_by;comment:删除数据的租户;type: varchar(255)" json:"-"`
}

type CommonContentStatus added in v1.0.82

type CommonContentStatus int8
const (
	ContentStatusDraft CommonContentStatus = iota + 1
	ContentStatusSubmitted
	ContentStatusRejected
	ContentStatusUnPublished
	ContentStatusPublished
	ContentStatusPinnedOnly
	ContentStatusPinned
)

type CommonSessionStatus added in v1.0.82

type CommonSessionStatus int8
const (
	SessionStatusAnonymous CommonSessionStatus = iota + 1
	SessionStatusAuthenticated
	SessionStatusRevoked
)

type CommonStatus added in v1.0.25

type CommonStatus int8
const (
	AllStatusDisable CommonStatus = iota + 1
	AllStatusEnable
)

type CommonVerifiedStatus added in v1.0.82

type CommonVerifiedStatus int8
const (
	VerifiedStatusUnSubmitted CommonVerifiedStatus = iota + 1
	VerifiedStatusDraft
	VerifiedStatusSubmitted
	VerifiedStatusRejected
	VerifiedStatusVerified
)

type DbConfig

type DbConfig struct {
	Host                 string
	Port                 uint
	DbName               string
	User                 string
	Password             string
	Charset              string
	MaxIdle              int
	MaxOpen              int
	LogMode              bool
	Loc                  string
	MaxLifetime          int64
	TablePrefix          string
	Debug                bool
	AllowNativePasswords bool
}

type PgDbConfig

type PgDbConfig struct {
	Host        string `json:",default=pg.xx.com"`
	User        string `json:",default=admin"`
	Password    string `json:",default=admin123"`
	DbName      string `json:",default=public"`
	Port        uint   `json:",default=5432"`
	SslMode     string `json:",default=disable"`
	MaxIdle     int    `json:",default=10"`
	MaxOpen     int    `json:",default=100"`
	Loc         string `json:",default=Asia/Shanghai"`
	Debug       bool   `json:",default=true"`
	TablePrefix string `json:",default=v1_"`
	MaxLifetime int64  `json:",default=300"`
}

type SeoBase added in v1.0.84

type SeoBase struct {
	// note: og设置
	OgTitle       string `json:"og_title"`
	OgDescription string `json:"og_description"`
	OgImage       string `json:"og_image"`
	OgUrl         string `json:"og_url"`
}

type SeoExtra added in v1.0.84

type SeoExtra struct {
	SeoBase
	Debug       bool   `gorm:"column:debug;comment:debug;type: boolean;default:false" json:"debug"`
	Card        string `gorm:"column:card;comment:分享卡片;type: varchar(255);" json:"card"`                    // 分享卡片
	CreatorSite string `gorm:"column:creator_site;comment:示例@xxxx;type: varchar(255);" json:"creator_site"` // 创建者站点
}

type SeoShareSetting added in v1.0.76

type SeoShareSetting struct {
	Debug         bool   `gorm:"column:debug;comment:debug;type: boolean;default:false" json:"debug"`
	OgTitle       string `gorm:"column:og_title;comment:og标题;type: varchar(255);" json:"og_title"`
	OgDescription string `gorm:"column:og_description;comment:og描述;type: varchar(255);" json:"og_description"`
	OgImage       string `gorm:"column:og_image;comment:og图片;type: varchar(255);" json:"og_image"`
	Url           string `gorm:"column:url;comment:分享链接;type: varchar(255);" json:"url"`                      // 分享链接
	Card          string `gorm:"column:card;comment:分享卡片;type: varchar(255);" json:"card"`                    // 分享卡片
	CreatorSite   string `gorm:"column:creator_site;comment:示例@xxxx;type: varchar(255);" json:"creator_site"` // 创建者站点
}

type UniqueIdAdminModel

type UniqueIdAdminModel struct {
	CreatedBy string `gorm:"index:idx_created_by;column:created_by;comment:创建者;type: varchar(255)" json:"created_by"`
	UpdatedBy string `gorm:"index:idx_updated_by;column:updated_by;comment:更新者;type: varchar(255)" json:"updated_by"`
	DeletedBy string `gorm:"index:idx_deleted_by;column:deleted_by;comment:删除者;type: varchar(255)" json:"-"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL