qxDatabase

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 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 BaseAdminModel

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

type BaseModel

type BaseModel 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:"-"`
}

type BaseTenantModel

type BaseTenantModel struct {
	CreatedTenantBy string `` /* 131-byte string literal not displayed */
	UpdatedTenantBy string `` /* 131-byte string literal not displayed */
	DeletedTenantBy string `` /* 131-byte string literal not displayed */
}

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
	User        string
	Password    string
	DbName      string
	Port        uint
	SslMode     string
	Loc         string
	Debug       bool
	TablePrefix string
	MaxIdle     int
	MaxOpen     int
	MaxLifetime int64
}

type UniqueIdAdminModel

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

Jump to

Keyboard shortcuts

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