demo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddressViewVar = AddressView{}
)
View Source
var ProductPriceIndexVar = ProductPriceIndex{}
View Source
var (
	ProductViewVar = ProductView{}
)
View Source
var UserAddrIndexVar = UserAddrIndex{}
View Source
var UserAgeIndexVar = UserAgeIndex{}
View Source
var (
	UserViewVar = UserView{}
)

Functions

func Init

func Init(eng storage.Engine)

Types

type Address

type Address struct {
	Id   int64  `xorm:"pk BIGINT(20) autoincr" json:"id"`
	Addr string `xorm:"VARCHAR(1024) not null" json:"addr"`
}

func NewAddress

func NewAddress() *Address

func (Address) GetField

func (x Address) GetField(field string) (interface{}, bool)

func (Address) Key

func (x Address) Key() interface{}

func (Address) Meta

func (Address) Meta() AddressMeta

func (*Address) SetField

func (x *Address) SetField(field, value string) error

func (*Address) SetKey

func (x *Address) SetKey(value string) error

func (Address) TableMeta

func (Address) TableMeta() storage.TableMeta

type AddressMeta

type AddressMeta struct {
	F_addr string
}

Meta

func (AddressMeta) Fields

func (AddressMeta) Fields() []string

func (AddressMeta) Key

func (AddressMeta) Key() string

func (AddressMeta) Name

func (AddressMeta) Name() string

type AddressSlice

type AddressSlice []Address

Slice

func NewAddressSlice

func NewAddressSlice(cap int) *AddressSlice

func (AddressSlice) Len

func (s AddressSlice) Len() int

func (*AddressSlice) New

func (s *AddressSlice) New(table string, index int, key string) (storage.Table, error)

func (*AddressSlice) Slice

func (s *AddressSlice) Slice() []Address

func (AddressSlice) TableMeta

func (s AddressSlice) TableMeta() storage.TableMeta

type AddressView

type AddressView struct {
	Address
}

View

func (AddressView) Fields

func (AddressView) Fields() storage.FieldList

func (AddressView) Refs

func (AddressView) Refs() map[string]storage.View

func (AddressView) TableMeta

func (AddressView) TableMeta() storage.TableMeta

type AddressViewSlice

type AddressViewSlice []AddressView

func NewAddressViewSlice

func NewAddressViewSlice(cap int) *AddressViewSlice

func (AddressViewSlice) Len

func (s AddressViewSlice) Len() int

func (*AddressViewSlice) New

func (s *AddressViewSlice) New(table string, index int, key string) (storage.Table, error)

func (*AddressViewSlice) Slice

func (s *AddressViewSlice) Slice() []AddressView

func (AddressViewSlice) TableMeta

func (s AddressViewSlice) TableMeta() storage.TableMeta

type Product

type Product struct {
	Id    int64  `xorm:"pk BIGINT(20) autoincr" json:"id"`
	Price int32  `xorm:"INT(10) not null DEFAULT 1" json:"price"`
	Name  string `xorm:"VARCHAR(256) not null" json:"name"`
	Image string `xorm:"VARCHAR(512) not null" json:"image"`
	Desc  string `xorm:"VARCHAR(1024) not null DEFAULT 'hello'" json:"desc"`
}

func NewProduct

func NewProduct() *Product

func (Product) GetField

func (x Product) GetField(field string) (interface{}, bool)

func (Product) Key

func (x Product) Key() interface{}

func (Product) Meta

func (Product) Meta() ProductMeta

func (*Product) SetField

func (x *Product) SetField(field, value string) error

func (*Product) SetKey

func (x *Product) SetKey(value string) error

func (Product) TableMeta

func (Product) TableMeta() storage.TableMeta

type ProductMeta

type ProductMeta struct {
	F_price string
	F_name  string
	F_image string
	F_desc  string
}

Meta

func (ProductMeta) Fields

func (ProductMeta) Fields() []string

func (ProductMeta) Key

func (ProductMeta) Key() string

func (ProductMeta) Name

func (ProductMeta) Name() string

type ProductPriceIndex

type ProductPriceIndex struct{}

Index

func (ProductPriceIndex) Name

func (ProductPriceIndex) Name() string

func (ProductPriceIndex) Remove

func (index ProductPriceIndex) Remove(session storage.Session, keys ...interface{}) error

func (ProductPriceIndex) TableMeta

func (ProductPriceIndex) TableMeta() storage.TableMeta

func (ProductPriceIndex) Update

func (index ProductPriceIndex) Update(session storage.Session, table storage.ReadonlyTable, key interface{}, updatedFields []string) error

type ProductSlice

type ProductSlice []Product

Slice

func NewProductSlice

func NewProductSlice(cap int) *ProductSlice

func (ProductSlice) Len

func (s ProductSlice) Len() int

func (*ProductSlice) New

