models

package
v0.0.0-...-4f5e0b7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAdmin

func CreateAdmin(d *Admin) error

func CreateDeveloper

func CreateDeveloper(d *Developer) error

func CreateUser

func CreateUser(d *User) error

func CreateUserBasicInfo

func CreateUserBasicInfo(ubi *UserBasicInfo) error

func DeleteUserBasicInfoByUsername

func DeleteUserBasicInfoByUsername(username string) error

func InitDb

func InitDb(driverName, dataSourceName string) (err error)

func IsErrNotExist

func IsErrNotExist(err error) bool

IsErrNotExist checks if an error is a ErrNotExist.

Types

type Admin

type Admin struct {
	Charactar   int    `xorm:"not null INT(8)"`
	Deleted     int    `xorm:"not null default 0 TINYINT(8)"`
	DeveloperId string `xorm:"not null unique(idx_admin_user_id_developer_id_group_id) CHAR(20)"`
	GroupId     int    `xorm:"unique(idx_admin_user_id_developer_id_group_id) INT(10)"`
	UserId      int    `xorm:"not null unique(idx_admin_user_id_developer_id_group_id) INT(20)"`

	Developer *Developer `xorm:"-"`
	User      *User
}

func (Admin) Cmp

func (a Admin) Cmp(a2 Admin) int

func (*Admin) LoadDeveloper

func (a *Admin) LoadDeveloper() error

func (*Admin) LoadUser

func (a *Admin) LoadUser() error

type Admins

type Admins []*Admin

func ListAdmins

func ListAdmins(opt ListAdminsOption) (Admins, error)

func (Admins) Merge

func (ams Admins) Merge() Admins

type Api

type Api struct {
	CategoryId  int    `xorm:"not null default 0 INT(10)"`
	Description string `xorm:"not null default '' VARCHAR(512)"`
	DeveloperId string `xorm:"CHAR(20)"`
	Id          int    `xorm:"not null pk autoincr INT(10)"`
	Name        string `xorm:"not null default '' VARCHAR(64)"`
}

type ApiAuditWhitelist

type ApiAuditWhitelist struct {
	Deleted int    `xorm:"not null default 0 TINYINT(8)"`
	GroupId int    `xorm:"unique(idx_api_audit_whitelist_rtx_group_id) INT(10)"`
	Rtx     string `xorm:"unique(idx_api_audit_whitelist_rtx_group_id) CHAR(32)"`
}

type ApiCookie

type ApiCookie struct {
	CookieName  string `xorm:"not null default '' unique VARCHAR(32)"`
	CreateTime  int    `xorm:"not null default 0 INT(10)"`
	Description string `xorm:"not null default '' VARCHAR(512)"`
	DeveloperId string `xorm:"not null CHAR(20)"`
	Id          int    `xorm:"not null pk autoincr unique INT(10)"`
	IsDeleted   int    `xorm:"not null default 0 TINYINT(8)"`
	UpdateTime  int    `xorm:"not null default 0 INT(10)"`
}

type ApiGroup

type ApiGroup struct {
	DeveloperId            string `xorm:"CHAR(20)"`
	GroupDescription       string `xorm:"not null unique VARCHAR(64)"`
	GroupDescriptionPinyin string `xorm:"not null default '' VARCHAR(384)"`
	GroupId                int    `xorm:"not null pk autoincr INT(10)"`
	GroupName              string `xorm:"unique VARCHAR(64)"`
}

type ApiGroupWhitelist

type ApiGroupWhitelist struct {
	DeveloperId string `xorm:"not null pk unique(idx_api_group_whitelist_group_id_developer_id) CHAR(20)"`
	GroupId     int    `xorm:"not null pk unique(idx_api_group_whitelist_group_id_developer_id) INT(10)"`
}

type ApiVersion

