models

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package models provides models for controllers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory struct {
	ID     uint       `json:"id"`
	Title  string     `json:"title"`
	Closed bool       `json:"closed"`
	Sticky bool       `json:"sticky"`
	Posts  uint       `json:"postcount"`
	Pages  uint       `json:"pages"`
	Last   *time.Time `json:"last_post"`
	Images uint       `json:"images"`
}

Directory holds the thread entries for the directory page

type DirectoryModel

type DirectoryModel struct {
	Ib     uint
	Page   uint
	Result DirectoryType
}

DirectoryModel holds the parameters from the request and also the key for the cache

func (*DirectoryModel) Get

func (i *DirectoryModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type DirectoryType

type DirectoryType struct {
	Body u.PagedResponse `json:"directory"`
}

DirectoryType is the top level of the JSON response

type FavoriteModel

type FavoriteModel struct {
	User   uint
	ID     uint
	Result FavoriteType
}

FavoriteModel holds the parameters from the request and also the key for the cache

func (*FavoriteModel) Get

func (i *FavoriteModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type FavoriteType

type FavoriteType struct {
	Starred bool `json:"starred"`
}

FavoriteType is the top level of the JSON response

type FavoritedModel

type FavoritedModel struct {
	Ib     uint
	Result FavoritedType
}

FavoritedModel holds the parameters from the request and also the key for the cache

func (*FavoritedModel) Get

func (i *FavoritedModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type FavoritedType

type FavoritedType struct {
	Body []OnlyImage `json:"favorited,omitempty"`
}

FavoritedType is the top level of the JSON response

type FavoritesHeader

type FavoritesHeader struct {
	Images []OnlyImage `json:"images,omitempty"`
}

FavoritesHeader is the header for favorites page

type FavoritesModel

type FavoritesModel struct {
	User   uint
	Ib     uint
	Page   uint
	Result FavoritesType
}

FavoritesModel holds the parameters from the request and also the key for the cache

func (*FavoritesModel) Get

func (i *FavoritesModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type FavoritesType

type FavoritesType struct {
	Body u.PagedResponse `json:"favorites"`
}

FavoritesType is the top level of the JSON response

type ImageHeader

type ImageHeader struct {
	ID      uint        `json:"id"`
	Thread  uint        `json:"thread"`
	PostNum uint        `json:"post_num"`
	PostID  uint        `json:"post_id"`
	Prev    *uint       `json:"prev,omitempty"`
	Next    *uint       `json:"next,omitempty"`
	Width   uint        `json:"width"`
	Height  uint        `json:"height"`
	File    string      `json:"filename"`
	Tags    []ImageTags `json:"tags,omitempty"`
}

ImageHeader is the header for image page

type ImageModel

type ImageModel struct {
	Ib     uint
	ID     uint
	Result ImageType
}

ImageModel holds the parameters from the request and also the key for the cache

func (*ImageModel) Get

func (i *ImageModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type ImageTags

type ImageTags struct {
	ID   uint   `json:"id"`
	Tag  string `json:"tag"`
	Type string `json:"type"`
}

ImageTags holds the tags for an image

type ImageType

type ImageType struct {
	Body ImageHeader `json:"image"`
}

ImageType is the top level of the JSON response

type Imageboard

type Imageboard struct {
	ID          uint   `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Domain      string `json:"url"`
	Threads     uint   `json:"threads"`
	Posts       uint   `json:"posts"`
	Images      uint   `json:"images"`
}

Imageboard has information and statistics about the boards on a pram

type ImageboardsModel

type ImageboardsModel struct {
	Result ImageboardsType
}

ImageboardsModel holds the parameters from the request and also the key for the cache

func (*ImageboardsModel) Get

func (i *ImageboardsModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type ImageboardsType

type ImageboardsType struct {
	Body []Imageboard `json:"imageboards"`
}

ImageboardsType is the top level of the JSON response

type IndexModel

type IndexModel struct {
	Ib      uint
	Page    uint
	Threads uint
	Posts   uint
	Result  IndexType
}

IndexModel holds the parameters from the request and also the key for the cache

func (*IndexModel) Get

func (i *IndexModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type IndexThreadHeader

type IndexThreadHeader struct {
	ID     uint          `json:"id"`
	Title  string        `json:"title"`
	Closed bool          `json:"closed"`
	Sticky bool          `json:"sticky"`
	Total  uint          `json:"total"`
	Images uint          `json:"images"`
	Pages  uint          `json:"pages"`
	Posts  []ThreadPosts `json:"posts"`
}

IndexThreadHeader holds the information for the threads

type IndexType

type IndexType struct {
	Body u.PagedResponse `json:"index"`
}

IndexType is the top level of the JSON response

type NewModel

type NewModel struct {
	Ib     uint
	Result NewType
}

NewModel holds the parameters from the request and also the key for the cache

func (*NewModel) Get

func (i *NewModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type NewType

type NewType struct {
	Body []OnlyImage `json:"new,omitempty"`
}

NewType is the top level of the JSON response

type OnlyImage

type OnlyImage struct {
	ID          uint    `json:"id"`
	File        *string `json:"filename"`
	Thumb       *string `json:"thumbnail"`
	ThumbHeight *uint   `json:"tn_height"`
	ThumbWidth  *uint   `json:"tn_width"`
}

OnlyImage struct for tag page

type PopularModel

type PopularModel struct {
	Ib     uint
	Result PopularType
}

PopularModel holds the parameters from the request and also the key for the cache

func (*PopularModel) Get

func (i *PopularModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type PopularType

type PopularType struct {
	Body []OnlyImage `json:"popular,omitempty"`
}

PopularType is the top level of the JSON response

type Post

type Post struct {
	ThreadID    uint       `json:"thread_id"`
	PostID      uint       `json:"post_id"`
	Num         uint       `json:"num"`
	Name        string     `json:"name"`
	UID         uint       `json:"uid"`
	Group       uint       `json:"group"`
	Time        *time.Time `json:"time"`
	Text        *string    `json:"comment"`
	ImageID     *uint      `json:"img_id,omitempty"`
	File        *string    `json:"filename,omitempty"`
	Thumb       *string    `json:"thumbnail,omitempty"`
	ThumbHeight *uint      `json:"tn_height,omitempty"`
	ThumbWidth  *uint      `json:"tn_width,omitempty"`
}

Post holds the post information

type PostModel

type PostModel struct {
	Ib     uint
	Thread uint
	ID     uint
	Result PostType
}

PostModel holds the parameters from the request and also the key for the cache

func (*PostModel) Get

func (i *PostModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type PostType

type PostType struct {
	Body Post `json:"post"`
}

PostType is the top level of the JSON response

type RandomModel added in v1.3.0

type RandomModel struct {
	Ib     uint
	Result ImageType
}

RandomModel holds the parameters from the request and also the key for the cache

func (*RandomModel) Get added in v1.3.0

func (i *RandomModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type TagHeader

type TagHeader struct {
	ID     uint        `json:"id"`
	Tag    *string     `json:"tag"`
	Type   *uint       `json:"type"`
	Images []OnlyImage `json:"images,omitempty"`
}

TagHeader is the header for the tag page

type TagModel

type TagModel struct {
	Ib     uint
	Tag    uint
	Page   uint
	Result TagType
}

TagModel holds the parameters from the request and also the key for the cache

func (*TagModel) Get

func (i *TagModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type TagSearchModel

type TagSearchModel struct {
	Ib     uint
	Term   string
	Result TagSearchType
}

TagSearchModel holds the parameters from the request and also the key for the cache

func (*TagSearchModel) Get

func (i *TagSearchModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type TagSearchType

type TagSearchType struct {
	Body []Tags `json:"tagsearch"`
}

TagSearchType is the top level of the JSON response

type TagType

type TagType struct {
	Body u.PagedResponse `json:"tag"`
}

TagType is the top level of the JSON response

type TagTypes

type TagTypes struct {
	ID   uint   `json:"id"`
	Type string `json:"type"`
}

TagTypes truct

type TagTypesModel

type TagTypesModel struct {
	Result TagTypesType
}

TagTypesModel holds the parameters from the request and also the key for the cache

func (*TagTypesModel) Get

func (i *TagTypesModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type TagTypesType

type TagTypesType struct {
	Body []TagTypes `json:"tagtypes"`
}

TagTypesType is the top level of the JSON response

type Tags

type Tags struct {
	ID    uint   `json:"id"`
	Tag   string `json:"tag"`
	Total uint   `json:"total"`
	Type  uint   `json:"type"`
}

Tags struct

type TagsModel

type TagsModel struct {
	Ib     uint
	Page   uint
	Result TagsType
}

TagsModel holds the parameters from the request and also the key for the cache

func (*TagsModel) Get

func (i *TagsModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type TagsType

type TagsType struct {
	Body u.PagedResponse `json:"tags"`
}

TagsType is the top level of the JSON response

type ThreadIds

type ThreadIds struct {
	ID     uint
	Title  string
	Closed bool
	Sticky bool
	Total  uint
	Images uint
}

ThreadIds holds all the thread ids for the loop that gets the posts

type ThreadInfo

type ThreadInfo struct {
	ID     uint          `json:"id"`
	Title  string        `json:"title"`
	Closed bool          `json:"closed"`
	Sticky bool          `json:"sticky"`
	Posts  []ThreadPosts `json:"posts"`
}

ThreadInfo header for thread view

type ThreadModel

type ThreadModel struct {
	Ib     uint
	Thread uint
	Page   uint
	Posts  uint
	Result ThreadType
}

ThreadModel holds the parameters from the request and also the key for the cache

func (*ThreadModel) Get

func (i *ThreadModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type ThreadPosts

type ThreadPosts struct {
	ID          uint       `json:"id"`
	Num         uint       `json:"num"`
	Name        string     `json:"name"`
	UID         uint       `json:"uid"`
	Group       uint       `json:"group"`
	Time        *time.Time `json:"time"`
	Text        *string    `json:"comment"`
	ImageID     *uint      `json:"img_id,omitempty"`
	File        *string    `json:"filename,omitempty"`
	Thumb       *string    `json:"thumbnail,omitempty"`
	ThumbHeight *uint      `json:"tn_height,omitempty"`
	ThumbWidth  *uint      `json:"tn_width,omitempty"`
}

ThreadPosts holds the posts for a thread

type ThreadSearchModel

type ThreadSearchModel struct {
	Ib     uint
	Term   string
	Result ThreadSearchType
}

ThreadSearchModel holds the parameters from the request and also the key for the cache

func (*ThreadSearchModel) Get

func (i *ThreadSearchModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

type ThreadSearchType

type ThreadSearchType struct {
	Body []Directory `json:"threadsearch"`
}

ThreadSearchType is the top level of the JSON response

type ThreadType

type ThreadType struct {
	Body u.PagedResponse `json:"thread"`
}

ThreadType is the top level of the JSON response

type UserInfo

type UserInfo struct {
	ID            uint      `json:"id"`
	Name          string    `json:"name"`
	Group         uint      `json:"group"`
	Authenticated bool      `json:"authenticated"`
	Email         *string   `json:"email,omitempty"`
	LastActive    time.Time `json:"last_active,omitempty"`
}

UserInfo holds all the user metadata

type UserType

type UserType struct {
	Body UserInfo `json:"user"`
}

UserType is the top level of the JSON response

type WhoAmIModel added in v1.2.0

type WhoAmIModel struct {
	User   user.User
	Ib     uint
	Result UserType
}

WhoAmIModel holds the parameters from the request and also the key for the cache

func (*WhoAmIModel) Get added in v1.2.0

func (i *WhoAmIModel) Get() (err error)

Get will gather the information from the database and return it as JSON serialized data

Jump to

Keyboard shortcuts

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