Documentation
¶
Index ¶
- Variables
- func All[T any](baseModel BaseModel, where ...any) ([]*T, error)
- func Create(baseModel BaseModel) error
- func Delete(baseModel BaseModel, where any) error
- func GetConfig() *viper.Viper
- func GetDBLoger() logger.Interface
- func InitDBLoger() logger.Interface
- func InitORMConfig(configFilePath string) (err error)
- func Insert(baseModel BaseModel) (id string, err error)
- func List[T BaseModel, ListFn func(m T) bool | func(m T) | func(m T) error](base T, ctx *ListOption, where any, listFn ListFn) int64
- func One[T any](baseModel BaseModel, where ...any) (*T, error)
- func SetDBLoger(l logger.Interface)
- func Update(baseModel BaseModel, where any, update any) error
- func Upsert(baseModel BaseModel, where any, update any) error
- func UseViperConfig(config *viper.Viper)
- type BaseModel
- type BoolORM
- type BulkWriteOperation
- type DBConfig
- type ListOption
- type LogConfig
- type LogLevel
- type Model
- type MongoBulkWriteOperation
- type MongoDBConfig
- type MySQLConfig
- type ORM
- func Init(configPath ...string) ORM
- func InitMongoDB(configPath ...string) ORM
- func InitMongoDBWithDBConfig(config *MongoDBConfig) ORM
- func InitMongoDBWithDBConfigWithError(config *MongoDBConfig) (ORM, error)
- func InitMongoDBWithError(configPath ...string) (ORM, error)
- func InitMySQL(configPath ...string) ORM
- func InitMySQLWithDBConfig(config *MySQLConfig) ORM
- func InitMySQLWithDBConfigWithError(config *MySQLConfig) (ORM, error)
- func InitMySQLWithError(configPath ...string) (ORM, error)
- func InitSQLite(configPath ...string) ORM
- func InitSQLiteWithDBConfig(config *SQLiteConfig) ORM
- func InitSQLiteWithDBConfigWithError(config *SQLiteConfig) (ORM, error)
- func InitSQLiteWithError(configPath ...string) (ORM, error)
- func InitWithDBConfig(config *DBConfig) ORM
- func InitWithDBConfigWithError(config *DBConfig) (ORM, error)
- func InitWithError(configPath ...string) (ORM, error)
- type ORMModel
- type ORMQuery
- type OrderDir
- type SQLiteConfig
- type Session
- type Sort
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ListOptionAll = types.ListOptionAll ListOptionDefault = types.ListOptionDefault )
View Source
var ( OrderDirAsc = types.OrderDirAsc OrderDirDesc = types.OrderDirDesc Asc = types.OrderDirAsc Desc = types.OrderDirDesc )
Functions ¶
func GetDBLoger ¶ added in v0.6.3
func InitDBLoger ¶ added in v0.0.4
func InitORMConfig ¶ added in v0.0.2
初始化orm配置文件
func List ¶ added in v0.4.5
func List[T BaseModel, ListFn func(m T) bool | func(m T) | func(m T) error](base T, ctx *ListOption, where any, listFn ListFn) int64
List 分页查询 Where 可以是函数,也可以是Model
func SetDBLoger ¶ added in v0.6.3
Types ¶
type BulkWriteOperation ¶ added in v0.1.9
type BulkWriteOperation = types.BulkWriteOperation
type ListOption ¶ added in v0.4.5
type ListOption = types.ListOption
type MongoBulkWriteOperation ¶ added in v0.1.9
type MongoBulkWriteOperation = types.MongoBulkWriteOperation
type MongoDBConfig ¶ added in v0.3.5
type MongoDBConfig = conf.MongoDBConfig
type MySQLConfig ¶ added in v0.3.5
type MySQLConfig = conf.MySQLConfig
type ORM ¶
func InitMongoDB ¶ added in v0.0.2
初始化MongoDB连接(带错误panic)
func InitMongoDBWithDBConfig ¶ added in v0.3.5
func InitMongoDBWithDBConfig(config *MongoDBConfig) ORM
func InitMongoDBWithDBConfigWithError ¶ added in v0.3.5
func InitMongoDBWithDBConfigWithError(config *MongoDBConfig) (ORM, error)
func InitMongoDBWithError ¶ added in v0.3.1
初始化MongoDB连接(返回错误)
func InitMySQLWithDBConfig ¶ added in v0.3.5
func InitMySQLWithDBConfig(config *MySQLConfig) ORM
使用配置结构体初始化MySQL
func InitMySQLWithDBConfigWithError ¶ added in v0.3.5
func InitMySQLWithDBConfigWithError(config *MySQLConfig) (ORM, error)
使用配置结构体初始化MySQL
func InitMySQLWithError ¶ added in v0.3.1
初始化MySQL连接(返回错误)
func InitSQLiteWithDBConfig ¶ added in v0.3.5
func InitSQLiteWithDBConfig(config *SQLiteConfig) ORM
使用配置结构体初始化SQLite
func InitSQLiteWithDBConfigWithError ¶ added in v0.3.5
func InitSQLiteWithDBConfigWithError(config *SQLiteConfig) (ORM, error)
使用配置结构体初始化SQLite
func InitSQLiteWithError ¶ added in v0.3.1
初始化SQLite连接(返回错误)
func InitWithDBConfigWithError ¶ added in v0.3.5
使用配置结构体初始化
func InitWithError ¶ added in v0.3.1
初始化ORM连接(返回错误)
type SQLiteConfig ¶ added in v0.3.5
type SQLiteConfig = conf.SQLiteConfig
Click to show internal directories.
Click to hide internal directories.