type ApiVersion struct {
	Access                int    `xorm:"not null default 0 TINYINT(1)"`
	ApiId                 int    `xorm:"not null default 0 INT(10)"`
	CacheExpires          int    `xorm:"not null default 0 INT(10)"`
	ConnectTimeout        int    `xorm:"not null default 500 INT(10)"`
	Cookies               string `xorm:"not null default '' VARCHAR(264)"`
	CreateTime            int    `xorm:"not null default 0 INT(10)"`
	Creator               string `xorm:"not null default '' VARCHAR(64)"`
	DeleteCacheExpires    int    `xorm:"not null default 0 INT(11)"`
	DeleteInputDoc        string `xorm:"not null default '' VARCHAR(1024)"`
	DeleteIsCheckApp      int    `xorm:"not null default 0 TINYINT(1)"`
	DeleteIsCheckSession  int    `xorm:"not null default 0 TINYINT(1)"`
	DeleteIsPrivate       int    `xorm:"not null default 0 TINYINT(1)"`
	DeleteIsPublic        int    `xorm:"not null default 0 TINYINT(1)"`
	DeleteIsToken         int    `xorm:"not null default 0 TINYINT(1)"`
	DeleteOutputDoc       string `xorm:"not null default '' VARCHAR(1024)"`
	DeleteSessionParamMap string `xorm:"not null default '' VARCHAR(128)"`
	DeleteSessionUrlMap   string `xorm:"not null default '' VARCHAR(128)"`
	DeleteTestInputDoc    string `xorm:"not null default '' VARCHAR(64)"`
	DeleteTestOutputDoc   string `xorm:"not null default '' VARCHAR(64)"`
	Depend                string `xorm:"not null default '' VARCHAR(256)"`
	Description           string `xorm:"not null default '' VARCHAR(1024)"`
	DetailLog             int    `xorm:"not null default 0 TINYINT(1)"`
	GetCacheExpires       int    `xorm:"not null default 0 INT(10)"`
	GetInputDoc           string `xorm:"not null default '' VARCHAR(1024)"`
	GetIsCheckApp         int    `xorm:"not null default 0 TINYINT(1)"`
	GetIsCheckSession     int    `xorm:"not null default 0 TINYINT(1)"`
	GetIsPrivate          int    `xorm:"not null default 0 TINYINT(1)"`
	GetIsPublic           int    `xorm:"not null default 0 TINYINT(1)"`
	GetIsToken            int    `xorm:"not null default 0 TINYINT(1)"`
	GetOutputDoc          string `xorm:"TEXT"`
	GetSessionParamMap    string `xorm:"not null default '' VARCHAR(128)"`
	GetSessionUrlMap      string `xorm:"not null default '' VARCHAR(128)"`
	GetTestInputDoc       string `xorm:"not null default '' VARCHAR(1024)"`
	GetTestOutputDoc      string `xorm:"TEXT"`
	Id                    int    `xorm:"not null pk autoincr INT(10)"`
	IsAudit               int    `xorm:"not null default 0 TINYINT(1)"`
	IsDelete              int    `xorm:"not null default 0 TINYINT(1)"`
	IsDeleted             int    `xorm:"not null default 0 TINYINT(1)"`
	IsGet                 int    `xorm:"not null default 0 TINYINT(1)"`
	IsPatch               int    `xorm:"not null default 0 TINYINT(1)"`
	IsPost                int    `xorm:"not null default 0 TINYINT(1)"`
	IsPut                 int    `xorm:"not null default 0 TINYINT(1)"`
	MaxPerMinute          int    `xorm:"not null default 0 INT(10)"`
	Modifier              string `xorm:"not null default '' VARCHAR(512)"`
	OuterUrl              string `xorm:"VARCHAR(128)"`
	PatchCacheExpires     int    `xorm:"not null default 0 INT(11)"`
	PatchInputDoc         string `xorm:"TEXT"`
	PatchIsCheckApp       int    `xorm:"not null default 0 TINYINT(1)"`
	PatchIsCheckSession   int    `xorm:"not null default 0 TINYINT(1)"`
	PatchIsPrivate        int    `xorm:"not null default 0 TINYINT(1)"`
	PatchIsPublic         int    `xorm:"not null default 0 TINYINT(1)"`
	PatchIsToken          int    `xorm:"not null default 0 TINYINT(1)"`
	PatchOutputDoc        string `xorm:"TEXT"`
	PatchSessionParamMap  string `xorm:"not null default '' VARCHAR(128)"`
	PatchSessionUrlMap    string `xorm:"not null default '' VARCHAR(128)"`
	PatchTestInputDoc     string `xorm:"not null default '' VARCHAR(64)"`
	PatchTestOutputDoc    string `xorm:"not null default '' VARCHAR(64)"`
	PostCacheExpires      int    `xorm:"not null default 0 INT(11)"`
	PostInputDoc          string `xorm:"TEXT"`
	PostIsCheckApp        int    `xorm:"not null default 0 TINYINT(1)"`
	PostIsCheckSession    int    `xorm:"not null default 0 TINYINT(1)"`
	PostIsPrivate         int    `xorm:"not null default 0 TINYINT(1)"`
	PostIsPublic          int    `xorm:"not null default 0 TINYINT(1)"`
	PostIsToken           int    `xorm:"not null default 0 TINYINT(1)"`
	PostOutputDoc         string `xorm:"TEXT"`
	PostSessionParamMap   string `xorm:"not null default '' VARCHAR(128)"`
	PostSessionUrlMap     string `xorm:"not null default '' VARCHAR(128)"`
	PostTestInputDoc      string `xorm:"TEXT"`
	PostTestOutputDoc     string `xorm:"TEXT"`
	PreLambda             string `xorm:"not null TEXT"`
	PreUrl                string `xorm:"not null default '' VARCHAR(128)"`
	ProductLambda         string `xorm:"not null TEXT"`
	ProductUrl            string `xorm:"not null default '' VARCHAR(128)"`
	ProviderType          int    `xorm:"not null default 0 TINYINT(1)"`
	PutCacheExpires       int    `xorm:"not null default 0 INT(11)"`
	PutInputDoc           string `xorm:"TEXT"`
	PutIsCheckApp         int    `xorm:"not null default 0 TINYINT(1)"`
	PutIsCheckSession     int    `xorm:"not null default 0 TINYINT(1)"`
	PutIsPrivate          int    `xorm:"not null default 0 TINYINT(1)"`
	PutIsPublic           int    `xorm:"not null default 0 TINYINT(1)"`
	PutIsToken            int    `xorm:"not null default 0 TINYINT(1)"`
	PutOutputDoc          string `xorm:"TEXT"`
	PutSessionParamMap    string `xorm:"not null default '' VARCHAR(128)"`
	PutSessionUrlMap      string `xorm:"not null default '' VARCHAR(128)"`
	PutTestInputDoc       string `xorm:"not null default '' VARCHAR(64)"`
	PutTestOutputDoc      string `xorm:"not null default '' VARCHAR(64)"`
	RequestTimeout        int    `xorm:"not null default 0 INT(10)"`
	SandboxLambda         string `xorm:"not null TEXT"`
	SandboxUrl            string `xorm:"not null default '' VARCHAR(128)"`
	Status                int    `xorm:"not null default 0 TINYINT(1)"`
	TestInput             string `xorm:"not null default '' VARCHAR(1024)"`
	TestLambda            string `xorm:"not null TEXT"`
	TestOutput            string `xorm:"not null default '' VARCHAR(1024)"`
	TestUrl               string `xorm:"not null default '' VARCHAR(128)"`
	Timeout               int    `xorm:"not null default 0 INT(10)"`
	Token                 string `xorm:"not null default '' VARCHAR(32)"`
	UpdateTime            int    `xorm:"not null default 0 INT(10)"`
	Version               string `xorm:"not null default '' VARCHAR(16)"`
}

