accesstimes

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 accesstimes is responsible for saving the access times of users of topics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(user string) (int64, error)

DeleteUser removes all information of a user from the database and returns the number of removed data points. It does not ensure that no new data is written once the call returns.

func GetTimes

func GetTimes(user string, topics []string) ([]time.Time, error)

GetTimes returns the access times of a user for the given topics.

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 SaveTime

func SaveTime(user string, topic string, access time.Time) error

SaveTime saves the access time of a user / topic combination into the database. Since the write is done asynchronously, you have to call WaitWrite if you need to ensure that the time is actually written (and GetTimes / GetUserTimes returns the new value).

func WaitWrite

func WaitWrite()

WaitWrite waits for an asynchronous write to finish. It must be used if it is required that new values from SaveTime are returned in GetTimes / GetUserTimes.

Types

type AccessTimes

type AccessTimes struct {
	// TopicID is the ID of the topic
	TopicID string

	// Time is the access time
	Time time.Time
}

AccessTimes represents a time when a user accessed a topic.

func GetUserTimes

func GetUserTimes(user string) ([]AccessTimes, error)

GetUserTimes returns all accesstimes saved by a user.

Jump to

Keyboard shortcuts

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