model

package
v0.0.0-...-a5c93de Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WeiboPageSize   int = 15
	ArticlePageSize int = 5
)

*

  • 定义常量

Variables

View Source
var DB *gorm.DB
View Source
var Redis redis.Conn

Functions

func InitDB

func InitDB() (*gorm.DB, error)

*

  • 初始化连接数据库

func InitRedis

func InitRedis() (redis.Conn, error)

*

  • 初始化连接redis

Types

type ArticleDetail

type ArticleDetail struct {
	Title      string
	Content    string
	Time       time.Time
	IsMarkdown string
}

func GetArticleDetail

func GetArticleDetail(id string) (data *ArticleDetail, err error)

type ArticleList

type ArticleList struct {
	Total   int        `json:"total"`    // 文章总数
	PerPage int        `json:"per_page"` // 下一页页码
	List    []*TpMovie `json:"list"`     // 文章列表
}

func GetArticleList

func GetArticleList(page string, count int) (list *ArticleList, err error)

type ImgConList

type ImgConList struct {
	Content string
	ImgList []*TpImages
}

func GetImgConList

func GetImgConList(t int) (list *ImgConList, err error)

type ShanList

type ShanList struct {
	Content string `json:"content"`
	PicUrl  string `json:"pic_url"`
}

func GetShanList

func GetShanList() (list []*ShanList, err error)

type TpImages

type TpImages struct {
	Id       int    `gorm:"type:int(11);AUTO_INCREMENT" json:"id"`   // id
	PicUrl   string `gorm:"type:varchar(255)" json:"pic_url"`        // 图片地址
	TargetId int    `gorm:"type:int(11);default:0" json:"target_id"` // 目标id
	Target   int    `gorm:"type:tinyint(3);default:0" json:"target"` // 目标类型,0摄影,1相册
}

func GetImgList

func GetImgList() (list []*TpImages, err error)

type TpMovie

type TpMovie struct {
	Id         int       `gorm:"type:mediumint(7);AUTO_INCREMENT" json:"id"`   // 文章id
	Title      string    `gorm:"type:varchar(50);not null" json:"title"`       // 标题
	Cover      string    `gorm:"type:varchar(255);not null" json:"cover"`      // 封面图
	Content    string    `gorm:"type:text;not null" json:"content"`            // 内容
	Time       time.Time `gorm:"type:date;not null" json:"time"`               // 创建日期
	IsMarkdown string    `gorm:"type:varchar(10);not null" json:"is_markdown"` // 是否markdown格式
}

type TpPhoto

type TpPhoto struct {
	Id      int    `gorm:"type:int(11);AUTO_INCREMENT" json:"id"` // 作品集.摄影 id
	Content string `gorm:"type:text" json:"content"`              // 内容描述
	Type    int    `gorm:"type:tinyint(3);default:0" json:"type"` // 类型,0山,1人,2仙
}

type TpWeibo

type TpWeibo struct {
	Id      int    `gorm:"type:int(6);AUTO_INCREMENT" json:"id"`  // 微博id
	Name    string `gorm:"type:varchar(50);not null" json:"name"` // 短语
	Content string `gorm:"type:text;not null" json:"content"`     // 长语
	Link    string `gorm:"type:varchar(255)" json:"link"`         // 外链
}

type WeiboList

type WeiboList struct {
	Total   int        `json:"total"`    // 微博总数
	PerPage int        `json:"per_page"` // 下一页页码
	List    []*TpWeibo `json:"list"`     // 微博列表
}

func GetWeiboList

func GetWeiboList(page string, count int) (list *WeiboList, err error)

*

  • 获取微博列表

Jump to

Keyboard shortcuts

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