models

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllArticles

type AllArticles []ArticleDocument

ArticleDocument for sorting.

func (AllArticles) Len

func (a AllArticles) Len() int

func (AllArticles) Less

func (a AllArticles) Less(i, j int) bool

func (AllArticles) Swap

func (a AllArticles) Swap(i, j int)

type ArticleDocument

type ArticleDocument struct {
	ID           bson.ObjectId `bson:"_id,omitempty"`
	ArticleID    string        `json:"article_id" bson:"article_id"`
	ArticleTitle string        `json:"article_title" bson:"article_title"`
	Author       string        `json:"author" bson:"author"`
	Board        string        `json:"board" bson:"board"`
	Content      string        `json:"content" bson:"content"`
	Date         string        `json:"date" bson:"date"`
	IP           string        `json:"ip" bson:"ip"`
	MessageCount MessageCount  `bson:"message_count"`
	Messages     []interface{} `json:"messages" bson:"messages"`
	Timestamp    int           `json:"timestamp" bson:"timestamp"`
	URL          string        `json:"url" bson:"url"`
	ImageLinks   []string      `json:"image_links" bson:"image_links"`
}

func (*ArticleDocument) GeneralQueryAll

func (d *ArticleDocument) GeneralQueryAll(collection *mgo.Collection, query interface{}, sortBy string, count int) (results []ArticleDocument, err error)

func (*ArticleDocument) GeneralQueryOne

func (d *ArticleDocument) GeneralQueryOne(collection *mgo.Collection, query interface{}) (result *ArticleDocument, err error)

func (*ArticleDocument) ToString

func (d *ArticleDocument) ToString() (info string)

type MessageCount

type MessageCount struct {
	All     int `json:"all" bson:"all"`
	Boo     int `json:"boo" bson:"boo"`
	Count   int `json:"count" bson:"count"`
	Neutral int `json:"neutral" bson:"neutral"`
	Push    int `json:"push" bson:"push"`
}

type Model

type Model struct {
	Db  *pg.DB
	Log *log.Logger
}

Jump to

Keyboard shortcuts

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