store

package
v0.0.0-...-ac4f561 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned by stores in case of a not found error.

Functions

This section is empty.

Types

type Account

type Account struct {
	UserNumber   PhoneNumber // key
	ServerNumber PhoneNumber
	DiscordToken string
}

type AccountStore

type AccountStore interface {
	// Account returns the account that the store is associated with.
	Account() Account

	// NumberIsMuted returns whether a number is muted or not.
	NumberIsMuted(context.Context) bool
	// MuteNumber mutes a number until the given time.
	MuteNumber(context.Context, time.Time) error
	// UnmuteNumber unmutes a number.
	UnmuteNumber(context.Context) error

	// ChannelNickname returns the nickname of a channel.
	ChannelNickname(context.Context, discord.ChannelID) (string, error)
	// ChannelNicknames returns all channel nicknames.
	ChannelNicknames(context.Context) (map[discord.ChannelID]string, error)
	// ChannelFromNickname returns the channel ID from a nickname.
	ChannelFromNickname(context.Context, string) (discord.ChannelID, error)
	// SetChannelNickname sets the nickname of a channel.
	SetChannelNickname(context.Context, discord.ChannelID, string) error
}

type InternalError

type InternalError struct {
	Err error
}

InternalError is returned by stores in case of an internal error.

func (InternalError) Error

func (e InternalError) Error() string

func (InternalError) Unwrap

func (e InternalError) Unwrap() error

type PhoneNumber

type PhoneNumber = string

type Store

type Store interface {
	// Account returns an account store by its phone number.
	Account(context.Context, PhoneNumber) (AccountStore, error)
	// Accounts returns all accounts.
	Accounts(context.Context) ([]Account, error)
	// SetAccount sets an account.
	SetAccount(context.Context, Account) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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