test

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlogMgoFieldID          = "_id"
	BlogMgoFieldTitle       = "title"
	BlogMgoFieldHits        = "Hits"
	BlogMgoFieldSlug        = "Slug"
	BlogMgoFieldBody        = "Body"
	BlogMgoFieldCreateDate  = "createDate"
	BlogMgoFieldUser        = "User"
	BlogMgoFieldIsPublished = "IsPublished"
)
View Source
const (
	BlogMgoSortFieldIDAsc          = "_id"
	BlogMgoSortFieldIDDesc         = "-_id"
	BlogMgoSortFieldCreateDateAsc  = "createDate"
	BlogMgoSortFieldCreateDateDesc = "-createDate"
)
View Source
const (
	TimeRangeMgoFieldFrom = "From"
	TimeRangeMgoFieldTo   = "To"
)

Variables

View Source
var BlogMgr *_BlogMgr
View Source
var CategoryMgr *_CategoryMgr
View Source
var ErrOperaBeforeInit = errors.New("please set db.SetOnFinishInit when needed operating db in init()")
View Source
var TimeRangeMgr *_TimeRangeMgr

Functions

func BlogAddInsertCallback

func BlogAddInsertCallback(cb func(obj EzOrmObj))

func BlogAddUpdateCallback

func BlogAddUpdateCallback(cb func(obj EzOrmObj))

func BlogInsertCallback

func BlogInsertCallback(o *Blog)

func BlogUpdateCallback

func BlogUpdateCallback(o *Blog)

func Col

func Col(col string) (*mgo.Session, *mgo.Collection)

func DbName

func DbName() string

func EnsureIndex

func EnsureIndex()

func Get_BlogMgr

func Get_BlogMgr() *_BlogMgr

Get_BlogMgr returns the orm manager in case of its name starts with lower letter

func Get_CategoryMgr

func Get_CategoryMgr() *_CategoryMgr

Get_CategoryMgr returns the orm manager in case of its name starts with lower letter

func Get_TimeRangeMgr

func Get_TimeRangeMgr() *_TimeRangeMgr

Get_TimeRangeMgr returns the orm manager in case of its name starts with lower letter

func MgoSetup

func MgoSetup(config *db.MongoConfig)

Types

type Blog

type Blog struct {
	ID bson.ObjectId `json:"id" bson:"_id,omitempty"`

	// the title of blog
	Title string `bson:"title" json:"title"`

	// 提示
	Hits        int32     `bson:"Hits" json:"Hits"`
	Slug        string    `bson:"Slug" json:"Slug"`
	Body        string    `bson:"Body" json:"Body"`
	CreateDate  time.Time `bson:"createDate" json:"createDate"`
	User        int32     `bson:"User" json:"User"`
	IsPublished bool      `bson:"IsPublished" json:"IsPublished"`
	// contains filtered or unexported fields
}

Blog blog

func (*Blog) GetClassName

func (p *Blog) GetClassName() string

func (*Blog) GetNameSpace

func (p *Blog) GetNameSpace() string

func (*Blog) Id

func (o *Blog) Id() string

func (*Blog) InsertUnique

func (o *Blog) InsertUnique(query interface{}) (saved bool, err error)

func (*Blog) IsSearchEnabled

func (o *Blog) IsSearchEnabled() bool

func (*Blog) Save

func (o *Blog) Save() (info *mgo.ChangeInfo, err error)

type Category

type Category struct {
	Cid  int64  `bson:"Cid" json:"Cid"`
	Name string `bson:"Name" json:"Name"`
}

func (*Category) GetClassName

func (p *Category) GetClassName() string

func (*Category) GetNameSpace

func (p *Category) GetNameSpace() string

type TimeRange

type TimeRange struct {
	From []int64 `bson:"From" json:"From"`
	To   []int64 `bson:"To" json:"To"`
}

func (*TimeRange) GetClassName

func (p *TimeRange) GetClassName() string

func (*TimeRange) GetNameSpace

func (p *TimeRange) GetNameSpace() string

Jump to

Keyboard shortcuts

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