func (s *ProductSlice) New(table string, index int, key string) (storage.Table, error)

func (*ProductSlice) Slice

func (s *ProductSlice) Slice() []Product

func (ProductSlice) TableMeta

func (s ProductSlice) TableMeta() storage.TableMeta

type ProductView

type ProductView struct {
	Product
}

View

func (ProductView) Fields

func (ProductView) Fields() storage.FieldList

func (ProductView) Refs

func (ProductView) Refs() map[string]storage.View

func (ProductView) TableMeta

func (ProductView) TableMeta() storage.TableMeta

type ProductViewSlice

type ProductViewSlice []ProductView

func NewProductViewSlice

func NewProductViewSlice(cap int) *ProductViewSlice

func (ProductViewSlice) Len

func (s ProductViewSlice) Len() int

func (*ProductViewSlice) New

func (s *ProductViewSlice) New(table string, index int, key string) (storage.Table, error)

func (*ProductViewSlice) Slice

func (s *ProductViewSlice) Slice() []ProductView

func (ProductViewSlice) TableMeta

func (s ProductViewSlice) TableMeta() storage.TableMeta

type User

type User struct {
	Id        int64  `xorm:"pk BIGINT(20)" json:"id"`
	Name      string `xorm:"VARCHAR(64) not null DEFAULT ''" json:"name"`
	Age       int    `xorm:"BIGINT(20)" json:"age"`
	AddrId    int64  `xorm:"BIGINT(20)" json:"addr_id"`
	ProductId int64  `xorm:"BIGINT(20)" json:"product_id"`
	IsRobot   bool   `xorm:"TINYINT(1)  DEFAULT false" json:"is_robot"`
}

func NewUser

func NewUser() *User

func (User) GetField

func (x User) GetField(field string) (interface{}, bool)

func (User) Key

func (x User) Key() interface{}

func (User) Meta

func (User) Meta() UserMeta

func (*User) SetField

func (x *User) SetField(field, value string) error

func (*User) SetKey

func (x *User) SetKey(value string) error

func (User) TableMeta

func (User) TableMeta() storage.TableMeta

type UserAddrIndex

type UserAddrIndex struct{}

Index

func (UserAddrIndex) Name

func (UserAddrIndex) Name() string

func (UserAddrIndex) Remove

func (index UserAddrIndex) Remove(session storage.Session, keys ...interface{}) error

func (UserAddrIndex) TableMeta

func (UserAddrIndex) TableMeta() storage.TableMeta

func (UserAddrIndex) Update

func (index UserAddrIndex) Update(session storage.Session, table storage.ReadonlyTable, key interface{}, updatedFields []string) error

type UserAgeIndex

type UserAgeIndex struct{}

Index

func (UserAgeIndex) Name

func (UserAgeIndex) Name() string

func (UserAgeIndex) Remove

func (index UserAgeIndex) Remove(session storage.Session, keys ...interface{}) error

func (UserAgeIndex) TableMeta

func (UserAgeIndex) TableMeta() storage.TableMeta

func (UserAgeIndex) Update

func (index UserAgeIndex) Update(session storage.Session, table storage.ReadonlyTable, key interface{}, updatedFields []string) error

type UserMeta

type UserMeta struct {
	F_name       string
	F_age        string
	F_addr_id    string
	F_product_id string
	F_is_robot   string
}

Meta

func (UserMeta) Fields

func (UserMeta) Fields() []string

func (UserMeta) Key

func (UserMeta) Key() string

func (UserMeta) Name

func (UserMeta) Name() string

type UserSlice

type UserSlice []User

Slice

func NewUserSlice

func NewUserSlice(cap int) *UserSlice

func (UserSlice) Len

func (s UserSlice) Len() int

func (*UserSlice) New

func (s *UserSlice) New(table string, index int, key string) (storage.Table, error)

func (*UserSlice) Slice

func (s *UserSlice) Slice() []User

func (UserSlice) TableMeta

func (s UserSlice) TableMeta() storage.TableMeta

type UserView

type UserView struct {
	User
	Address AddressView
	Product ProductView
}

View

func (UserView) Fields

func (UserView) Fields() storage.FieldList

func (UserView) Refs

func (UserView) Refs() map[string]storage.View

func (UserView) TableMeta

func (UserView) TableMeta() storage.TableMeta

type UserViewSlice

type UserViewSlice []UserView

func NewUserViewSlice

func NewUserViewSlice(cap int) *UserViewSlice

func (UserViewSlice) Len

func (s UserViewSlice) Len() int

func (*UserViewSlice) New

func (s *UserViewSlice) New(table string, index int, key string) (storage.Table, error)

func (*UserViewSlice) Slice

func (s *UserViewSlice) Slice() []UserView

func (UserViewSlice) TableMeta

func (s UserViewSlice) TableMeta() storage.TableMeta

Jump to

Keyboard shortcuts

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