database

package
v0.0.0-...-9a3fcf3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteChat

func DeleteChat(db *sql.DB, chatID int64) error

func DeletePendingOrder

func DeletePendingOrder(db *sql.DB, merchantOrderID string) error

func GetAddressesByPlatform

func GetAddressesByPlatform(db *sql.DB, platform string) (map[string]struct{}, error)

func GetDB

func GetDB() *sql.DB

func GetTodayDelegatedCount

func GetTodayDelegatedCount(db *sql.DB) (int, error)

func GetTodayEventCountGroupByPlatform

func GetTodayEventCountGroupByPlatform(db *sql.DB) (map[string]int, error)

func IncrementPendingOrderRetries

func IncrementPendingOrderRetries(db *sql.DB, merchantOrderID string) error

func InitDatabase

func InitDatabase() *sql.DB

func InsertAddress

func InsertAddress(db *sql.DB, addr string, hexAddr string, platform string) error

func InsertDelegateRecord

func InsertDelegateRecord(db *sql.DB, receiverAddress, txid string) error

func InsertEventHistory

func InsertEventHistory(db *sql.DB, ev EventHistory) error

func InsertOrUpdateChat

func InsertOrUpdateChat(db *sql.DB, chatID int64, title string) error

func InsertPendingOrder

func InsertPendingOrder(db *sql.DB, order PendingOrder) error

func SetDB

func SetDB(d *sql.DB)

func UpdatePendingOrderStatus

func UpdatePendingOrderStatus(db *sql.DB, merchantOrderID string, newStatus string) error

func UpdateUndelegatedByTxid

func UpdateUndelegatedByTxid(db *sql.DB, txid string) error

Types

type Chat

type Chat struct {
	ID    int64
	Title string
}

func GetAllChats

func GetAllChats(db *sql.DB) ([]Chat, error)

func GetChatByTitle

func GetChatByTitle(db *sql.DB, searchString string) ([]Chat, error)

type DBConfig

type DBConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
}

type DelegateRecord

type DelegateRecord struct {
	ID              int
	ReceiverAddress string
	TxID            string
	Undelegated     bool
	CreatedAt       time.Time
}

func GetUndelegatedBefore

func GetUndelegatedBefore(db *sql.DB, before time.Time) ([]DelegateRecord, error)

type EventHistory

type EventHistory struct {
	TransactionHash  string
	USDT             string
	FromAddress      string
	ToAddress        string
	Platform         string
	WalletUSDT       string
	OrderID          string
	AskEnergySuccess bool
}

func GetEventsByToAddress

func GetEventsByToAddress(db *sql.DB, to string) ([]EventHistory, error)

type PendingOrder

type PendingOrder struct {
	MerchantOrderID    string
	CustomerUsername   string
	AdvertiserUsername string
	OrderStatus        string
	DisplayFiatAmount  float64
	Retries            int
	OriginalChatID     int64
	ReplyToMessageID   int64
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

func GetPendingOrders

func GetPendingOrders(db *sql.DB) ([]PendingOrder, error)

Jump to

Keyboard shortcuts

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