data

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 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 IdentityID

type IdentityID struct {
	iden3core.ID
}

func NewIdentityID

func NewIdentityID(id iden3core.ID) *IdentityID

func (*IdentityID) Scan

func (id *IdentityID) Scan(src interface{}) error

func (*IdentityID) Value

func (id *IdentityID) Value() (driver.Value, error)

type MasterQ

type MasterQ interface {
	New() MasterQ

	UsersQ() UsersQ
	NonceQ() NonceQ

	Transaction(func() error) error
}

type Nonce

type Nonce struct {
	ID         int64          `db:"id"          structs:"-"`
	Nonce      string         `db:"nonce"       structs:"nonce"`
	ExpiresAt  time.Time      `db:"expires_at"  structs:"expires_at"`
	EthAddress common.Address `db:"eth_address" structs:"eth_address"`
}

type NonceQ

type NonceQ interface {
	Get() (*Nonce, error)
	Select() ([]Nonce, error)
	Insert(value *Nonce) error
	Update(value *Nonce) error
	Delete() error

	WhereEthAddress(addresses ...common.Address) NonceQ
	WhereExpiresAtLt(expiresAt time.Time) NonceQ
	WhereExpiresAtGt(expiresAt time.Time) NonceQ
}

type User

type User struct {
	ID        uuid.UUID  `db:"id"         structs:"id"`
	Status    UserStatus `db:"status"     structs:"status"`
	CreatedAt time.Time  `db:"created_at" structs:"created_at"`

	// IdentityID is a unique user's ident3 identity id
	IdentityID *IdentityID     `db:"identity_id" structs:"-"`
	EthAddress *common.Address `db:"eth_address" structs:"eth_address"`

	// ProviderData Store raw information that received from identity provider.
	// Its json structure depends on identity provider.
	ProviderData []byte `db:"provider_data" structs:"provider_data"`

	// ProviderHash is used for data uniqueness check.
	ProviderHash []byte    `db:"provider_hash" structs:"provider_hash"`
	ClaimID      uuid.UUID `db:"claim_id" structs:"claim_id"`
}

type UserStatus

type UserStatus string
const (
	UserStatusInitialized UserStatus = "initialized"
	UserStatusPending     UserStatus = "pending"
	UserStatusVerified    UserStatus = "verified"
	UserStatusUnverified  UserStatus = "unverified"
)

func (UserStatus) String

func (s UserStatus) String() string

type UsersQ

type UsersQ interface {
	Get() (*User, error)
	Select() ([]User, error)
	Insert(user *User) error
	Upsert(user *User) error
	Update(user *User) error

	Sort(sort pgdb.SortedOffsetPageParams) UsersQ
	WhereID(id uuid.UUID) UsersQ
	WhereStatus(status UserStatus) UsersQ
	WhereIdentityID(id *IdentityID) UsersQ
	WhereEthAddress(address common.Address) UsersQ
	WhereProviderHash(providerHash []byte) UsersQ
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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