database

package
v0.0.0-...-3c1bb5f Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID                int32
	CmcID             int64
	Name              string
	Slug              string
	Price             float64
	PercentChange1h   float32
	PercentChange24h  float32
	PercentChange7d   float32
	MarketCap         float64
	Volume24h         float64
	CirculatingSupply float32
	AllTimeHigh       float32
	AllTimeLow        float32
	Turnover          float32
	TotalSupply       float32
	MaxSupply         float32
	CreatedAt         sql.NullTime
	UpdatedAt         sql.NullTime
}

type CreateAssetParams

type CreateAssetParams struct {
	CmcID             int64
	Name              string
	Slug              string
	Price             float64
	PercentChange1h   float32
	PercentChange24h  float32
	PercentChange7d   float32
	MarketCap         float64
	Volume24h         float64
	CirculatingSupply float32
	AllTimeHigh       float32
	AllTimeLow        float32
	Turnover          float32
	TotalSupply       float32
	MaxSupply         float32
}

type CreateUserFollowedAssetParams

type CreateUserFollowedAssetParams struct {
	UserID  sql.NullInt32
	AssetID sql.NullInt32
}

type CreateUserParams

type CreateUserParams struct {
	Email          string
	HashedPassword string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteUserFollowedAssetParams

type DeleteUserFollowedAssetParams struct {
	UserID  sql.NullInt32
	AssetID sql.NullInt32
}

type ListAssetsParams

type ListAssetsParams struct {
	Limit  int32
	Offset int32
}

type ListUsersParams

type ListUsersParams struct {
	Limit  int32
	Offset int32
}

type Notification

type Notification struct {
	ID        int32
	UserID    sql.NullInt32
	NotiType  NotificationType
	Message   sql.NullString
	IsRead    sql.NullBool
	CreatedAt sql.NullTime
}

type NotificationType

type NotificationType string
const (
	NotificationTypeEmail    NotificationType = "email"
	NotificationTypeDiscord  NotificationType = "discord"
	NotificationTypeTelegram NotificationType = "telegram"
)

func (*NotificationType) Scan

func (e *NotificationType) Scan(src interface{}) error

type NullNotificationType

type NullNotificationType struct {
	NotificationType NotificationType
	Valid            bool // Valid is true if NotificationType is not NULL
}

func (*NullNotificationType) Scan

func (ns *NullNotificationType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullNotificationType) Value

func (ns NullNotificationType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateAsset

func (q *Queries) CreateAsset(ctx context.Context, arg CreateAssetParams) (Asset, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) CreateUserFollowedAsset

func (q *Queries) CreateUserFollowedAsset(ctx context.Context, arg CreateUserFollowedAssetParams) (UserFollowedAsset, error)

func (*Queries) DeleteUserFollowedAsset

func (q *Queries) DeleteUserFollowedAsset(ctx context.Context, arg DeleteUserFollowedAssetParams) error

func (*Queries) GetAllEmails

func (q *Queries) GetAllEmails(ctx context.Context) ([]string, error)

func (*Queries) GetAsset

func (q *Queries) GetAsset(ctx context.Context, cmcID int64) (Asset, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id int32) (User, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) ListAssets

func (q *Queries) ListAssets(ctx context.Context, arg ListAssetsParams) ([]Asset, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)

func (*Queries) UpdateAsset

func (q *Queries) UpdateAsset(ctx context.Context, arg UpdateAssetParams) (Asset, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Store

type Store struct {
	*Queries
	// contains filtered or unexported fields
}

Store provides all functions to excute db queries and transactions

func NewStore

func NewStore(db *sql.DB) *Store

NewStore creates a new Store

type UpdateAssetParams

type UpdateAssetParams struct {
	Price             sql.NullFloat64
	PercentChange1h   sql.NullFloat64
	PercentChange24h  sql.NullFloat64
	PercentChange7d   sql.NullFloat64
	MarketCap         sql.NullFloat64
	Volume24h         sql.NullFloat64
	CirculatingSupply sql.NullFloat64
	AllTimeHigh       sql.NullFloat64
	AllTimeLow        sql.NullFloat64
	Turnover          sql.NullFloat64
	TotalSupply       sql.NullFloat64
	MaxSupply         sql.NullFloat64
	UpdatedAt         sql.NullTime
	CmcID             int64
}

type User

type User struct {
	ID             int32
	Email          string
	HashedPassword string
	CreatedAt      sql.NullTime
	UpdatedAt      sql.NullTime
}

type UserFollowedAsset

type UserFollowedAsset struct {
	ID         int32
	UserID     sql.NullInt32
	AssetID    sql.NullInt32
	FollowedAt sql.NullTime
}

Jump to

Keyboard shortcuts

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