events

package
v0.0.0-...-3056a10 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package events is responsible for saving events.

Index

Constants

View Source
const AnoymousUser = "SYSTEM: DELETED USER"

Variables

This section is empty.

Functions

func AnonymiseUserEvents

func AnonymiseUserEvents(user string) (int64, error)

AnonymiseUserEvents removes the user name from all events associated by a user. It returns the number of renamed events.

func DeleteEvent

func DeleteEvent(ID string) error

DeleteEvent removes a single event.

func DeleteTopicEvents

func DeleteTopicEvents(topicid string) (int64, error)

DeleteTopicEvents removes all events associated by a topic. It returns the number of deleted events.

func DeleteTopicEventsBefore

func DeleteTopicEventsBefore(topicid string, t time.Time) (int64, error)

DeleteTopicEventsBefore removes all events of a topic before a certain time. It returns the number of deleted events.

func InitDB

func InitDB(config string) error

InitDB initialises the database. Must be called before any other function. This stub will return an error if no build tags are set.

func SaveEvent

func SaveEvent(e Event) (string, error)

SaveEvent saves an event. ID will be ignored. It returns the ID of the event.

func SaveEvents

func SaveEvents(e []Event) error

SaveEvent saves multiple events. The method is optimised for insering multiple objects. ID will be ignored.

Types

type Event

type Event struct {
	ID           string
	Type         int
	User         string
	Topic        string
	Date         time.Time
	Data         []byte `xml:",cdata"`
	AffectedUser string
}

Event represents a file.

func GetEvent

func GetEvent(ID string) (Event, error)

GetEvent returns a file by ID.

func GetEventsOfTopic

func GetEventsOfTopic(topicid string) ([]Event, error)

GetEventsOfTopic returns all events associated by a topic.

func GetEventsOfUser

func GetEventsOfUser(user string) ([]Event, error)

GetEventsOfUser returns all events associated by a user.

Jump to

Keyboard shortcuts

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