messageapi

package
v0.0.0-...-9714d35 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	*MessageStore
}

composition

func (*Api) Attached

func (sc *Api) Attached(method string) bool

implement the Cruder interface

func (*Api) Create

func (a *Api) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*Api) Delete

func (a *Api) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) List

func (a *Api) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

func (*Api) Read

func (a *Api) Read(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) Replace

func (a *Api) Replace(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Api) Update

func (a *Api) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

type Message

type Message struct {
	Id_ bson.ObjectId `json:"-" bson:"_id"`
	MessageInput
	Recvtime time.Time // original submission time
	Modtime  time.Time // time of last modification
	Userid   string    // foreign key
	Username string
	Tags     []string `json:,omitempty bson:,omitempty` // foreign keys
	Mentions []string `json:,omitempty bson:,omitempty` // foreign keys
}

type MessageInput

type MessageInput struct {
	Id         string // primary key
	Text       string
	Texttime   time.Time // user supplied time at which text applied
	References []string  `json:,omitempty bson:,omitempty`
}

type MessageStore

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

receiver type

func NewMessageStore

func NewMessageStore(dbsession *mgo.Session, dbname string, db *sql.DB, users *userapi.UserCache) *MessageStore

generator

func (*MessageStore) AddMessage

func (ms *MessageStore) AddMessage(message *Message) error

func (*MessageStore) GetMessage

func (ms *MessageStore) GetMessage(id string) (*Message, error)

func (*MessageStore) GetMessages

func (ms *MessageStore) GetMessages(startTime, endTime time.Time) ([]Message, error)

func (*MessageStore) RemoveMessage

func (ms *MessageStore) RemoveMessage(id string) error

Jump to

Keyboard shortcuts

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