modeltest

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package modeltest 为 model 提供一些测试实例

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	UID     int64 `orm:"name(uid);pk"`
	Account int64 `orm:"name(account)"`
	Version int64 `orm:"name(version);occ(true);default(1)"`
}

Account 带一个 OCC 字段

func (*Account) Meta

func (m *Account) Meta() string

Meta 指定表属性

type Admin

type Admin struct {
	User

	Email string `orm:"name(email);len(20);unique(unique_email)"`
	Group int64  `orm:"name(group);fk(fk_name,#groups,id,NO ACTION)"`
}

Admin 带自增和两个唯一约束

func (*Admin) Meta

func (m *Admin) Meta() string

Meta 指定表属性

type Group

type Group struct {
	ID      int64  `orm:"name(id);ai"`
	Name    string `orm:"name(name);len(500)"`
	Created int64  `orm:"name(created)"`
}

Group 带有自增 ID 的普通表结构

func (*Group) Meta

func (g *Group) Meta() string

Meta 指定表属性

type User

type User struct {
	ID       int    `orm:"name(id);ai;"`
	Username string `orm:"unique(unique_username);index(index_name);len(50)"`
	Password string `orm:"name(password);len(20)"`
	Regdate  int    `orm:"-"`
}

User 带自增和一个唯一约束

func (*User) Meta

func (m *User) Meta() string

Meta 指定表属性

type UserInfo

type UserInfo struct {
	UID       int    `orm:"name(uid);pk"`
	FirstName string `orm:"name(firstName);unique(unique_name);len(20)"`
	LastName  string `orm:"name(lastName);unique(unique_name);len(20)"`
	Sex       string `orm:"name(sex);default(male);len(6)"`
}

UserInfo 带主键和唯一约束(两个字段组成)

func (*UserInfo) Meta

func (m *UserInfo) Meta() string

Meta 指定表属性

Jump to

Keyboard shortcuts

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