message

package
v5.2.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2018 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLabel

func AddLabel(message *tat.Message, topic tat.Topic, label string, color string) (tat.Label, error)

AddLabel add a label to a message truncated to 100 char in text label

func AddToTasks

func AddToTasks(message *tat.Message, user tat.User, topic tat.Topic) error

AddToTasks add a message to user's tasks tat.Topic

func AllTopicsComputeReplies

func AllTopicsComputeReplies() (string, error)

AllTopicsComputeReplies computes Replies on all topics

func ChangeUsernameOnMessages

func ChangeUsernameOnMessages(oldUsername, newUsername string) error

ChangeUsernameOnMessages changes username of a user on all msg

func ChangeUsernameOnMessagesTopics

func ChangeUsernameOnMessagesTopics(oldUsername, newUsername string) error

ChangeUsernameOnMessagesTopics change username on topics

func CheckAndFixText

func CheckAndFixText(message *tat.Message, topic tat.Topic) error

CheckAndFixText truncates to maxLength (parameter on topic) characters if len < 1, return error

func ComputeReplies

func ComputeReplies(topic tat.Topic) (int, error)

ComputeReplies re-compute replies for all messages in one topic

func CountAllMessages

func CountAllMessages() (int, error)

CountAllMessages returns the total number of messages in db

func CountMessages

func CountMessages(criteria *tat.MessageCriteria, topic tat.Topic) (int, error)

CountMessages list messages with given criteria

func CountMsgSinceDate

func CountMsgSinceDate(topic tat.Topic, date int64) (int, error)

CountMsgSinceDate return number of messages created on one topic from a given date

func Delete

func Delete(message *tat.Message, cascade bool, topic tat.Topic) error

Delete deletes a message from database

func FindByID

func FindByID(message *tat.Message, id string, topic tat.Topic) error

FindByID returns message by given ID

func FindByIDDefaultCollection

func FindByIDDefaultCollection(message *tat.Message, id string) error

FindByIDDefaultCollection returns message by given ID TODO remove this func after migrate all topic to dedicated

func FullTreeMessages

func FullTreeMessages(messages []tat.Message, nloop int, criteria *tat.MessageCriteria, username string, topic tat.Topic) ([]tat.Message, error)

FullTreeMessages returns list msg with only full deep

func InitDB

func InitDB()

InitDB gets all topics, for each topic with "collection" setted, add collection to store

func Insert

func Insert(message *tat.Message, user tat.User, topic tat.Topic, text, inReplyOfID string, dateCreation float64, labels []tat.Label, replies []string, repliesJSON []tat.MessageJSON, messageRoot *tat.Message) error

Insert a new message on one topic

func Like

func Like(message *tat.Message, user tat.User, topic tat.Topic) error

Like add a like to a message

func ListMessages

func ListMessages(criteria *tat.MessageCriteria, username string, topic tat.Topic) ([]tat.Message, error)

ListMessages list messages with given criteria

func MigrateMessagesToDedicatedTopic

func MigrateMessagesToDedicatedTopic(topic *tat.Topic, limit int) (int, error)

MigrateMessagesToDedicatedTopic migrates a topic, from default to dedicated

func Move

func Move(message *tat.Message, user tat.User, fromTopic tat.Topic, toTopic tat.Topic) error

Move moves a message to another topic

func OneTreeMessages

func OneTreeMessages(messages []tat.Message, nloop int, criteria *tat.MessageCriteria, username string, topic tat.Topic) ([]tat.Message, error)

OneTreeMessages returns list msg with only one deep

func RemoveAllAndAddNewLabel

func RemoveAllAndAddNewLabel(message *tat.Message, labels []tat.Label, topic tat.Topic) error

RemoveAllAndAddNewLabel removes all labels and add new label on message

func RemoveAllAndAddNewLabelOrCreate

func RemoveAllAndAddNewLabelOrCreate(message *tat.Message, labels []tat.Label, topic tat.Topic) error

RemoveAllAndAddNewLabelOrCreate removes all labels and add new label on message

func RemoveFromTasks

func RemoveFromTasks(message *tat.Message, user tat.User, topic tat.Topic) error

RemoveFromTasks removes a task from user's Tasks tat.Topic

func RemoveLabel

func RemoveLabel(message *tat.Message, label string, topic tat.Topic) error

RemoveLabel removes label from on message (label text matching)

func RemoveSomeAndAddNewLabel

func RemoveSomeAndAddNewLabel(message *tat.Message, labelsToAdd []tat.Label, labelsToRemove []string, topic tat.Topic) error

RemoveSomeAndAddNewLabel removes some labels and add new label on message

func UnVoteDown

func UnVoteDown(message *tat.Message, user tat.User, topic tat.Topic) error

UnVoteDown removes a vote down from a message

func UnVoteUP

func UnVoteUP(message *tat.Message, user tat.User, topic tat.Topic) error

UnVoteUP removes a vote up from a message

func Unlike

func Unlike(message *tat.Message, user tat.User, topic tat.Topic) error

Unlike removes a like from one message

func Update

func Update(message *tat.Message, user tat.User, topic tat.Topic, newText string, action string) error

Update updates a message from database action could be concat (for adding additional text to message or update)

func VoteDown

func VoteDown(message *tat.Message, user tat.User, topic tat.Topic) error

VoteDown add a vote Down to a message

func VoteUP

func VoteUP(message *tat.Message, user tat.User, topic tat.Topic) error

VoteUP add a vote UP to a message

Types

This section is empty.

Jump to

Keyboard shortcuts

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