account

package
v0.0.0-...-6727a53 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Username     string    `json:"username,omitempty"`
	Password     string    `json:"password,omitempty"`
	AccessToken  string    `json:"access_token,omitempty"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	TokenExpiry  time.Time `json:"token_expiry,omitempty"`
}

Account holds a user account

func NewWithRandomPassword

func NewWithRandomPassword(username string) *Account

NewWithRandomPassword creates a new Account with a random password

type FileStore

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

FileStore implements the Store interface and uses plain files

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

NewFileStore returns a new FileStore. It returns an error if the given path does not exist or is not a directory.

func (*FileStore) Read

func (st *FileStore) Read(id string) (*Account, error)

func (*FileStore) Write

func (st *FileStore) Write(a *Account) error

type RedisStore

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

RedisStore is an account store that is backed by Redis

func NewRedisStore

func NewRedisStore(addresses []string) (*RedisStore, error)

NewRedisStore creates an account store that is backed by Redis

func (*RedisStore) Read

func (rs *RedisStore) Read(id string) (*Account, error)

func (*RedisStore) Write

func (rs *RedisStore) Write(a *Account) error

type Store

type Store interface {
	Read(id string) (*Account, error)
	Write(a *Account) error
}

Store is an interface to store and retrieve account details

Jump to

Keyboard shortcuts

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