models

package
v0.0.0-...-e5063d6 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const XORM_LOG_PATH = "./data/log/xorm.log"

Variables

This section is empty.

Functions

func AddBlog

func AddBlog(pid int64, title string, remark string) error

func AddIdeal

func AddIdeal(title string, remark string) error

func AddImage

func AddImage(name string, uri string, filepath string, filetype string, filename string, filesize int64) (int64, error)

func DeleteActicleById

func DeleteActicleById(id int64) (int64, error)

func DeleteCategoryById

func DeleteCategoryById(id int64) (int64, error)

func DeleteImageById

func DeleteImageById(id int64) (int64, error)

func DeleteNavById

func DeleteNavById(id int64) (int64, error)

func DeleteNavByPid

func DeleteNavByPid(pid int64) (int64, error)

func FmtUrl

func FmtUrl(url string) string

func GetAllArticleCount

func GetAllArticleCount() (int64, error)

GetAllArticleCount 得到总数量

func GetAllArticleOrerByID

func GetAllArticleOrerByID() *[]Article

func GetAllArticlePage

func GetAllArticlePage(page int, pagecnt int) *[]Article

GetAllArticlePage 得到当前页面的文章

func GetAllBlog

func GetAllBlog() *[]Blog

func GetAllIdeal

func GetAllIdeal() *[]Ideal

func GetAllNavCount

func GetAllNavCount() (int64, error)

func GetArticleByCateId

func GetArticleByCateId(cateid int64) *[]Article

GetArticleByCateId 得到该类别下当前页面的文章

func GetArticleCountByCateId

func GetArticleCountByCateId(cateid int64) (int64, error)

GetArticleCountByCateId 得到该类别下的文章总数量

func GetArticlePageByCateId

func GetArticlePageByCateId(cateid int64, page int, pagecnt int) *[]Article

GetArticlePageByCateId 得到该类别下当前页面的文章

func GetNavCountByPid

func GetNavCountByPid(id int64) (int64, error)

func IsErrNavNotExist

func IsErrNavNotExist(err error) bool

func SaveActicle

func SaveActicle(name string, cateid int64, desc string, content string, arttype int8, source string) (int64, error)

func SaveCategory

func SaveCategory(name string, desc string, orderno int64) (int64, error)

func SaveNav

func SaveNav(name string, url string, orderno int64, pid int64) (int64, error)

func UpdateActicle

func UpdateActicle(id int64, cateid int64, name string, desc string, content string, arttype int8, source string) (int64, error)

func UpdateCategory

func UpdateCategory(id int64, name string, desc string, orderno int64) (int64, error)

func UpdateImage

func UpdateImage(id int64, name string, uri string, filepath string, filetype string, filename string, filesize int64) (int64, error)

func UpdateNav

func UpdateNav(id int64, name string, url string, orderno int64, pid int64) (int64, error)

Types

type Article

type Article struct {
	Id       int64         `json:"id"        xorm:"pk autoincr"`
	Name     string        `json:"name"      xorm:"unique index"`
	Desc     string        `json:"desc"`
	CateId   int64         `json:cateid     xorm:"index"`
	CateName string        `json:catename`
	ArtType  int8          ////arttype 1 html ,2 makedown
	Content  template.HTML `json:"content"   xorm:"text"`
	Source   string        `'json:"source"  xorm:"text"`
	Created  time.Time     `json:"create"    xorm:"created"`
	Updated  time.Time     `json:"updated"   xorm:"updated"`
}

func GetArticleById

func GetArticleById(id int64) *Article

type Blog

type Blog struct {
	Id      int64 `xorm:"pk autoincr"`
	Pid     int64
	Title   string
	Remark  string    `xorm:"text"`
	Created time.Time `xorm:"created"`
}

func (*Blog) Save

func (blog *Blog) Save() error

func (*Blog) Update

func (blog *Blog) Update() error

type Category

type Category struct {
	Id      int64     `json:"id"`
	Name    string    `json:"name"      xorm:"unique index"`
	Desc    string    `json:"desc"`
	Orderno int64     `json:"orderno"`
	Created time.Time `json:"create"    xorm:"created"`
	Updated time.Time `json:"updated"   xorm:"updated"`
}

func GetAllCategoryOrderByOrderno

func GetAllCategoryOrderByOrderno() []*Category

func GetCategoryById

func GetCategoryById(id int64) *Category

func (*Category) Save

func (cate *Category) Save() error

type DBinfo

type DBinfo struct {
	DBType string
	Host   string "127.0.0.1"
	Port   string "3306"
	User   string "root"
	Pwd    string "123"
	DBName string "myblog"
	Prefix string ""
}

func (*DBinfo) DBUrl

func (d *DBinfo) DBUrl() string

type ErrNavNotExist

type ErrNavNotExist struct {
	Errstr string
}

func (ErrNavNotExist) Error

func (err ErrNavNotExist) Error() string

type Ideal

type Ideal struct {
	Id      int64 `xorm:"pk autoincr"`
	Title   string
	Remark  string    `xorm:"text"`
	Created time.Time `xorm:"created"`
}

func (*Ideal) Save

func (ideal *Ideal) Save() error

type Image

type Image struct {
	Id       int64     `json:"id"`
	Name     string    `json:"name"    xorm:"unique index"`
	Uri      string    `json:"uri"     xorm:"unique index"`
	FilePath string    `json:"filepath"`
	FileType string    `json:"filetype"`
	FileName string    `json:"filename"`
	FileSize int64     `json:"filesize"`
	Created  time.Time `json:"create"    xorm:"created"`
	Updated  time.Time `json:"updated"   xorm:"updated"`
}

func GetAllImage

func GetAllImage() []*Image

func GetImageById

func GetImageById(id int64) *Image

func GetImageByURI

func GetImageByURI(uri string) *Image
type Nav struct {
	Id      int64     `json:"id"`
	Name    string    `json:"name"      xorm:"index"`
	Url     string    `json:"url"       xorm:"unique index"`
	Icon    string    `json:"icon"`
	Orderno int64     `json:"orderno"`
	Pid     int64     `json:"pid"`
	Issys   bool      `json:"issys"     xorm:"Bool"`
	Status  bool      `json:"status"    xorm:"Bool"`
	Created time.Time `json:"create"    xorm:"created"`
	Updated time.Time `json:"updated"   xorm:"updated"`
	Delete  time.Time `json:"delete"    xorm:"deleted"`
}

func GetAllNavOrderByOrderno

func GetAllNavOrderByOrderno() []*Nav

func GetAllNavOrderByPid

func GetAllNavOrderByPid() []*Nav

静态方法

func GetNavById

func GetNavById(id int64) *Nav

func GetNavByUrl

func GetNavByUrl(url string) (*Nav, error)

func GetPageNavByPid

func GetPageNavByPid(pid int64, pagecnt int, start int) []*Nav

sidebar.Query().Filter("isactive", "Y").Filter("pid", pid).Limit(pagecnt, (page-1)*pagecnt).All(&sidebars)

type User

type User struct {
	Id         int64
	Name       string `xorm:"index unique"`
	Pwd        string
	Email      string    `xorm:"index unique"`
	Nickname   string    `xorm:"index"`
	EditorType int8      //1 cke ; 2 editormd
	Issys      bool      `xorm:"Bool"`
	Status     bool      `xorm:"Bool"`
	Created    time.Time `xorm:"created"`
	Updated    time.Time `xorm:"updated"`
}

func GetUserByNameWithPwd

func GetUserByNameWithPwd(name string, pwd string) *User

Jump to

Keyboard shortcuts

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