message

package
v0.0.0-...-35bba2d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BoltBucketName = "messages"

Variables

This section is empty.

Functions

func BatchSave

func BatchSave(db *bolt.DB, messages []*Message) error

Types

type Message

type Message struct {
	ID        ksuid.KSUID `json:"id" copier:"-"`
	ChannelID ksuid.KSUID `json:"channel_id"`
	Body      string      `json:"body" validate:"min=1,max=2048,required"`
	TTL       uint32      `json:"ttl,omitempty" validate:"max=2592000"`
	CreatedAt time.Time   `json:"created_at" copier:"-"`
	UpdatedAt time.Time   `json:"updated_at" copier:"-"`
}

func Decode

func Decode(enc []byte) (*Message, error)

func Find

func Find(db *bolt.DB, channelID ksuid.KSUID, id ksuid.KSUID) (*Message, error)

func GetAll

func GetAll(db *bolt.DB, channelID ksuid.KSUID, pgn pagination.Pagination) ([]*Message, error)

func New

func New(channelID ksuid.KSUID) *Message

func (*Message) Decode

func (msg *Message) Decode(enc []byte) error

func (*Message) Delete

func (msg *Message) Delete(db *bolt.DB) error

func (*Message) Encode

func (msg *Message) Encode() ([]byte, error)

func (*Message) Save

func (msg *Message) Save(db *bolt.DB) error

persist the message to the DB

Jump to

Keyboard shortcuts

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