Documentation ¶
Overview ¶
Package out contains the types for schema 'testxo'.
Package out contains the types for schema 'testxo'.
Package out contains the types for schema 'testxo'.
Index ¶
- Variables
- type Prop2
- type ScannerValuer
- type Slice
- type StringSlice
- type User
- func (u *User) Delete(db XODB) error
- func (u *User) Deleted() bool
- func (u *User) Exists() bool
- func (u *User) GetAge() sql.NullInt64
- func (u *User) GetExAge() int
- func (u *User) GetExName() string
- func (u *User) GetID() int32
- func (u *User) GetName() sql.NullString
- func (u *User) GetProp2() *Prop2
- func (u *User) GetProperties() []*UserProperty
- func (u *User) GetProperty() *UserProperty
- func (u *User) Insert(db XODB) error
- func (u *User) Save(db XODB) error
- func (u *User) Update(db XODB) error
- type UserProperty
- func (up *UserProperty) Delete(db XODB) error
- func (up *UserProperty) Deleted() bool
- func (up *UserProperty) Exists() bool
- func (up *UserProperty) GetCompleteIds() []int32
- func (up *UserProperty) GetID() int32
- func (up *UserProperty) GetNickname() sql.NullString
- func (up *UserProperty) GetUserID() int32
- func (up *UserProperty) Insert(db XODB) error
- func (up *UserProperty) Save(db XODB) error
- func (up *UserProperty) Update(db XODB) error
- type XODB
Constants ¶
This section is empty.
Variables ¶
var XOLog = func(format string, args ...interface{}) { fmt.Println("[SQL]: "+format, args) }
XOLog provides the log func used by generated queries.
Functions ¶
This section is empty.
Types ¶
type ScannerValuer ¶
ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings.
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(src interface{}) error
Scan satisfies the sql.Scanner interface for StringSlice.
type User ¶
type User struct { ID int32 `json:"id"` // id Property *UserProperty `json:"property"` // prop_id `xo:ref=user_property.id,name=Property` 绑定user_property表的id Prop2 *Prop2 `json:"prop2"` // prop2 `xo:conv=json,type=*Prop2` 利用json编码解码 Name sql.NullString `json:"name"` // name Age sql.NullInt64 `json:"age"` // age // extra fields ExName string `json:"ex_name"` // `xo:name=ExName,type=string` 新增ExName字段 ExAge int `json:"ex_age"` // `xo:name=ExAge,type=int` 新增ExAge字段 Properties []*UserProperty `json:"properties"` // `xo:name=Properties,ref=id#user_property.user_id` 新增Properties字段 // contains filtered or unexported fields }
User represents a row from '`testxo`.`user`'.
func UserByID ¶
UserByID retrieves a row from '`testxo`.`user`' as a User.
Generated from index 'user_id_pkey'.
func (*User) GetName ¶
func (u *User) GetName() sql.NullString
func (*User) GetProperties ¶
func (u *User) GetProperties() []*UserProperty
func (*User) GetProperty ¶
func (u *User) GetProperty() *UserProperty
type UserProperty ¶
type UserProperty struct { ID int32 `json:"id"` // id UserID int32 `json:"user_id"` // user_id Nickname sql.NullString `json:"nickname"` // nickname CompleteIds []int32 `json:"complete_ids"` // complete_ids `xo:conv=json,type=[]int32` 利用json编码解码 // contains filtered or unexported fields }
UserProperty represents a row from '`testxo`.`user_property`'.
func NewEmptyUserProperty ¶
func NewEmptyUserProperty() *UserProperty
NewEmptyUserProperty create empty instance
func UserPropertiesByUserID ¶
func UserPropertiesByUserID(db XODB, userID int32) ([]*UserProperty, error)
UserPropertiesByUserID retrieves a row from '`testxo`.`user_property`' as a UserProperty.
Generated from index 'idx_user_id'.
func UserPropertyByID ¶
func UserPropertyByID(db XODB, id int32) (*UserProperty, error)
UserPropertyByID retrieves a row from '`testxo`.`user_property`' as a UserProperty.
Generated from index 'user_property_id_pkey'.
func (*UserProperty) Delete ¶
func (up *UserProperty) Delete(db XODB) error
Delete deletes the UserProperty from the database.
func (*UserProperty) Deleted ¶
func (up *UserProperty) Deleted() bool
Deleted provides information if the UserProperty has been deleted from the database.
func (*UserProperty) Exists ¶
func (up *UserProperty) Exists() bool
Exists determines if the UserProperty exists in the database.
func (*UserProperty) GetCompleteIds ¶
func (up *UserProperty) GetCompleteIds() []int32
func (*UserProperty) GetID ¶
func (up *UserProperty) GetID() int32
func (*UserProperty) GetNickname ¶
func (up *UserProperty) GetNickname() sql.NullString
func (*UserProperty) GetUserID ¶
func (up *UserProperty) GetUserID() int32
func (*UserProperty) Insert ¶
func (up *UserProperty) Insert(db XODB) error
Insert inserts the UserProperty to the database.
func (*UserProperty) Save ¶
func (up *UserProperty) Save(db XODB) error
Save saves the UserProperty to the database.
func (*UserProperty) Update ¶
func (up *UserProperty) Update(db XODB) error
Update updates the UserProperty in the database.
type XODB ¶
type XODB interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row }
XODB is the common interface for database operations that can be used with types from schema 'testxo'.
This should work with database/sql.DB and database/sql.Tx.