type ApiVersionAppendixAudit

type ApiVersionAppendixAudit struct {
	AuditComment string `xorm:"not null default '' VARCHAR(4096)"`
	Auditor      string `xorm:"not null default '' VARCHAR(512)"`
	CreateTime   int    `xorm:"not null default 0 INT(10)"`
	Id           int    `xorm:"not null pk unique INT(10)"`
	IsDeleted    int    `xorm:"not null default 0 TINYINT(8)"`
	UpdateTime   int    `xorm:"not null default 0 INT(10)"`
}

type ApiWhitelist

type ApiWhitelist struct {
	ApiId       int    `xorm:"not null pk unique(api_id) unique(idx_api_whitelist_api_id_developer_id) INT(10)"`
	DeveloperId string `xorm:"not null pk unique(api_id) unique(idx_api_whitelist_api_id_developer_id) CHAR(20)"`
}

type AppCategory

type AppCategory struct {
	Description string `xorm:"not null default '' VARCHAR(64)"`
	Id          int    `xorm:"not null pk autoincr INT(10)"`
	Name        string `xorm:"not null default '' VARCHAR(16)"`
}

type Developer

type Developer struct {
	AccessKey     string `xorm:"not null default '' VARCHAR(32)"`
	DeveloperId   string `xorm:"CHAR(20)"`
	DeveloperName string `xorm:"VARCHAR(64)"`
	DeveloperType string `xorm:"CHAR(8)"`
	Id            int    `xorm:"not null pk autoincr INT(12)"`
}

