types

package
v0.0.0-...-c37b867 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: GPL-2.0, GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerTemplate

type ControllerTemplate interface {
	Init() error
	SelectPosts() ([]Post, error)
	SelectPostReactions(postId int) ([]Reaction, error)
	SelectLatestTimestamp() (time.Time, error)
	SelectCandidateHashes() ([5]string, error)
	SelectPostReactionHashes(postId int) ([5]string, error)
	SelectDescriptors(postId int) (string, error)
	SelectAnonReactionCount(postId int) (int, error)
	InsertPost(post Post) error
	InsertReaction(reaction Reaction) error
	InsertHash(hash string) error
	Clear() bool
}

A template for an object that performs database interactions

type HtmlPostContainer

type HtmlPostContainer struct {
	HtmlPosts []PostHtmlContent
}

Contains above data needed for HTML content structure

type HtmlReactionContainer

type HtmlReactionContainer struct {
	Descriptors []string
}

Contains above data needed for HTML content structure

type Post

type Post struct {
	Id          int        `json:"id"`
	Title       string     `json:"title"`
	Author      string     `json:"author"`
	Contents    string     `json:"contents"`
	Tag         int        `json:"tag"`
	Descriptors string     `json:"descriptors"`
	Time        time.Time  `json:"time"`
	Hash        string     `json:"hash,omitempty"`
	Reactions   []Reaction `json:"reactions,omitempty"`
}

Represents a post convertible to pretty JSON

type PostHtmlContent

type PostHtmlContent struct {
	Colour      string
	Timestring  string
	IsSuccessor bool
	Id          int
	Title       string
	Contents    string
	Author      string
	Reactions   []Reaction
}

Represents the HTML data of a post on the UI

type Reaction

type Reaction struct {
	Id           int    `json:"id,omitempty"`
	PostId       int    `json:"postId,omitempty"`
	Descriptor   string `json:"descriptor"`
	Gravitas     int    `json:"gravitas"`
	GravitasHash string `json:"hash,omitempty"`
	Colour       string
	ColourDark   string
}

Represents a reaction in JSON

Jump to

Keyboard shortcuts

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