types

package
v2.1.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2016 License: AGPL-3.0, AGPL-3.0-or-later Imports: 0 Imported by: 0

Documentation

Overview

Package types contains common shared types used throughout the project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board struct {
	Ctr     int64    `json:"ctr"`
	Threads []Thread `json:"threads"`
}

Board stores board metadata and the OPs of all threads

type Command

type Command struct {
	Type CommandType `json:"type" gorethink:"type"`
	Vals []int16     `json:"vals" gorethink:"vals"`
}

Command contains the type and value array of hash commands, such as dice rolls, #flip, #8ball, etc.

type CommandType

type CommandType uint8

CommandType are the various struct types of hash commands and their responses, such as dice rolls, #flip, #8ball, etc.

const (
	// Dice is the dice roll command type
	Dice CommandType = iota
	// Flip is the coinflip command type
	Flip
	// EightBall is the the #8ball random answer dispenser command type
	EightBall
	// SyncWatch is the syncronised timer command type for syncronising episode
	// time during group anime watching and such
	SyncWatch
	// Pyu - don't ask
	Pyu
)

type DatabaseThread

type DatabaseThread struct {
	PostCtr   int16           `gorethink:"postCtr"`
	ImageCtr  int16           `gorethink:"imageCtr"`
	ID        int64           `gorethink:"id"`
	BumpTime  int64           `gorethink:"bumpTime"`
	ReplyTime int64           `gorethink:"replyTime"`
	Subject   string          `gorethink:"subject,omitempty"`
	Board     string          `gorethink:"board"`
	Posts     map[string]Post `gorethink:"posts"`
	Log       [][]byte        `gorethink:"log"`
}

DatabaseThread is a template for wririting new threads to the database

type Image

type Image struct {
	Spoiler bool `json:"spoiler,omitempty" gorethink:"spoiler,omitempty"`
	ImageCommon
	Imgnm string `json:"imgnm" gorethink:"imgnm"`
}

Image contains a post's image and thumbnail data

type ImageCommon

type ImageCommon struct {
	APNG     bool      `json:"apng,omitempty" gorethink:"apng,omitempty"`
	Audio    bool      `json:"audio,omitempty" gorethink:"audio,omitempty"`
	FileType uint8     `json:"fileType" gorethink:"fileType"`
	Length   int32     `json:"length,omitempty" gorethink:"length,omitempty"`
	Dims     [4]uint16 `json:"dims" gorethink:"dims"`
	Size     int       `json:"size" gorethink:"size"`
	MD5      string
	SHA1     string
}

ImageCommon contains the common fields of both Image and ProtoImage structs

type Link struct {
	Board string `json:"board" gorethink:"board"`
	OP    int    `json:"op" gorethink:"op"`
}

Link stores the target post's parent board and parent thread

type LinkMap

type LinkMap map[string]Link

LinkMap contains a map of post numbers, this tread is linking, to corresponding Link structs

type Post

type Post struct {
	Editing   bool      `json:"editing" gorethink:"editing"`
	OP        int64     `json:"op,omitempty" gorethink:"op"`
	ID        int64     `json:"id" gorethink:"id"`
	Time      int64     `json:"time" gorethink:"time"`
	Board     string    `json:"board" gorethink:"board"`
	IP        string    `json:"-" gorethink:"ip"`
	Nonce     string    `json:"-" gorethink:"nonce"`
	Body      string    `json:"body" gorethink:"body"`
	Name      string    `json:"name,omitempty" gorethink:"name,omitempty"`
	Trip      string    `json:"trip,omitempty" gorethink:"trip,omitempty"`
	Auth      string    `json:"auth,omitempty" gorethink:"auth,omitempty"`
	Email     string    `json:"email,omitempty" gorethink:"email,omitempty"`
	Image     *Image    `json:"image,omitempty" gorethink:"image,omitempty"`
	Backlinks LinkMap   `json:"backlinks,omitempty" gorethink:"backlinks,omitempty"`
	Links     LinkMap   `json:"links,omitempty" gorethink:"links,omitempty"`
	Commands  []Command `json:"commands,omitempty" gorethink:"commands,omitempty"`
}

Post is a generic post. Either OP or reply.

type ProtoImage

type ProtoImage struct {
	ImageCommon
	Posts int64 `gorethink:"posts"`
}

ProtoImage stores image data related to the source and thumbnail resources themselves. This struct is partially coppied into the image struct on image allocattion.

type Thread

type Thread struct {
	Locked   bool  `json:"locked,omitempty" gorethink:"locked"`
	Archived bool  `json:"archived,omitempty" gorethink:"archived"`
	Sticky   bool  `json:"sticky,omitempty" gorethink:"sticky"`
	PostCtr  int16 `json:"postCtr" gorethink:"postCtr"`
	ImageCtr int16 `json:"imageCtr" gorethink:"imageCtr"`
	Post
	LogCtr    int64           `json:"logCtr" gorethink:"logCtr"`
	BumpTime  int64           `json:"bumpTime" gorethink:"bumpTime"`
	ReplyTime int64           `json:"replyTime" gorethink:"replyTime"`
	Subject   string          `json:"subject,omitempty" gorethink:"subject"`
	Posts     map[string]Post `json:"posts,omitempty" gorethink:"posts"`
}

Thread is a transport/export wrapper that stores both the thread metada, its opening post data and its contained posts. The composite type itself is not stored in the database.

Jump to

Keyboard shortcuts

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