out

package
v0.0.0-...-56ebded Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2017 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 Prop2

type Prop2 struct {
	Field1 string
	Field2 int
}

type ScannerValuer

type ScannerValuer interface {
	sql.Scanner
	driver.Valuer
}

ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.

type Slice

type Slice []ScannerValuer

Slice is a slice of ScannerValuers.

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.

func (StringSlice) Value

func (ss StringSlice) Value() (driver.Value, error)

Value satisfies the driver.Valuer 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 NewEmptyUser

func NewEmptyUser() *User

NewEmptyUser create empty instance

func UserByID

func UserByID(db XODB, id int32) (*User, error)

UserByID retrieves a row from '`testxo`.`user`' as a User.

Generated from index 'user_id_pkey'.

func (*User) Delete

func (u *User) Delete(db XODB) error

Delete deletes the User from the database.

func (*User) Deleted

func (u *User) Deleted() bool

Deleted provides information if the User has been deleted from the database.

func (*User) Exists

func (u *User) Exists() bool

Exists determines if the User exists in the database.

func (*User) GetAge

func (u *User) GetAge() sql.NullInt64

func (*User) GetExAge

func (u *User) GetExAge() int

func (*User) GetExName

func (u *User) GetExName() string

func (*User) GetID

func (u *User) GetID() int32

func (*User) GetName

func (u *User) GetName() sql.NullString

func (*User) GetProp2

func (u *User) GetProp2() *Prop2

func (*User) GetProperties

func (u *User) GetProperties() []*UserProperty

func (*User) GetProperty

func (u *User) GetProperty() *UserProperty

func (*User) Insert

func (u *User) Insert(db XODB) error

Insert inserts the User to the database.

func (*User) Save

func (u *User) Save(db XODB) error

Save saves the User to the database.

func (*User) Update

func (u *User) Update(db XODB) error

Update updates the User in the database.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL