test

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_ID uint64 = 1 << iota
	USER_NAME
	USER_AGE
	USER_FOLLOWINGS
	USER_FOLLOWERS

	UserFieldEnd             = iota
	UserFieldsAll            = 1<<UserFieldEnd - 1
	UserFieldsExcpId         = UserFieldsAll & (^USER_ID)
	UserFieldsExcpName       = UserFieldsAll & (^USER_NAME)
	UserFieldsExcpAge        = UserFieldsAll & (^USER_AGE)
	UserFieldsExcpFollowings = UserFieldsAll & (^USER_FOLLOWINGS)
	UserFieldsExcpFollowers  = UserFieldsAll & (^USER_FOLLOWERS)

	UserTable         = "user"
	UserIdCol         = "id"
	UserNameCol       = "name"
	UserAgeCol        = "age"
	UserFollowingsCol = "followings"
	UserFollowersCol  = "followers"
)
View Source
const (
	FOLLOW_USERID uint64 = 1 << iota
	FOLLOW_FOLLOWUSERID

	FollowFieldEnd               = iota
	FollowFieldsAll              = 1<<FollowFieldEnd - 1
	FollowFieldsExcpUserId       = FollowFieldsAll & (^FOLLOW_USERID)
	FollowFieldsExcpFollowUserId = FollowFieldsAll & (^FOLLOW_FOLLOWUSERID)

	FollowTable           = "user_follow"
	FollowUserIdCol       = "user_id"
	FollowFollowUserIdCol = "follow_user_id"
)

Variables

View Source
var (
	FollowInstance = new(Follow)
)
View Source
var (
	UserInstance = new(User)
)

Functions

func ASTConv

func ASTConv()

gomodel astConv = [

INSERT INTO Follow(UserId, FollowUserId)
    SELECT ?, ? FROM DUAL
    WHERE EXISTS(SELECT Id FROM User WHERE Id=?)

]

Types

type Follow

type Follow struct {
	UserId       int64 `table:"user_follow"`
	FollowUserId int64
}

func (*Follow) Columns

func (ff *Follow) Columns() []string

func (*Follow) Ptrs

func (ff *Follow) Ptrs(fields uint64, ptrs []interface{})

func (*Follow) Table

func (ff *Follow) Table() string

func (*Follow) TxDo added in v0.6.3

func (ff *Follow) TxDo(exec gomodel.Executor, do func(*gomodel.Tx, *Follow) error) error

func (*Follow) Vals

func (ff *Follow) Vals(fields uint64, vals []interface{})

type FollowStore added in v0.6.3

type FollowStore struct {
	Values []Follow
	Fields uint64
}

func (*FollowStore) Clear added in v0.6.3

func (a *FollowStore) Clear()

func (*FollowStore) Final added in v0.6.3

func (s *FollowStore) Final(size int)

func (*FollowStore) Init added in v0.6.3

func (s *FollowStore) Init(size int)

func (*FollowStore) Ptrs added in v0.6.3

func (s *FollowStore) Ptrs(index int, ptrs []interface{})

func (*FollowStore) Realloc added in v0.6.3

func (s *FollowStore) Realloc(count int) int

type User

type User struct {
	Id   int64
	Name string
	Age  int

	Followings int
	Followers  int
}

func (*User) Columns

func (uu *User) Columns() []string

func (*User) Ptrs

func (uu *User) Ptrs(fields uint64, ptrs []interface{})

func (*User) Table

func (uu *User) Table() string

func (*User) TxDo added in v0.6.3

func (uu *User) TxDo(exec gomodel.Executor, do func(*gomodel.Tx, *User) error) error

func (*User) Vals

func (uu *User) Vals(fields uint64, vals []interface{})

type UserStore added in v0.6.3

type UserStore struct {
	Values []User
	Fields uint64
}

func (*UserStore) Clear added in v0.6.3

func (a *UserStore) Clear()

func (*UserStore) Final added in v0.6.3

func (s *UserStore) Final(size int)

func (*UserStore) Init added in v0.6.3

func (s *UserStore) Init(size int)

func (*UserStore) Ptrs added in v0.6.3

func (s *UserStore) Ptrs(index int, ptrs []interface{})

func (*UserStore) Realloc added in v0.6.3

func (s *UserStore) Realloc(count int) int

Jump to

Keyboard shortcuts

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