model

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	// Stored and generated
	ID        string `gorm:"primary_key"`
	CreatedAt time.Time

	// Stored and given by user
	DisplayedName   string `form:"title" json:"title"`           // Name Chosen by author, no restriction but < 50 char
	AuthorBase64    string `form:"public-key" json:"public-key"` // Encoded in URL-safe Base64
	Content         string `form:"message" json:"message"`
	SignatureBase64 string `form:"signature" json:"signature"` // Encoded in URL-safe Base64
	MessageID       string `form:"answer-to" json:"answer-to"` // Used if the message is a comment to a publication

	// Only for display on client, computed from known values
	Correct        bool   `json:"-" gorm:"-"`
	ColorPrimary   string `json:"-" gorm:"-"`
	ColorSecondary string `json:"-" gorm:"-"`
	DisplayedDate  string `json:"-" gorm:"-"`
	Pod            string `gorm:"-"` // Not saved in db but tell where it is sent from so remains in JSON
}

func SortByDate

func SortByDate(messages []Message) []Message

func (*Message) Normalize added in v0.9.3

func (message *Message) Normalize() error

Normalizes, escapes and verifies constraints

func (Message) Verify added in v0.9.5

func (message Message) Verify() error

Verify that the message is sanitized and has a valid signature

Jump to

Keyboard shortcuts

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