users

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBalance

func GetBalance(ctx context.Context, req rq.BalanceV1) (rp.BalanceV1, error)

GetBalance manages the entire balance check flow including airdrops

func WithID

func WithID(id int64) requestGetUserBalanceOption

func WithUserID

func WithUserID(userID string) requestGetUserBalanceOption

Types

type User

type User struct {
	ID                    int64
	UID                   string
	Email                 sql.NullString
	Balance               int64
	LastAirdropAt         sql.NullTime
	TotalTokensAirdropped int64
}

func (*User) Get

func (u *User) Get(ctx context.Context) (err error)

Get gets a user by their UID. If the user does not exist, it creates a new user.

func (*User) InitBalance

func (u *User) InitBalance(ctx context.Context) error

Init sets the user's balance to the given value. If the user does not exist, it creates a new user.

func (*User) Insert

func (u *User) Insert(ctx context.Context) error

Insert inserts a new user into the database. It updates the User's ID with the ID from the database.

Jump to

Keyboard shortcuts

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