db

package
v0.0.0-...-c079afc Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB to store the status of lowry

func Init

func Init(path string) (*DB, error)

Init database storing it in path

func (*DB) AddAccount

func (db *DB) AddAccount(user string, host string) error

AddAccount stores in the db the account and it's host who invited it

func (*DB) AddCollective

func (db *DB) AddCollective(name string, host string) error

AddCollective stores in the db the collective that was created by host

func (*DB) AddInvite

func (db *DB) AddInvite(code string, user string) error

AddInvite stores in the db the inviteValue code generated by user

func (*DB) AddLastSeen

func (db *DB) AddLastSeen(user string, lastSeen time.Time) error

AddLastSeen stores in the db the account and it's lastseen date

func (*DB) AddOpenpgpNotification

func (db *DB) AddOpenpgpNotification(dn string, fingerprint string) error

AddOpenpgpNotification stores in the db the dn being notified for their key being expired

func (*DB) Close

func (db *DB) Close()

Close the database

func (*DB) CountCollectives

func (db *DB) CountCollectives(host string) (int, error)

CountCollectives returns the nubmer of collectives created by host

func (*DB) DelInvite

func (db *DB) DelInvite(code string) error

DelInvite code from the database

func (*DB) ExpireAccounts

func (db *DB) ExpireAccounts(duration time.Duration) error

ExpireAccounts older than duration

func (*DB) ExpireCollectives

func (db *DB) ExpireCollectives(duration time.Duration) error

ExpireCollectives older than duration

func (*DB) ExpireInvites

func (db *DB) ExpireInvites(duration time.Duration) error

ExpireInvites older than duration

func (*DB) ExpireLastSeen

func (db *DB) ExpireLastSeen(duration time.Duration) error

ExpireLastSeen older than duration

func (*DB) ExpireOpenpgpNotifications

func (db *DB) ExpireOpenpgpNotifications(duration time.Duration) error

ExpireOpenpgpNotifications older than duration

func (*DB) GetHost

func (db *DB) GetHost(user string) (string, error)

GetHost that invited the user

func (*DB) GetLastSeen

func (db *DB) GetLastSeen(user string) (time.Time, error)

GetLastSeen time for the user

func (*DB) GetOpenpgpNotification

func (db *DB) GetOpenpgpNotification(dn string) (string, error)

GetOpenpgpNotification gets the fingerprint latest notification for the dn

func (*DB) InviteHost

func (db *DB) InviteHost(code string) (string, error)

InviteHost returns the user name that created the inviteValue

func (*DB) IsInviteValid

func (db *DB) IsInviteValid(code string) bool

IsInviteValid checks if the inviteValue code is in the database

func (*DB) ListUserInvites

func (db *DB) ListUserInvites(user string) ([]Invite, error)

ListUserInvites returns all the inviteValue codes generated by a user

type Invite

type Invite struct {
	Code         string
	CreationDate time.Time
}

Invite holds the data of an invite

Jump to

Keyboard shortcuts

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