db

package
v0.0.0-...-4eddeae Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//modeAccepted means The comment was accepted by the server and is published.
	// 001
	ModeAccepted = 1
	//modeModeration means: The comment was accepted by the server but awaits moderation.
	// 010
	ModeModeration = 2
	//modeDeleted means deleted, but referenced: The comment was deleted on the server but is still referenced by replies.
	// 100
	ModeDeleted = 4
	//modePublic means The comment is public. its replies can be counted and show.
	// 101
	//modePublic include modeAccepted, modeDeleted
	//modePublic CAN NOT be used by comment.
	//It is the shortcut for select comments who are in modeAccepted or modeDeleted.
	ModePublic = 5
)

mode for comment's mode. comment mode CAN NOT be set to modePublic.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptableError

type AcceptableError struct {
	// contains filtered or unexported fields
}

AcceptableError used to type

func (*AcceptableError) Error

func (e *AcceptableError) Error() string

type Accessor

type Accessor interface {
	Close() error
	// contains filtered or unexported methods
}

Accessor defines all usual access ops avail.

func NewAccessor

func NewAccessor(dbConfig conf.Database, guard conf.Guard) (Accessor, error)

NewAccessor generate an new DB worker

type Comment

type Comment struct {
	ID       int64      `json:"id"`
	Parent   null.Int   `json:"parent"`
	Created  float64    `json:"created"`
	Modified null.Float `json:"modified"`
	Mode     int64      `json:"mode"`

	Text   string      `json:"text"`
	Author null.String `json:"author"`

	Website  null.String `json:"website"`
	Likes    int64       `json:"likes"`
	Dislikes int64       `json:"dislikes"`

	// not store in database.
	Hash string `json:"hash"`
	// contains filtered or unexported fields
}

Comment represent replies

func NewComment

func NewComment(tid int64, Parent null.Int, mode int64, remoteAddr string,
	text string, author, email, website null.String, notification int64) Comment

NewComment return a new comment struct with setable fileds. ID, tid, or others generate later

func (*Comment) CookieValue

func (c *Comment) CookieValue() map[int64][20]byte

CookieValue return the value that can be used as edit cookie value.

func (*Comment) EmailOrIP

func (c *Comment) EmailOrIP() string

func (*Comment) Verify

func (c *Comment) Verify() error

Verify check comment invalid or valid

type Thread

type Thread struct {
	ID    int64
	URI   string
	Title null.String
}

Thread is associated with Comments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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