func GetDeveloperByDeveloperId

func GetDeveloperByDeveloperId(developerId string) (*Developer, error)

func ListDevelopers

func ListDevelopers(opt ListDevelopersOption) ([]*Developer, error)

type Engine

type Engine interface {
	Table(tableNameOrBean interface{}) *xorm.Session
	Count(...interface{}) (int64, error)
	Decr(column string, arg ...interface{}) *xorm.Session
	Delete(interface{}) (int64, error)
	Exec(...interface{}) (sql.Result, error)
	Find(interface{}, ...interface{}) error
	Get(interface{}) (bool, error)
	ID(interface{}) *xorm.Session
	In(string, ...interface{}) *xorm.Session
	Incr(column string, arg ...interface{}) *xorm.Session
	Insert(...interface{}) (int64, error)
	InsertOne(interface{}) (int64, error)
	Iterate(interface{}, xorm.IterFunc) error
	Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *xorm.Session
	SQL(interface{}, ...interface{}) *xorm.Session
	Where(interface{}, ...interface{}) *xorm.Session
	Asc(colNames ...string) *xorm.Session
}

Engine represents a XORM engine or session.

type ErrNotExist

type ErrNotExist struct {
	Key interface{}
}

ErrNotExist represents a "ErrNotExist" kind of error.

func (ErrNotExist) Error

func (err ErrNotExist) Error() string

type GwConf

type GwConf struct {
	Description string `xorm:"not null default '' VARCHAR(128)"`
	Id          int    `xorm:"not null pk autoincr INT(10)"`
	Name        string `xorm:"not null default '' VARCHAR(16)"`
	Value       string `xorm:"not null default '' VARCHAR(32)"`
	// contains filtered or unexported fields
}

type InnerApp

type InnerApp struct {
	Id            int    `xorm:"not null pk autoincr INT(10)"`
	Name          string `xorm:"not null default '' VARCHAR(16)"`
	PreKey        string `xorm:"not null default '' VARCHAR(32)"`
	PreSecret     string `xorm:"not null default '' VARCHAR(32)"`
	ProductKey    string `xorm:"not null default '' VARCHAR(32)"`
	ProductSecret string `xorm:"not null default '' VARCHAR(32)"`
	SandboxKey    string `xorm:"not null default '' VARCHAR(32)"`
	SandboxSecret string `xorm:"not null default '' VARCHAR(32)"`
	TestKey       string `xorm:"not null default '' VARCHAR(32)"`
	TestSecret    string `xorm:"not null default '' VARCHAR(32)"`
}

