Documentation ¶
Index ¶
- func ConnectMySql(MySqlUserName, Password, Address string, Port int, dbName string) *gorm.DB
- func ConnectSqlServer(MySqlUserName, Password, Address string, Port int, dbName string) *gorm.DB
- func ConversionMapKeyToLower(struMap map[string]interface{}) map[string]interface{}
- func ConversionMapKeyToLowerForJsonStru(stru interface{}) map[string]interface{}
- func ConversionMapKeyToLowerForXmlStru(stru interface{}) map[string]interface{}
- func Create(db *gorm.DB, value interface{}) error
- func CreateOrUpdate(db *gorm.DB, tableName string, MapFieldValue map[string]interface{}, ...) error
- func CreateOrUpdateOfSpecial(db *gorm.DB, tableName string, MapFieldValue map[string]interface{}, ...) error
- func DeleteByID(db *gorm.DB, model interface{}, id string) (count int64, err error)
- func DeleteByIDS(db *gorm.DB, model interface{}, ids []string) (count int64, err error)
- func DeleteByModel(db *gorm.DB, model interface{}) (count int64, err error)
- func DeleteByWhere(db *gorm.DB, model, where interface{}) (count int64, err error)
- func DeleteByWhereTx(db *gorm.DB, model, where interface{}) (count int64, err error, tx *gorm.DB)
- func Find(db *gorm.DB, where interface{}, out interface{}, orders ...string) error
- func First(db *gorm.DB, where interface{}, out interface{}) (notFound bool, err error)
- func FirstByID(db *gorm.DB, out interface{}, id string) (notFound bool, err error)
- func GenerateElementCreateSql(reqMap map[string]interface{}, tableName string) createTableSql
- func GenerateTableSql(colName string, colValue interface{}) string
- func GenerateTableSqlForCol(v interface{}) string
- func GetAllSqlServerDB() map[string]*gorm.DB
- func GetColumnNameList(db *gorm.DB, DBName, TableName string, out *[]DictionaryInfo) error
- func GetDBRepo() *dbRepo
- func GetDbTableList(db *gorm.DB, DBName string, out *[]TableInfo) error
- func GetDesignDB() *gorm.DB
- func GetMysqlDB() *gorm.DB
- func GetPage(db *gorm.DB, model, where interface{}, out interface{}, indexPage *IndexPage, ...) error
- func GetPageToMap(db *gorm.DB, tableName string, out interface{}, indexPage *IndexPage, ...) error
- func GetSqlServerDB() *gorm.DB
- func GetSqlServerDBOfCGY() *gorm.DB
- func GetSqlServerDBOfDSJ() *gorm.DB
- func GetSqlServerDBOfDZPT() *gorm.DB
- func GetSqlServerDBOfFGS() *gorm.DB
- func GetSqlServerDBOfJL() *gorm.DB
- func GetSqlServerDBOfQJ() *gorm.DB
- func GetUserIdsByAdminAllDelartUser(db *gorm.DB, orgId int, out interface{}) error
- func GetUserTypeByAppUserId(db *gorm.DB, appId int, out interface{}) error
- func GormPgSql(PgSqlUserName, Password, Address string, Port string, DbName string) *gorm.DB
- func InitDesignDB() *gorm.DB
- func LikeStr(keyStr string) string
- func NewClauses[T any](lenNum int) *column[T]
- func PluckList(db *gorm.DB, model, where interface{}, fieldName string, out interface{}) error
- func Save(db *gorm.DB, value interface{}) error
- func Scan(db *gorm.DB, model, where interface{}, out interface{}) (notFound bool, err error)
- func ScanList(db *gorm.DB, model, where interface{}, out interface{}, orders ...string) error
- func SelectByWhere(db *gorm.DB, whereMap map[string]string, columnList []string, out interface{}) error
- func SetSqlServerDb(key string, db *gorm.DB)
- func Updates(db *gorm.DB, where interface{}, value interface{}) error
- type CommonModel
- type CommonModelV1
- type DictionaryInfo
- type GinModel
- type IndexPage
- type PageWhere
- type Repo
- type SqlAttributes
- func (sa *SqlAttributes) ExecCreateTable(colValMap map[string]interface{}, db *gorm.DB) error
- func (sa *SqlAttributes) ExecCreateTableByJsonStru(colValStru interface{}, db *gorm.DB) error
- func (sa *SqlAttributes) ExecCreateTableByXmlStru(colValStru interface{}, db *gorm.DB) error
- func (sa *SqlAttributes) GenerateCreateSql(colValMap map[string]interface{})
- type TableInfo
- type Writer
- type WriterSqlServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectMySql ¶
func ConnectSqlServer ¶
func ConversionMapKeyToLower ¶ added in v1.4.21
将 map 中的 key 全部转化成小写
func ConversionMapKeyToLowerForJsonStru ¶ added in v1.4.21
func ConversionMapKeyToLowerForJsonStru(stru interface{}) map[string]interface{}
将 json struct 中的 key 全部转化成小写
func ConversionMapKeyToLowerForXmlStru ¶ added in v1.4.21
func ConversionMapKeyToLowerForXmlStru(stru interface{}) map[string]interface{}
将 xml struct 中的 key 全部转化成小写
func CreateOrUpdate ¶
func CreateOrUpdate(db *gorm.DB, tableName string, MapFieldValue map[string]interface{}, query interface{}, args ...interface{}) error
数据存在更新,不存在创建 根据条件判断数据是否存在是否存在 存在 创建 不存在 更新指定字段 true:数据存在,false:数据不存在
func CreateOrUpdateOfSpecial ¶
func CreateOrUpdateOfSpecial(db *gorm.DB, tableName string, MapFieldValue map[string]interface{}, query interface{}, args ...interface{}) error
特殊处理:更新map中不存在的字段 数据存在更新,不存在创建 根据条件判断数据是否存在是否存在 存在 创建 不存在 更新指定字段 true:数据存在,false:数据不存在
func DeleteByID ¶
Delete
func DeleteByIDS ¶
Delete
func DeleteByModel ¶
Delete
func DeleteByWhere ¶
Delete
func DeleteByWhereTx ¶
Delete
func GenerateElementCreateSql ¶
生成桩基/盖梁等表机构
func GenerateTableSql ¶
生成sql 列语句
func GenerateTableSqlForCol ¶ added in v1.4.21
func GenerateTableSqlForCol(v interface{}) string
建表列类型判断
func GetColumnNameList ¶
func GetColumnNameList(db *gorm.DB, DBName, TableName string, out *[]DictionaryInfo) error
func GetDesignDB ¶ added in v1.3.4
func GetPage ¶
func GetPage(db *gorm.DB, model, where interface{}, out interface{}, indexPage *IndexPage, order string, whereOrder ...PageWhere) error
GetPage
func GetPageToMap ¶
func GetPageToMap(db *gorm.DB, tableName string, out interface{}, indexPage *IndexPage, order string, whereOrder ...PageWhere) error
GetPage
func GetUserTypeByAppUserId ¶
func InitDesignDB ¶ added in v1.3.4
func NewClauses ¶ added in v1.4.18
func SelectByWhere ¶
func SelectByWhere(db *gorm.DB, whereMap map[string]string, columnList []string, out interface{}) error
out 指针类型
func SetSqlServerDb ¶ added in v1.2.5
Types ¶
type CommonModel ¶
type CommonModel struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT" form:"id" json:"id"` CreatedAt time.Time `gorm:"column:createdAt" form:"createdAt" json:"createdAt"` UpdatedAt time.Time `gorm:"column:updatedAt" form:"updatedAt" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"column:deletedAt" form:"deletedAt" sql:"index" json:"deletedAt"` }
type CommonModelV1 ¶ added in v1.4.18
type CommonModelV1 struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT" form:"id" json:"id"` CreatedAt time.Time `gorm:"column:created_at" form:"created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" form:"updated_at" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" form:"deleted_at" sql:"index" json:"deleted_at"` }
type DictionaryInfo ¶
type GinModel ¶
type GinModel struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT" form:"id" json:"id"` CreatedAt time.Time `gorm:"column:created_at" form:"createdAt" json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" form:"updatedAt" json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" form:"deletedAt" sql:"index" json:"deletedAt"` }
type IndexPage ¶
type IndexPage struct { Total int `json:"total"` //总数 Page int `json:"page" ` //页数 Num int `json:"num" ` //数量 }
分页参数返回
type SqlAttributes ¶ added in v1.4.21
============================================= 自动建表语句
func NewSqlAttributes ¶ added in v1.4.21
func NewSqlAttributes(primaryKey, tableName string) *SqlAttributes
func (*SqlAttributes) ExecCreateTable ¶ added in v1.4.21
func (sa *SqlAttributes) ExecCreateTable(colValMap map[string]interface{}, db *gorm.DB) error
根据 map 创建表
func (*SqlAttributes) ExecCreateTableByJsonStru ¶ added in v1.4.21
func (sa *SqlAttributes) ExecCreateTableByJsonStru(colValStru interface{}, db *gorm.DB) error
根据 结构体 创建表
func (*SqlAttributes) ExecCreateTableByXmlStru ¶ added in v1.4.21
func (sa *SqlAttributes) ExecCreateTableByXmlStru(colValStru interface{}, db *gorm.DB) error
根据 结构体 创建表
func (*SqlAttributes) GenerateCreateSql ¶ added in v1.4.21
func (sa *SqlAttributes) GenerateCreateSql(colValMap map[string]interface{})
生成sql语句
type WriterSqlServer ¶
type WriterSqlServer struct { }
func (WriterSqlServer) Printf ¶
func (w WriterSqlServer) Printf(format string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.