data

package
v0.0.0-...-6123566 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	User  *UserProvider
	Token *TokenProvider
	// contains filtered or unexported fields
}

func NewStore

func NewStore(host, port, username, password, name string) (*Store, error)

func (*Store) Populate

func (s *Store) Populate() (err error)

type Token

type Token struct {
	Id        uint      `json:"id"`
	UserId    string    `json:"user_id"`
	Token     string    `json:"token"`
	AppId     string    `json:"app_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	ExpiredAt time.Time `json:"expired_at"`
}

type TokenProvider

type TokenProvider struct {
	*sql.DB
}

func NewTokenProvider

func NewTokenProvider(db *sql.DB) *TokenProvider

func (*TokenProvider) CreateOne

func (p *TokenProvider) CreateOne(uid, aid, t string, d time.Duration) (err error)

func (*TokenProvider) DeleteAppFamily

func (p *TokenProvider) DeleteAppFamily(uid, aid string) (err error)

func (TokenProvider) DeleteByUser

func (p TokenProvider) DeleteByUser(uid string) (err error)

func (*TokenProvider) Exists

func (p *TokenProvider) Exists(token string) (err error)

func (*TokenProvider) ReadLatestByIds

func (p *TokenProvider) ReadLatestByIds(uid, aid string) (token string, err error)

type User

type User struct {
	Id          uint      `json:"id"`
	DisplayName string    `json:"display_name"`
	Email       string    `json:"email"`
	Password    string    `json:"-"`
	UpdatedAt   time.Time `json:"-"`
	CreatedAt   time.Time `json:"-"`
	ExpiredAt   time.Time `json:"-"`
}

func (*User) ComparePassword

func (u *User) ComparePassword(p string) error

func (*User) SetPassword

func (u *User) SetPassword(p string) error

type UserProvider

type UserProvider struct {
	*sql.DB
}

func NewUserProvider

func NewUserProvider(db *sql.DB) *UserProvider

func (*UserProvider) ReadOne

func (p *UserProvider) ReadOne(id uint, email string) (u User, err error)

Match against id or email

func (*UserProvider) ReadPendingRegistration

func (p *UserProvider) ReadPendingRegistration(k string) (email string, err error)

func (*UserProvider) ReadPendingResetPassword

func (p *UserProvider) ReadPendingResetPassword(k string) (email string, err error)

func (*UserProvider) ReadPendingUpdateEmail

func (p *UserProvider) ReadPendingUpdateEmail(k string) (user_id, email string, err error)

func (*UserProvider) Register

func (p *UserProvider) Register(u User) (id uint, err error)

func (*UserProvider) ResetPassword

func (p *UserProvider) ResetPassword(u User) (err error)

func (*UserProvider) UniqueEmail

func (p *UserProvider) UniqueEmail(e string) (unique bool, err error)

func (*UserProvider) UpdateEmail

func (p *UserProvider) UpdateEmail(uid, e string) (err error)

func (*UserProvider) UpdateOne

func (p *UserProvider) UpdateOne(u User) (err error)

func (*UserProvider) UpsertPendingRegistration

func (p *UserProvider) UpsertPendingRegistration(e string) (key string, err error)

Upsert email and generate confirmation key

func (*UserProvider) UpsertPendingResetPassword

func (p *UserProvider) UpsertPendingResetPassword(e string) (key string, err error)

Upsert email and generate confirmation key

func (*UserProvider) UpsertPendingUpdateEmail

func (p *UserProvider) UpsertPendingUpdateEmail(uid, e string) (key string, err error)

Upsert email and generate confirmation key

Jump to

Keyboard shortcuts

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