models

package
v0.0.0-...-51db4a5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache cache.Cache

Functions

func GetOptions

func GetOptions() map[string]string

func Init

func Init()

func Md5

func Md5(buf []byte) string

func NewCache

func NewCache() cache.Cache

func Rawurlencode

func Rawurlencode(str string) string

func TableName

func TableName(str string) string

返回带前缀的表名

Types

type LocalCache

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

func (*LocalCache) ClearAll

func (this *LocalCache) ClearAll() error

func (*LocalCache) Decr

func (this *LocalCache) Decr(key string) error

func (*LocalCache) Delete

func (this *LocalCache) Delete(key string) error

func (*LocalCache) Get

func (this *LocalCache) Get(key string) interface{}

func (*LocalCache) Incr

func (this *LocalCache) Incr(key string) error

func (*LocalCache) IsExist

func (this *LocalCache) IsExist(key string) bool

func (*LocalCache) Put

func (this *LocalCache) Put(key string, val interface{}, timeout int64) error

func (*LocalCache) StartAndGC

func (this *LocalCache) StartAndGC(config string) error

type Option

type Option struct {
	Id    int64
	Name  string
	Value string
}

配置项表

func (*Option) Delete

func (m *Option) Delete() error

func (*Option) Insert

func (m *Option) Insert() error

func (*Option) Query

func (m *Option) Query() orm.QuerySeter

func (*Option) Read

func (m *Option) Read(fields ...string) error

func (*Option) TableName

func (m *Option) TableName() string

func (*Option) Update

func (m *Option) Update(fields ...string) error

type Pager

type Pager struct {
	Page     int64
	Totalnum int64
	Pagesize int64
	// contains filtered or unexported fields
}

func NewPager

func NewPager(page, totalnum, pagesize int64, url string, nopath ...bool) *Pager

func (*Pager) ToString

func (this *Pager) ToString() string

type Post

type Post struct {
	Id       int64
	Userid   int64  `orm:"index"`
	Author   string `orm:"size(15)"`
	Title    string `orm:"size(100)"`
	Color    string `orm:"size(7)"`
	Urlname  string `orm:"size(100);index"`
	Urltype  int8
	Content  string    `orm:"type(text)"`
	Tags     string    `orm:"size(100)"`
	Posttime time.Time `orm:"type(datetime);index"`
	Views    int64
	Status   int8
	Updated  time.Time `orm:"type(datetime)"`
	Istop    int8
}

func (*Post) ColorTitle

func (m *Post) ColorTitle() string

带颜色的标题

func (*Post) Delete

func (m *Post) Delete() error

func (*Post) Excerpt

func (m *Post) Excerpt() string

摘要

func (*Post) Insert

func (m *Post) Insert() error
func (m *Post) Link() string

内容URL

func (*Post) Query

func (m *Post) Query() orm.QuerySeter

func (*Post) Read

func (m *Post) Read(fields ...string) error

func (*Post) TableName

func (m *Post) TableName() string
func (m *Post) TagsLink() string

带链接的标签

func (*Post) Update

func (m *Post) Update(fields ...string) error

type Tag

type Tag struct {
	Id    int64
	Name  string `orm:"size(20);index"`
	Count int64
}

标签表

func (*Tag) Delete

func (m *Tag) Delete() error

删除

func (*Tag) Insert

func (m *Tag) Insert() error
func (m *Tag) Link() string

标签连接

func (*Tag) MergeTo

func (m *Tag) MergeTo(to *Tag)

合并到另一个标签

func (*Tag) Query

func (m *Tag) Query() orm.QuerySeter

表查询

func (*Tag) Read

func (m *Tag) Read(fields ...string) error

func (*Tag) TableName

func (m *Tag) TableName() string

func (*Tag) UpCount

func (m *Tag) UpCount()

更新统计

func (*Tag) Update

func (m *Tag) Update(fields ...string) error

type TagPost

type TagPost struct {
	Id         int64
	Tagid      int64 `orm:"index"`
	Postid     int64
	Poststatus int8
	Posttime   time.Time
}

标签内容关系表

func (*TagPost) Delete

func (m *TagPost) Delete() error

func (*TagPost) Insert

func (m *TagPost) Insert() error

func (*TagPost) Query

func (m *TagPost) Query() orm.QuerySeter

func (*TagPost) Read

func (m *TagPost) Read(fields ...string) error

func (*TagPost) TableName

func (m *TagPost) TableName() string

func (*TagPost) Update

func (m *TagPost) Update(fields ...string) error

type User

type User struct {
	Id         int64
	Username   string    `orm:"unique;size(15)"`
	Password   string    `orm:"size(32)"`
	Email      string    `orm:"size(50)"`
	Lastlogin  time.Time `orm:"auto_now_add;type(datetime)"`
	Logincount int64
	Lastip     string `orm:"size(32)"`
	Authkey    string `orm:"size(10)"`
	Active     int8
}

用户表模型

func (*User) Delete

func (m *User) Delete() error

func (*User) Insert

func (m *User) Insert() error

func (*User) Query

func (m *User) Query() orm.QuerySeter

func (*User) Read

func (m *User) Read(fields ...string) error

func (*User) TableName

func (m *User) TableName() string

func (*User) Update

func (m *User) Update(fields ...string) error

Jump to

Keyboard shortcuts

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