Documentation
¶
Index ¶
- Variables
- func AutoMigrate(db *gorm.DB, dst ...interface{}) error
- func Count(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) (int64, error)
- func Create(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func Delete(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func Find(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func FindForUpdate(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func First(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func FirstForUpdate(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func IsDBClosure(opt Option) bool
- func PartialUpdate(ctx context.Context, db *gorm.DB, model interface{}, ...) error
- func Save(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func Scan(data interface{}, value interface{}) error
- func UnscopedDelete(ctx context.Context, db *gorm.DB, model interface{}, opts ...Option) error
- func Value(data interface{}) (interface{}, error)
- type Author
- type Option
- func DB(db *gorm.DB) Option
- func Limit(limit int) Option
- func Offset(offset int) Option
- func Order(value interface{}) Option
- func Select(fields ...string) Option
- func StudentModelId(x int32) Option
- func TableName(name string) Option
- func UserModelAddress(x string) Option
- func UserModelId(x int32) Option
- func UserModelName(x string) Option
- type Status
- type Student
- func (*Student) Descriptor() ([]byte, []int)deprecated
- func (x *Student) GetAddress() string
- func (x *Student) GetCreateTime() *timestamp.Timestamp
- func (x *Student) GetDeletedTime() *timestamp.Timestamp
- func (x *Student) GetId() int32
- func (x *Student) GetName() string
- func (x *Student) GetPhone() string
- func (x *Student) GetScore() float32
- func (x *Student) GetUpdateTime() *timestamp.Timestamp
- func (*Student) ProtoMessage()
- func (x *Student) ProtoReflect() protoreflect.Message
- func (x *Student) Reset()
- func (x *Student) String() string
- func (x *Student) StudentModel() (*StudentModel, error)
- type StudentDao
- func (dao *StudentDao) Count(ctx context.Context, opts ...Option) (int64, error)
- func (dao *StudentDao) Create(ctx context.Context, model *StudentModel, opts ...Option) (*StudentModel, error)
- func (dao *StudentDao) Delete(ctx context.Context, opts ...Option) error
- func (dao *StudentDao) DeleteUnscoped(ctx context.Context, opts ...Option) error
- func (dao *StudentDao) Find(ctx context.Context, opts ...Option) ([]*StudentModel, error)
- func (dao *StudentDao) FindForUpdate(ctx context.Context, opts ...Option) ([]*StudentModel, error)
- func (dao *StudentDao) First(ctx context.Context, opts ...Option) (*StudentModel, error)
- func (dao *StudentDao) FirstForUpdate(ctx context.Context, opts ...Option) (*StudentModel, error)
- func (dao *StudentDao) PartialUpdate(ctx context.Context, model *StudentModel, fields map[string]interface{}, ...) (*StudentModel, error)
- func (dao *StudentDao) Save(ctx context.Context, model *StudentModel, opts ...Option) (*StudentModel, error)
- type StudentModel
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetAddress() string
- func (x *User) GetAuthor() *User_Author
- func (x *User) GetBalance() float64
- func (x *User) GetCreateTime() *timestamp.Timestamp
- func (x *User) GetD1() int64
- func (x *User) GetDate() *timestamp.Timestamp
- func (x *User) GetDeletedTime() *timestamp.Timestamp
- func (x *User) GetEmail() string
- func (x *User) GetExtra() []byte
- func (x *User) GetId() int32
- func (x *User) GetIds() []int32
- func (x *User) GetM1() map[string]string
- func (x *User) GetName() string
- func (x *User) GetPhone() string
- func (x *User) GetScore() float32
- func (x *User) GetStatus() Status
- func (x *User) GetStatus1() Status
- func (x *User) GetStatus2() Status
- func (x *User) GetT1() int64
- func (x *User) GetT2() uint64
- func (x *User) GetT3() string
- func (x *User) GetUpdateTime() *timestamp.Timestamp
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- func (x *User) UserModel() (*UserModel, error)
- type UserDao
- func (dao *UserDao) Count(ctx context.Context, opts ...Option) (int64, error)
- func (dao *UserDao) Create(ctx context.Context, model *UserModel, opts ...Option) (*UserModel, error)
- func (dao *UserDao) Delete(ctx context.Context, opts ...Option) error
- func (dao *UserDao) DeleteUnscoped(ctx context.Context, opts ...Option) error
- func (dao *UserDao) Find(ctx context.Context, opts ...Option) ([]*UserModel, error)
- func (dao *UserDao) FindForUpdate(ctx context.Context, opts ...Option) ([]*UserModel, error)
- func (dao *UserDao) First(ctx context.Context, opts ...Option) (*UserModel, error)
- func (dao *UserDao) FirstForUpdate(ctx context.Context, opts ...Option) (*UserModel, error)
- func (dao *UserDao) PartialUpdate(ctx context.Context, model *UserModel, fields map[string]interface{}, ...) (*UserModel, error)
- func (dao *UserDao) Save(ctx context.Context, model *UserModel, opts ...Option) (*UserModel, error)
- type UserModel
- type UserModelIdsList
- type UserModelM1Map
- type User_Author
- func (*User_Author) Descriptor() ([]byte, []int)deprecated
- func (x *User_Author) GetEmail() string
- func (x *User_Author) GetName() string
- func (*User_Author) ProtoMessage()
- func (x *User_Author) ProtoReflect() protoreflect.Message
- func (x *User_Author) Reset()
- func (x *User_Author) String() string
- func (x *User_Author) User_AuthorModel() (*User_AuthorModel, error)
- type User_AuthorModel
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Status_name = map[int32]string{ 0: "UNKNOWN", 1: "PENDING", } Status_value = map[string]int32{ "UNKNOWN": 0, "PENDING": 1, } )
Enum value maps for Status.
View Source
var File_model_proto protoreflect.FileDescriptor
Functions ¶
func AutoMigrate ¶
func FindForUpdate ¶
func FirstForUpdate ¶
func IsDBClosure ¶
func PartialUpdate ¶
func UnscopedDelete ¶
Types ¶
type Author ¶
type Author struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
// contains filtered or unexported fields
}
func (*Author) Descriptor
deprecated
func (*Author) ProtoMessage ¶
func (*Author) ProtoMessage()
func (*Author) ProtoReflect ¶
func (x *Author) ProtoReflect() protoreflect.Message
type Status ¶
type Status int32
func (Status) Descriptor ¶
func (Status) Descriptor() protoreflect.EnumDescriptor
func (Status) EnumDescriptor
deprecated
func (Status) Number ¶
func (x Status) Number() protoreflect.EnumNumber
func (Status) Type ¶
func (Status) Type() protoreflect.EnumType
type Student ¶
type Student struct {
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
Score float32 `protobuf:"fixed32,5,opt,name=score,proto3" json:"score,omitempty"`
CreateTime *timestamp.Timestamp `protobuf:"bytes,6,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
UpdateTime *timestamp.Timestamp `protobuf:"bytes,7,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
DeletedTime *timestamp.Timestamp `protobuf:"bytes,8,opt,name=deleted_time,json=deletedTime,proto3" json:"deleted_time,omitempty"`
// contains filtered or unexported fields
}
func (*Student) Descriptor
deprecated
func (*Student) GetAddress ¶
func (*Student) GetCreateTime ¶
func (*Student) GetDeletedTime ¶
func (*Student) GetUpdateTime ¶
func (*Student) ProtoMessage ¶
func (*Student) ProtoMessage()
func (*Student) ProtoReflect ¶
func (x *Student) ProtoReflect() protoreflect.Message
func (*Student) StudentModel ¶
func (x *Student) StudentModel() (*StudentModel, error)
type StudentDao ¶
type StudentDao struct {
// contains filtered or unexported fields
}
func NewStudentDao ¶
func NewStudentDao(db *gorm.DB) *StudentDao
func (*StudentDao) Create ¶
func (dao *StudentDao) Create(ctx context.Context, model *StudentModel, opts ...Option) (*StudentModel, error)
func (*StudentDao) Delete ¶
func (dao *StudentDao) Delete(ctx context.Context, opts ...Option) error
func (*StudentDao) DeleteUnscoped ¶
func (dao *StudentDao) DeleteUnscoped(ctx context.Context, opts ...Option) error
func (*StudentDao) Find ¶
func (dao *StudentDao) Find(ctx context.Context, opts ...Option) ([]*StudentModel, error)
func (*StudentDao) FindForUpdate ¶
func (dao *StudentDao) FindForUpdate(ctx context.Context, opts ...Option) ([]*StudentModel, error)
func (*StudentDao) First ¶
func (dao *StudentDao) First(ctx context.Context, opts ...Option) (*StudentModel, error)
func (*StudentDao) FirstForUpdate ¶
func (dao *StudentDao) FirstForUpdate(ctx context.Context, opts ...Option) (*StudentModel, error)
func (*StudentDao) PartialUpdate ¶
func (dao *StudentDao) PartialUpdate(ctx context.Context, model *StudentModel, fields map[string]interface{}, opts ...Option) (*StudentModel, error)
func (*StudentDao) Save ¶
func (dao *StudentDao) Save(ctx context.Context, model *StudentModel, opts ...Option) (*StudentModel, error)
type StudentModel ¶
type StudentModel struct {
Id int32 `gorm:"column:id;type:bigint;primaryKey" json:"id,omitempty"`
Name string `gorm:"column:name" json:"name,omitempty"`
Address string `gorm:"column:address" json:"address,omitempty"`
Phone string `gorm:"column:phone" json:"phone,omitempty"`
Score float32 `gorm:"column:score" json:"score,omitempty"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;autoCreateTime;not null" json:"create_time,omitempty"`
UpdateTime time.Time `gorm:"column:update_time;type:datetime;autoUpdateTime;not null" json:"update_time,omitempty"`
DeletedTime gorm.DeletedAt `gorm:"column:deleted_time;type:datetime;index:idx_deleted_time" json:"deleted_time,omitempty"`
}
GormModel is an option for Student
func (*StudentModel) Student ¶
func (x *StudentModel) Student() (*Student, error)
func (*StudentModel) TableName ¶
func (x *StudentModel) TableName() string
type User ¶
type User struct {
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
Phone string `protobuf:"bytes,5,opt,name=phone,proto3" json:"phone,omitempty"`
Score float32 `protobuf:"fixed32,6,opt,name=score,proto3" json:"score,omitempty"`
Balance float64 `protobuf:"fixed64,7,opt,name=balance,proto3" json:"balance,omitempty"`
CreateTime *timestamp.Timestamp `protobuf:"bytes,8,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
UpdateTime *timestamp.Timestamp `protobuf:"bytes,9,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
DeletedTime *timestamp.Timestamp `protobuf:"bytes,11,opt,name=deleted_time,json=deletedTime,proto3" json:"deleted_time,omitempty"`
Date *timestamp.Timestamp `protobuf:"bytes,10,opt,name=date,proto3" json:"date,omitempty"`
Extra []byte `protobuf:"bytes,12,opt,name=extra,proto3" json:"extra,omitempty"`
Author *User_Author `protobuf:"bytes,13,opt,name=author,proto3" json:"author,omitempty"`
Status Status `protobuf:"varint,14,opt,name=status,proto3,enum=model.Status" json:"status,omitempty"`
Status1 Status `protobuf:"varint,15,opt,name=status1,proto3,enum=model.Status" json:"status1,omitempty"`
Status2 Status `protobuf:"varint,16,opt,name=status2,proto3,enum=model.Status" json:"status2,omitempty"`
T1 int64 `protobuf:"varint,18,opt,name=t1,proto3" json:"t1,omitempty"`
T2 uint64 `protobuf:"varint,19,opt,name=t2,proto3" json:"t2,omitempty"`
T3 string `protobuf:"bytes,20,opt,name=t3,proto3" json:"t3,omitempty"`
D1 int64 `protobuf:"varint,21,opt,name=d1,proto3" json:"d1,omitempty"`
Ids []int32 `protobuf:"varint,22,rep,packed,name=ids,proto3" json:"ids,omitempty"`
M1 map[string]string `` /* 146-byte string literal not displayed */
// contains filtered or unexported fields
}
func (*User) Descriptor
deprecated
func (*User) GetAddress ¶
func (*User) GetAuthor ¶
func (x *User) GetAuthor() *User_Author
func (*User) GetBalance ¶
func (*User) GetCreateTime ¶
func (*User) GetDeletedTime ¶
func (*User) GetStatus1 ¶
func (*User) GetStatus2 ¶
func (*User) GetUpdateTime ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserDao ¶
type UserDao struct {
// contains filtered or unexported fields
}
func NewUserDao ¶
func (*UserDao) DeleteUnscoped ¶
func (*UserDao) FindForUpdate ¶
func (*UserDao) FirstForUpdate ¶
func (*UserDao) PartialUpdate ¶
type UserModel ¶
type UserModel struct {
Id int32 `gorm:"column:id;type:bigint;primaryKey" json:"id,omitempty"`
Name string `gorm:"column:name;index:idx_name_addr,unique" json:"name,omitempty"`
Email string `gorm:"column:email" json:"email,omitempty"`
Address string `gorm:"column:address;index:idx_name_addr,unique" json:"address,omitempty"`
Phone string `gorm:"column:phone" json:"phone,omitempty"`
Score float32 `gorm:"column:score;type:decimal(10,2) unsigned;not null" json:"score,omitempty"`
Balance float64 `gorm:"column:balance" json:"balance,omitempty"`
CreateTime time.Time `gorm:"column:create_time;type:datetime;autoCreateTime;not null" json:"create_time,omitempty"`
UpdateTime time.Time `gorm:"column:update_time;type:datetime;autoUpdateTime;not null" json:"update_time,omitempty"`
DeletedTime gorm.DeletedAt `gorm:"column:deleted_time;type:datetime;index:idx_deleted_time" json:"deleted_time,omitempty"`
Date datatypes.Date `gorm:"column:date;type:date" json:"date,omitempty"`
Extra []byte `gorm:"column:extra;type:tinyblob;default:'abc'" json:"extra,omitempty"`
Author *User_AuthorModel `gorm:"-" json:"author,omitempty"`
Status string `gorm:"column:status;type:enum('PENDING','UNKNOWN');default:'UNKNOWN'" json:"status,omitempty"`
Status1 string `gorm:"column:status1;default:'UNKNOWN'" json:"status1,omitempty"`
Status2 Status `gorm:"column:status2;type:int;default:0" json:"status2,omitempty"`
T1 time.Time `gorm:"column:t1;type:datetime;autoCreateTime;not null" json:"t1,omitempty"`
T2 time.Time `gorm:"column:t2;type:datetime;autoUpdateTime;not null" json:"t2,omitempty"`
T3 time.Time `gorm:"column:t3;type:datetime;not null" json:"t3,omitempty"`
D1 datatypes.Date `gorm:"column:d1;type:date" json:"d1,omitempty"`
Ids UserModelIdsList `gorm:"column:ids;type:longtext" json:"ids,omitempty"`
M1 UserModelM1Map `gorm:"column:m1;type:longtext" json:"m1,omitempty"`
}
GormModel is an option for User
type UserModelIdsList ¶
type UserModelIdsList []int32
func (*UserModelIdsList) Scan ¶
func (x *UserModelIdsList) Scan(value interface{}) error
type UserModelM1Map ¶
func (*UserModelM1Map) Scan ¶
func (x *UserModelM1Map) Scan(value interface{}) error
type User_Author ¶
type User_Author struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
// contains filtered or unexported fields
}
func (*User_Author) Descriptor
deprecated
func (*User_Author) Descriptor() ([]byte, []int)
Deprecated: Use User_Author.ProtoReflect.Descriptor instead.
func (*User_Author) GetEmail ¶
func (x *User_Author) GetEmail() string
func (*User_Author) GetName ¶
func (x *User_Author) GetName() string
func (*User_Author) ProtoMessage ¶
func (*User_Author) ProtoMessage()
func (*User_Author) ProtoReflect ¶
func (x *User_Author) ProtoReflect() protoreflect.Message
func (*User_Author) Reset ¶
func (x *User_Author) Reset()
func (*User_Author) String ¶
func (x *User_Author) String() string
func (*User_Author) User_AuthorModel ¶
func (x *User_Author) User_AuthorModel() (*User_AuthorModel, error)
type User_AuthorModel ¶
type User_AuthorModel struct {
Name string `gorm:"column:name" json:"name,omitempty"`
Email string `gorm:"column:email" json:"email,omitempty"`
}
GormModel is an option for User_Author
func (*User_AuthorModel) User_Author ¶
func (x *User_AuthorModel) User_Author() (*User_Author, error)
Click to show internal directories.
Click to hide internal directories.