type InnerUser

type InnerUser struct {
	Id   int    `xorm:"not null pk autoincr INT(10)"`
	Name string `xorm:"not null default '' VARCHAR(32)"`
}

type ListAdminsOption

type ListAdminsOption struct {
	// contains filtered or unexported fields
}

func (ListAdminsOption) WithDeveloperId

func (opt ListAdminsOption) WithDeveloperId(developerId int) ListAdminsOption

func (ListAdminsOption) WithUserId

func (opt ListAdminsOption) WithUserId(userId int) ListAdminsOption

type ListDevelopersOption

type ListDevelopersOption struct{}

type ListUserBasicInfosOption

type ListUserBasicInfosOption struct{}

type ListUsersOption

type ListUsersOption struct {
	// contains filtered or unexported fields
}

func (ListUsersOption) WithDeveloperId

func (opt ListUsersOption) WithDeveloperId(developerId string) ListUsersOption

func (ListUsersOption) WithRtx

func (opt ListUsersOption) WithRtx(rtx string) ListUsersOption

type User

type User struct {
	Deleted       int       `xorm:"not null default 0 TINYINT(8)" json:"-"`
	DeveloperId   string    `xorm:"CHAR(20)" json:"developer_id"`
	LastLoginTime time.Time `xorm:"DATETIME" json:"-"`
	Rtx           string    `xorm:"unique CHAR(32)" json:"rtx"`
	UserId        int       `xorm:"not null pk autoincr INT(20)" json:"user_id"`

	Developer     *Developer     `xorm:"-" json:"-"`
	UserBasicInfo *UserBasicInfo `xorm:"-" json:"-"`
}

func GetUserByRtx

func GetUserByRtx(rtx string) (*User, error)

func GetUserByUserId

func GetUserByUserId(UserId int) (*User, error)

func ListUsers

func ListUsers(opt ListUsersOption) ([]*User, error)

func (*User) LoadDeveloper

func (u *User) LoadDeveloper() error

func (*User) LoadUserBasicInfo

func (u *User) LoadUserBasicInfo() error

type UserBasicInfo

type UserBasicInfo struct {
	CreateTime  int    `xorm:"not null default 0 INT(10)"`
	Description string `xorm:"not null default '' VARCHAR(1024)"`
	DeveloperId string `xorm:"not null default '' unique(idx_user_list_username_developer_id) CHAR(20)"`
	Email       string `xorm:"not null default '' VARCHAR(32)"`
	Fullname    string `xorm:"not null default '' VARCHAR(32)"`
	IsDeleted   int    `xorm:"not null default 0 TINYINT(8)"`
	Mobilephone string `xorm:"not null default '' VARCHAR(32)"`
	Password    string `xorm:"not null default '' VARCHAR(32)"`
	Username    string `xorm:"not null pk default '' unique unique(idx_user_list_username_developer_id) CHAR(32)"`

	User      *User
	Developer *Developer `xorm:"-"`
}

func GetUserBasicInfoByDeveloperId

func GetUserBasicInfoByDeveloperId(developerId string) (*UserBasicInfo, error)

func GetUserBasicInfoByUsername

func GetUserBasicInfoByUsername(username string) (*UserBasicInfo, error)

func ListUserBasicInfos

func ListUserBasicInfos(opt ListUserBasicInfosOption) ([]*UserBasicInfo, error)

func (*UserBasicInfo) LoadDeveloper

func (ubi *UserBasicInfo) LoadDeveloper() error

func (*UserBasicInfo) LoadUser

func (ubi *UserBasicInfo) LoadUser() error

Jump to

Keyboard shortcuts

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