Documentation ¶
Overview ¶
Code generated by github.com/cascax/sql2gorm
Index ¶
- Variables
- func ModifyStatementCreate(db *gorm.DB)
- func ModifyStatementWhere(db *gorm.DB)
- func ModifyStatementWhere2(stmt *gorm.Statement, fieldName string, fieldValue interface{})
- func ModifyStatementWhere3(stmt *gorm.Statement)
- func NewDB(mongoCnf z1mongo.MongoConfig, tomongo gormplugin.ToMongo, ...) (err error)
- func Z1ParsingModel(db *gorm.DB, model interface{}) (isMongo bool)
- func Z1ParsingModelOld(model interface{}) (isMongo, isSlice bool)
- func Z1ToDryRun(db *gorm.DB)
- func Z1ToDryRun1(db *gorm.DB, modelIsMongo bool)
- func Z1ToMongo(db *gorm.DB)
- func Z1ToMongo1(db *gorm.DB, model interface{}, stmt *gorm.Statement, modelIsMongo bool)
- type DBs
- type ModifyStatementWhereSetting
- type MongoRole
- type MongoUser
- type MongoUserRole
- type Role
- type User
- type UserRole
- type Z1Model
- type Z1Modeli
- type Z1field
Constants ¶
This section is empty.
Variables ¶
View Source
var Z1field2StatementWhere map[string][]Z1field
Functions ¶
func ModifyStatementCreate ¶ added in v0.10.0
func ModifyStatementWhere ¶ added in v0.10.0
ModifyStatementWhereSettingDefault{On:false,ExcludedTables:`,user,role,`,FieldName:`place_id`,FieldValue:123456}
func ModifyStatementWhere2 ¶ added in v0.10.0
func ModifyStatementWhere3 ¶ added in v0.10.0
Z1field2StatementWhere[`staff`]=[]Z1field{Z1field{Name:`palce_id`,Value:0}}
func NewDB ¶
func NewDB(mongoCnf z1mongo.MongoConfig, tomongo gormplugin.ToMongo, addStatement gormplugin.AddStatement, gormConfig gorm.Config, dialectors ...gorm.Dialector) (err error)
use addStatement
db = db.WithContext(context.WithValue( context.Background(), `z1AddStatement`, map[string]interface{}{ `status`: 735, },
))
use sql2gorm sql2gorm: $(go env GOMODCACHE)/$(go mod graph | grep 'gitee.com/myzero1/gotool' | head -n 2 | tail -n 1 | sed 's/ .*//')/z1db/scripts/z1sql2gorm.sh github.com/cloudquery/sqlite // no cgo,go get github.com/cloudquery/sqlite@v1.0.1 gorm.io/driver/sqlite gorm.io/driver/mysql gorm.io/driver/postgres
func Z1ParsingModel ¶ added in v0.10.0
func Z1ParsingModelOld ¶ added in v0.10.0
func Z1ParsingModelOld(model interface{}) (isMongo, isSlice bool)
func Z1ToDryRun ¶
func Z1ToDryRun1 ¶ added in v0.10.0
Types ¶
type ModifyStatementWhereSetting ¶ added in v0.10.0
type ModifyStatementWhereSetting struct { On bool ExcludedTables string FieldName string FieldValue interface{} }
var ModifyStatementWhereSettingDefault ModifyStatementWhereSetting
type MongoUser ¶ added in v0.9.1
type MongoUser struct { Z1Model Username string `gorm:"column:username" json:"username" bson:"username"` Email string `gorm:"column:email" json:"email" bson:"email"` MobilePhone string `gorm:"column:mobile_phone" json:"mobile_phone" bson:"mobile_phone"` Avatar string `gorm:"column:avatar" json:"avatar" bson:"avatar"` Password string `gorm:"column:password" json:"password" bson:"password"` ApiToken string `gorm:"column:api_token" json:"api_token" bson:"api_token"` Status int64 `gorm:"column:status;default:1" json:"status" bson:"status"` Rid int64 `gorm:"column:rid;default:1" json:"rid" bson:"rid"` }
type MongoUserRole ¶ added in v0.9.1
type User ¶ added in v0.9.1
type User struct { Z1Model Username string `gorm:"column:username" json:"username" bson:"username"` Email string `gorm:"column:email" json:"email" bson:"email"` MobilePhone string `gorm:"column:mobile_phone" json:"mobile_phone" bson:"mobile_phone"` Avatar string `gorm:"column:avatar" json:"avatar" bson:"avatar"` Password string `gorm:"column:password" json:"password" bson:"password"` ApiToken string `gorm:"column:api_token" json:"api_token" bson:"api_token"` Status int64 `gorm:"column:status;default:1" json:"status" bson:"status"` Rid int64 `gorm:"column:rid;default:1" json:"rid" bson:"rid"` }
type Z1Model ¶
type Z1Model struct { ID int64 `gorm:"column:id;primarykey" json:"id" bson:"id"` // 默认自增,可以人为设置sonyflake machineid max 65536 2^16 CreatedAt int64 `gorm:"column:created_at;not null" json:"created_at" bson:"created_at"` // 创建时间戳 UpdatedAt int64 `gorm:"column:updated_at;not null" json:"updated_at" bson:"updated_at"` // 更新时间戳 DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;index;not null;default:0" json:"deleted_at" bson:"deleted_at"` // 删除时间戳 已经改为了int64 ID_ primitive.ObjectID `gorm:"-:all" json:"_id" bson:"_id"` // for mongodb _id 这个字段是标识,是否使用MongoDB的 }
Click to show internal directories.
Click to hide internal directories.