Documentation ¶
Index ¶
- func NewDefaultGormDb(config Config) *gorm.DB
- func NewGormDbWithDriverConfig(driverConfig mysql.Config, config Config) *gorm.DB
- type Config
- type DefaultPage
- type GormBaseModel
- type GormBaseModelWithId
- type GormBaseModelWithOutLogicDelete
- type Page
- type PageData
- func FindPageData[T any, M any](db *gorm.DB, page Page) (pagedata PageData[T], err error)
- func FindPageDataNilModel[T any](db *gorm.DB, page Page) (pagedata PageData[T], err error)
- func GetPageData[T any, M any](db *gorm.DB, page Page, isScan bool) (pagedata PageData[T], err error)
- func GetPageDataNilModel[T any](db *gorm.DB, page Page, isScan bool) (pagedata PageData[T], err error)
- func ScanPageData[T any, M any](db *gorm.DB, page Page) (pagedata PageData[T], err error)
- func ScanPageDataNilModel[T any](db *gorm.DB, page Page) (pagedata PageData[T], err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultGormDb ¶ added in v0.0.4
NewDefaultGormDb new a default gorm db,generally used in svc.NewServiceContext(c config.Config) *ServiceContext
Types ¶
type Config ¶
type Config struct { Path string // 服务器地址:端口 Port int `json:",default=3306"` // 端口 Config string // 高级配置 Dbname string // 数据库名 Username string // 数据库用户名 Password string // 数据库密码 MaxIdleConns int // 空闲中的最大连接数 MaxOpenConns int // 打开到数据库的最大连接数 LogMode logger.LogLevel // 是否开启Gorm全局日志 LogZap bool `json:"LogZap,optional,default=false"` // 是否通过zap写入日志文件 }
type DefaultPage ¶ added in v0.1.8
type GormBaseModel ¶ added in v0.0.4
type GormBaseModelWithId ¶ added in v0.0.4
type GormBaseModelWithId struct { Id uint `json:"id" gorm:"primaryKey"` //id GormBaseModel }
type GormBaseModelWithOutLogicDelete ¶ added in v0.0.4
type PageData ¶ added in v0.1.7
type PageData[T any] struct { Total int64 `json:"total"` //总数 Page DefaultPage `json:"page"` //页数信息 Data T `json:"data"` //数据 }
func FindPageData ¶ added in v0.1.7
func FindPageDataNilModel ¶ added in v0.1.7
func GetPageData ¶ added in v0.1.7
func GetPageDataNilModel ¶ added in v0.1.7
func ScanPageData ¶ added in v0.1.7
func ScanPageDataNilModel ¶ added in v0.1.7
func (PageData[T]) MarshalBinary ¶ added in v0.1.7
Click to show internal directories.
Click to hide internal directories.