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 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(k string, v interface{}) string
- 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 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 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 LikeStr(keyStr string) string
- 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 Updates(db *gorm.DB, where interface{}, value interface{}) error
- type CommonModel
- type DictionaryInfo
- type GinModel
- type IndexPage
- type PageWhere
- type Repo
- type TableInfo
- type Writer
- type WriterSqlServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectMySql ¶
func ConnectSqlServer ¶
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 GetColumnNameList ¶
func GetColumnNameList(db *gorm.DB, DBName, TableName string, out *[]DictionaryInfo) error
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 GetSqlServerDB ¶
func GetUserTypeByAppUserId ¶
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 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 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.