Documentation ¶
Index ¶
- func Ptr[T any](v T) *T
- type Account
- type AccountAuth
- type DBStorage
- type EtcdKVStore
- type KVStore
- type LocalAuth
- type MongoDBStorage
- func (s MongoDBStorage) CreateAccount(account Account) error
- func (s MongoDBStorage) GetAccount(id string) (*Account, error)
- func (s MongoDBStorage) GetAccounts(namespaces []string) (accounts []Account, err error)
- func (s MongoDBStorage) GetAccountsByIds(accountids []string) (accounts []Account, err error)
- func (s MongoDBStorage) LocalAuthentication(namespace string, username *string, email *string, phone_number *string) (*Account, error)
- func (s MongoDBStorage) Migrate() error
- func (s MongoDBStorage) UpdateAccount(account Account) error
- type PostgresqlStorage
- func (psql PostgresqlStorage) CreateAccount(account Account) error
- func (psql PostgresqlStorage) GetAccount(id string) (*Account, error)
- func (psql PostgresqlStorage) GetAccounts(namespaces []string) ([]Account, error)
- func (psql PostgresqlStorage) GetAccountsByIds(accountids []string) ([]Account, error)
- func (psql PostgresqlStorage) LocalAuthentication(namespace string, username *string, email *string, phone_number *string) (*Account, error)
- func (psql PostgresqlStorage) Migrate() error
- func (psql PostgresqlStorage) UpdateAccount(account Account) error
- type Storage
- type Validation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountAuth ¶
type AccountAuth struct {
Local *LocalAuth `bson:"local,omitempty"`
}
type DBStorage ¶
type DBStorage interface { GetAccount(id string) (*Account, error) LocalAuthentication(namespace string, username *string, email *string, phone_number *string) (*Account, error) GetAccounts(namespaces []string) ([]Account, error) GetAccountsByIds(accountids []string) ([]Account, error) CreateAccount(account Account) error //TODO : remove UpdateAccount, implement UpdateAccountData and UpdateAccountLocalAuthentication UpdateAccount(account Account) error Migrate() error }
type EtcdKVStore ¶
func NewEtcdKVStore ¶
func NewEtcdKVStore(cfg *viper.Viper) (EtcdKVStore, error)
func (EtcdKVStore) Delete ¶
func (s EtcdKVStore) Delete(k string) error
func (EtcdKVStore) PutWithTTL ¶
type KVStore ¶
type LocalAuth ¶
type LocalAuth struct { Username *string `json:"username" bson:"username,omitempty"` Password string `json:"password" bson:"password"` Email *string `json:"email" bson:"email,omitempty"` EmailValidation *Validation `json:"email_validation" bson:"email_validation,omitempty"` PhoneNumber *string `json:"phone_number" bson:"phone_number,omitempty"` PhoneNumberValidation *Validation `json:"phone_number_validation" bson:"phone_number_validation,omitempty"` }
type MongoDBStorage ¶
func NewMongoDBStorage ¶
func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error)
func (MongoDBStorage) CreateAccount ¶
func (s MongoDBStorage) CreateAccount(account Account) error
func (MongoDBStorage) GetAccount ¶
func (s MongoDBStorage) GetAccount(id string) (*Account, error)
func (MongoDBStorage) GetAccounts ¶
func (s MongoDBStorage) GetAccounts(namespaces []string) (accounts []Account, err error)
func (MongoDBStorage) GetAccountsByIds ¶
func (s MongoDBStorage) GetAccountsByIds(accountids []string) (accounts []Account, err error)
func (MongoDBStorage) LocalAuthentication ¶
func (s MongoDBStorage) LocalAuthentication(namespace string, username *string, email *string, phone_number *string) (*Account, error)
LocalAuthentication returns an Account matching with one of username, email or password. If username, is provided (not an empty string), it will search by username only If username is an empty string and email is provided, it will search by email If both username and email are empty strings, phone_number must be provided and it will search by phone number
func (MongoDBStorage) Migrate ¶
func (s MongoDBStorage) Migrate() error
func (MongoDBStorage) UpdateAccount ¶
func (s MongoDBStorage) UpdateAccount(account Account) error
type PostgresqlStorage ¶
func NewPostgresqlStorage ¶
func NewPostgresqlStorage(cfg *viper.Viper) (PostgresqlStorage, error)
func (PostgresqlStorage) CreateAccount ¶
func (psql PostgresqlStorage) CreateAccount(account Account) error
func (PostgresqlStorage) GetAccount ¶
func (psql PostgresqlStorage) GetAccount(id string) (*Account, error)
func (PostgresqlStorage) GetAccounts ¶
func (psql PostgresqlStorage) GetAccounts(namespaces []string) ([]Account, error)
func (PostgresqlStorage) GetAccountsByIds ¶
func (psql PostgresqlStorage) GetAccountsByIds(accountids []string) ([]Account, error)
func (PostgresqlStorage) LocalAuthentication ¶
func (PostgresqlStorage) Migrate ¶
func (psql PostgresqlStorage) Migrate() error
func (PostgresqlStorage) UpdateAccount ¶
func (psql PostgresqlStorage) UpdateAccount(account Account) error
type Validation ¶
Click to show internal directories.
Click to hide internal directories.