Documentation
¶
Index ¶
- type FileSystemStorage
- func (fss *FileSystemStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
- func (fss *FileSystemStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
- func (fss *FileSystemStorage) GetUserCount() (int, error)
- func (fss *FileSystemStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
- func (fss *FileSystemStorage) UserExistsByEmail(email string) (exists bool)
- func (fss *FileSystemStorage) UsersExist() (bool, error)
- type PgSQLStorage
- func (st *PgSQLStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
- func (st *PgSQLStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
- func (st *PgSQLStorage) GetUserCount() (n int, err error)
- func (st *PgSQLStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
- func (st *PgSQLStorage) UserExistsByEmail(email string) (exists bool)
- func (st *PgSQLStorage) UsersExist() (exist bool, err error)
- type SQLiteStorage
- func (st *SQLiteStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
- func (st *SQLiteStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
- func (st *SQLiteStorage) GetUserCount() (n int, err error)
- func (st *SQLiteStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
- func (st *SQLiteStorage) UserExistsByEmail(email string) (exists bool)
- func (st *SQLiteStorage) UsersExist() (exist bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystemStorage ¶
type FileSystemStorage struct {
Directory string
ID2Filename map[uuid.UUID]string
Email2Filename map[string]string
}
Stores data in a flat directory with files named like $<userid>$<email>.json
func NewFileSystemStorage ¶
func NewFileSystemStorage(dir string) (result *FileSystemStorage, err error)
func (*FileSystemStorage) GetUserByEmail ¶
func (fss *FileSystemStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
func (*FileSystemStorage) GetUserById ¶
func (fss *FileSystemStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
func (*FileSystemStorage) GetUserCount ¶ added in v0.9.3
func (fss *FileSystemStorage) GetUserCount() (int, error)
func (*FileSystemStorage) StoreUser ¶
func (fss *FileSystemStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
func (*FileSystemStorage) UserExistsByEmail ¶
func (fss *FileSystemStorage) UserExistsByEmail(email string) (exists bool)
func (*FileSystemStorage) UsersExist ¶ added in v0.9.4
func (fss *FileSystemStorage) UsersExist() (bool, error)
type PgSQLStorage ¶ added in v0.9.6
type PgSQLStorage struct {
// contains filtered or unexported fields
}
func NewPgSQLStorage ¶ added in v0.9.6
func NewPgSQLStorage(db *sql.DB, tableName string) (st *PgSQLStorage, err error)
NewPgSQLStorage creates a PgSQLStorage instance, with PostgreSQL-flavoured SQL. This storage engine will use a single table in the SQL database, that needs to have these fields:
id Some type that can store the 16-byte UUID, either as a text field, or a dedicated type (PostgreSQL has a plugin for the native UUID type) email text data A type that can accept a long JSON string, either as text, or as a dedicated type (PostgreSQL has a native JSONB field)
This table needs to be maintained entirely by the caller, including indexes. A unique index on the `id` field, and another unique index on the `email` field are highly recommended.
func (*PgSQLStorage) GetUserByEmail ¶ added in v0.9.6
func (st *PgSQLStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
func (*PgSQLStorage) GetUserById ¶ added in v0.9.6
func (st *PgSQLStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
func (*PgSQLStorage) GetUserCount ¶ added in v0.9.6
func (st *PgSQLStorage) GetUserCount() (n int, err error)
func (*PgSQLStorage) StoreUser ¶ added in v0.9.6
func (st *PgSQLStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
func (*PgSQLStorage) UserExistsByEmail ¶ added in v0.9.6
func (st *PgSQLStorage) UserExistsByEmail(email string) (exists bool)
func (*PgSQLStorage) UsersExist ¶ added in v0.9.6
func (st *PgSQLStorage) UsersExist() (exist bool, err error)
type SQLiteStorage ¶ added in v0.9.6
type SQLiteStorage struct {
// contains filtered or unexported fields
}
func NewSQLiteStorage ¶ added in v0.9.6
func NewSQLiteStorage(db *sql.DB, tableName string) (st *SQLiteStorage, err error)
NewSQLiteStorage creates a SQLiteStorage instance. This storage engine will use a single table in the SQLite database, that needs to have these fields:
id A type that can store the 16-byte UUID, either as a text field, or a dedicated type email text data A type that can accept a long JSON string, either as text, or as a dedicated type
This table needs to be maintained entirely by the caller, including indexes. A unique index on the `id` field, and another unique index on the `email` field are highly recommended.
func (*SQLiteStorage) GetUserByEmail ¶ added in v0.9.6
func (st *SQLiteStorage) GetUserByEmail(email string) (user *gomagiclink.AuthUserRecord, err error)
func (*SQLiteStorage) GetUserById ¶ added in v0.9.6
func (st *SQLiteStorage) GetUserById(id uuid.UUID) (user *gomagiclink.AuthUserRecord, err error)
func (*SQLiteStorage) GetUserCount ¶ added in v0.9.6
func (st *SQLiteStorage) GetUserCount() (n int, err error)
func (*SQLiteStorage) StoreUser ¶ added in v0.9.6
func (st *SQLiteStorage) StoreUser(user *gomagiclink.AuthUserRecord) (err error)
func (*SQLiteStorage) UserExistsByEmail ¶ added in v0.9.6
func (st *SQLiteStorage) UserExistsByEmail(email string) (exists bool)
func (*SQLiteStorage) UsersExist ¶ added in v0.9.6
func (st *SQLiteStorage) UsersExist() (exist bool, err error)