database

package
v0.0.0-...-ae61212 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnectionPool

func NewConnectionPool(config config.DatabaseConfig) (*sql.DB, error)

Types

type Channels

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

func NewChannelStore

func NewChannelStore(db *sql.DB) Channels

func (Channels) AddMember

func (s Channels) AddMember(channel model.Channel, user model.User, role model.ChannelRole) error

func (Channels) Create

func (s Channels) Create(m model.Channel) error

func (Channels) FindAllForUser

func (s Channels) FindAllForUser(userUUID string) ([]model.Channel, error)

func (Channels) FindByUUID

func (s Channels) FindByUUID(uuid string) (model.Channel, error)

func (Channels) FindForUser

func (s Channels) FindForUser(channelUUID, userUUID string) (model.Channel, error)

func (Channels) FindMember

func (s Channels) FindMember(channelUUID, userUUID string) (model.Member, error)

type Credentials

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

func NewCredentialStore

func NewCredentialStore(db *sql.DB) Credentials

func (Credentials) FindPasswordByUserUUID

func (s Credentials) FindPasswordByUserUUID(userUUID string) (model.PasswordCredential, error)

func (Credentials) SetPassword

func (s Credentials) SetPassword(userUUID, hashedPassword string) error

type DBStore

type DBStore struct {
	Users         Users
	Credentials   Credentials
	Sessions      Sessions
	Channels      Channels
	Messages      Messages
	Verifications Verifications
}

func NewDBStore

func NewDBStore(db *sql.DB) DBStore

type Messages

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

func NewMessageStore

func NewMessageStore(db *sql.DB) Messages

func (Messages) Create

func (s Messages) Create(channelUUID string, m model.Message) error

func (Messages) FindForChannel

func (s Messages) FindForChannel(channelUUID string, limit, offset int32) ([]model.Message, error)

func (Messages) FindLastMessageForChannels

func (s Messages) FindLastMessageForChannels(channelUUIDs ...string) ([]model.Message, error)

type Sessions

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

func NewSessionStore

func NewSessionStore(db *sql.DB) Sessions

func (Sessions) Create

func (s Sessions) Create(m model.Session) error

func (Sessions) Delete

func (s Sessions) Delete(id string) error

func (Sessions) FindByID

func (s Sessions) FindByID(id string) (model.Session, error)

func (Sessions) SetLastSeenAt

func (s Sessions) SetLastSeenAt(id string, lastSeenAt time.Time) error

type Users

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

func NewUserStore

func NewUserStore(db *sql.DB) Users

func (Users) Create

func (s Users) Create(m model.User) error

func (Users) Delete

func (s Users) Delete(uuid string) error

func (Users) FindAllByUUIDs

func (s Users) FindAllByUUIDs(userUUIDs ...string) (users map[string]model.User, err error)

func (Users) FindByEmail

func (s Users) FindByEmail(email string) (model.User, error)

func (Users) FindByUUID

func (s Users) FindByUUID(uuid string) (model.User, error)

func (Users) SetDeactivation

func (s Users) SetDeactivation(uuid string, deactivatedAt *time.Time) error

func (Users) SetEmail

func (s Users) SetEmail(uuid, email string, emailVerifiedAt time.Time) error

type Verifications

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

func NewVerificationsStore

func NewVerificationsStore(db *sql.DB) Verifications

func (Verifications) Create

func (Verifications) DeleteByUUID

func (s Verifications) DeleteByUUID(uuid string) error

func (Verifications) FindAllOlderThan

func (s Verifications) FindAllOlderThan(threshold time.Time) (verifications []model.FieldVerification, err error)

func (Verifications) FindByUUID

func (s Verifications) FindByUUID(uuid string) (model.FieldVerification, error)

Jump to

Keyboard shortcuts

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