database

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrationFS

func MigrationFS() fs.FS

MigrationFS exposes the canonical SQL migrations without global registration.

Types

type AddEarningsParams

type AddEarningsParams struct {
	Amount     int64
	ExecutorID string
	Currency   string
}

type ClaimDebugletOrderParams

type ClaimDebugletOrderParams struct {
	DebugletID    sql.NullInt64
	TransactionID string
	OrderID       int64
}

type CompleteDebugletParams

type CompleteDebugletParams struct {
	ExitedState           models.DebugletRunState
	Error                 sql.NullString
	Uuid                  uuid.UUID
	ExecutorID            string
	DispatcherIncarnation string
	SessionID             string
}

type CreateDebugletLogParams

type CreateDebugletLogParams struct {
	Timestamp             models.UTCTime
	Output                []byte
	Uuid                  uuid.UUID
	ExecutorID            string
	DispatcherIncarnation string
	SessionID             string
}

type CreateDebugletOrderParams

type CreateDebugletOrderParams struct {
	TransactionID string
	OrderID       int64
	ExecutorID    string
	Price         int64
	Currency      string
	RefundAddress string
	State         int64
}

type CreateDebugletParams

type CreateDebugletParams struct {
	Uuid                  uuid.UUID
	StartTime             models.UTCTime
	EndTime               models.UTCTime
	Usage                 int64
	CeilBw                int64
	ExecutorID            string
	Addresses             models.CommaSeparatedList
	State                 models.DebugletRunState
	TransactionID         string
	OrderID               int64
	DispatcherIncarnation string
	SessionID             string
}

type CreateEarningsParams

type CreateEarningsParams struct {
	ExecutorID       string
	Currency         string
	SuiWalletAddress string
}

type CreateExecutorEnrollmentTokenParams

type CreateExecutorEnrollmentTokenParams struct {
	Selector   string
	ExecutorID string
	SecretHash []byte
	CreatedAt  models.UTCTime
	ExpiresAt  models.UTCTime
}

type CreateOAuthIdentityParams

type CreateOAuthIdentityParams struct {
	Provider  string
	Subject   string
	UserID    int64
	Login     string
	CreatedAt models.UTCTime
	UpdatedAt models.UTCTime
}

type CreateSessionParams

type CreateSessionParams struct {
	Selector     string
	VerifierHash []byte
	CsrfHash     []byte
	UserID       int64
	CreatedAt    models.UTCTime
	ExpiresAt    models.UTCTime
}

type CreateTransactionParams

type CreateTransactionParams struct {
	ID        string
	AuthKey   string
	Price     int64
	Currency  string
	Method    string
	ExpiresAt models.UTCTime
	Status    int64
	Hash      string
}

type CreateUserParams

type CreateUserParams struct {
	Uuid uuid.UUID
	Name string
}

type CreateUserWithRoleParams

type CreateUserWithRoleParams struct {
	Uuid uuid.UUID
	Name string
	Role 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 Debuglet

type Debuglet struct {
	ID                    int64
	Uuid                  uuid.UUID
	StartTime             models.UTCTime
	EndTime               models.UTCTime
	Usage                 int64
	CeilBw                int64
	ExecutorID            string
	Addresses             models.CommaSeparatedList
	State                 models.DebugletRunState
	Error                 sql.NullString
	TransactionID         string
	OrderID               int64
	DispatcherIncarnation string
	SessionID             string
}

type DebugletLog

type DebugletLog struct {
	ID         int64
	DebugletID int64
	Timestamp  models.UTCTime
	Output     []byte
}

type DebugletOrder

type DebugletOrder struct {
	TransactionID string
	OrderID       int64
	ExecutorID    string
	Price         int64
	Currency      string
	State         int64
	RefundAddress string
	DebugletID    sql.NullInt64
}

type DebugletUser

type DebugletUser struct {
	DebugletID int64
	UserID     int64
}

type Earning

type Earning struct {
	ExecutorID       string
	Currency         string
	TotalIncome      int64
	CurrentBalance   int64
	SuiWalletAddress string
}

type ExecutorEnrollment

type ExecutorEnrollment struct {
	ExecutorID  string
	Fingerprint string
	EnrolledAt  models.UTCTime
}

type ExecutorEnrollmentToken

type ExecutorEnrollmentToken struct {
	Selector   string
	ExecutorID string
	SecretHash []byte
	CreatedAt  models.UTCTime
	ExpiresAt  models.UTCTime
}

type GetAdmittedRunsRow

type GetAdmittedRunsRow struct {
	OrderID int64
	Uuid    uuid.UUID
}

type GetDebugletIdentityByUUIDRow

type GetDebugletIdentityByUUIDRow struct {
	ExecutorID            string
	DispatcherIncarnation string
	SessionID             string
}

type GetDebugletOrderParams

type GetDebugletOrderParams struct {
	TransactionID string
	OrderID       int64
}

type GetEarningsInParams

type GetEarningsInParams struct {
	ExecutorID string
	Currency   string
}

type GetExecutorEnrollmentTokenRow

type GetExecutorEnrollmentTokenRow struct {
	ExecutorID string
	SecretHash []byte
	ExpiresAt  models.UTCTime
}

type GetOAuthIdentityParams

type GetOAuthIdentityParams struct {
	Provider string
	Subject  string
}

type GetOwnedDebugletByUUIDParams

type GetOwnedDebugletByUUIDParams struct {
	Uuid                  uuid.UUID
	ExecutorID            string
	DispatcherIncarnation string
	SessionID             string
}

type GetSessionBySelectorRow

type GetSessionBySelectorRow struct {
	VerifierHash []byte
	CsrfHash     []byte
	ExpiresAt    models.UTCTime
	Revoked      int64
	Uuid         uuid.UUID
	Name         string
	Role         string
}

type GetUserCredentialParams

type GetUserCredentialParams struct {
	Selector string
	Kind     string
}

type GetUserCredentialRow

type GetUserCredentialRow struct {
	UserID     int64
	SecretHash []byte
	Uuid       uuid.UUID
	Name       string
	Role       string
}

type InsertDebugletUserParams

type InsertDebugletUserParams struct {
	DebUuid  uuid.UUID
	UserUuid uuid.UUID
}

type ListDebugletLogsParams

type ListDebugletLogsParams struct {
	Uuid  uuid.UUID
	After int64
	Limit int64
}

type ListDebugletsByUserUUIDParams

type ListDebugletsByUserUUIDParams struct {
	Uuid   uuid.UUID
	Limit  int64
	Offset int64
}

type ListDebugletsParams

type ListDebugletsParams struct {
	Limit  int64
	Offset int64
}

type OauthIdentity

type OauthIdentity struct {
	Provider  string
	Subject   string
	UserID    int64
	Login     string
	CreatedAt models.UTCTime
	UpdatedAt models.UTCTime
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddEarnings

func (q *Queries) AddEarnings(ctx context.Context, arg AddEarningsParams) error

func (*Queries) ClaimDebugletOrder

func (q *Queries) ClaimDebugletOrder(ctx context.Context, arg ClaimDebugletOrderParams) (int64, error)

func (*Queries) CompleteDebuglet

func (q *Queries) CompleteDebuglet(ctx context.Context, arg CompleteDebugletParams) (Debuglet, error)

func (*Queries) ConsumeExecutorEnrollmentToken

func (q *Queries) ConsumeExecutorEnrollmentToken(ctx context.Context, selector string) (int64, error)

func (*Queries) CreateDebuglet

func (q *Queries) CreateDebuglet(ctx context.Context, arg CreateDebugletParams) (Debuglet, error)

func (*Queries) CreateDebugletLog

func (q *Queries) CreateDebugletLog(ctx context.Context, arg CreateDebugletLogParams) (DebugletLog, error)

func (*Queries) CreateDebugletOrder

func (q *Queries) CreateDebugletOrder(ctx context.Context, arg CreateDebugletOrderParams) (DebugletOrder, error)

func (*Queries) CreateEarnings

func (q *Queries) CreateEarnings(ctx context.Context, arg CreateEarningsParams) (Earning, error)

func (*Queries) CreateExecutorEnrollmentToken

func (q *Queries) CreateExecutorEnrollmentToken(ctx context.Context, arg CreateExecutorEnrollmentTokenParams) error

func (*Queries) CreateOAuthIdentity

func (q *Queries) CreateOAuthIdentity(ctx context.Context, arg CreateOAuthIdentityParams) error

func (*Queries) CreateSession

func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) error

func (*Queries) CreateTransaction

func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)

func (*Queries) CreateUser

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

func (*Queries) CreateUserWithRole

func (q *Queries) CreateUserWithRole(ctx context.Context, arg CreateUserWithRoleParams) (User, error)

func (*Queries) DeleteExecutorEnrollment

func (q *Queries) DeleteExecutorEnrollment(ctx context.Context, executorID string) (int64, error)

func (*Queries) DeleteExecutorEnrollmentTokens

func (q *Queries) DeleteExecutorEnrollmentTokens(ctx context.Context, executorID string) (int64, error)

func (*Queries) DeleteExpiredSessions

func (q *Queries) DeleteExpiredSessions(ctx context.Context, before models.UTCTime) error

func (*Queries) GetAdmittedRuns

func (q *Queries) GetAdmittedRuns(ctx context.Context, transactionID string) ([]GetAdmittedRunsRow, error)

func (*Queries) GetDebugletByUUID

func (q *Queries) GetDebugletByUUID(ctx context.Context, argUuid uuid.UUID) (Debuglet, error)

func (*Queries) GetDebugletIdentityByUUID

func (q *Queries) GetDebugletIdentityByUUID(ctx context.Context, argUuid uuid.UUID) (GetDebugletIdentityByUUIDRow, error)

func (*Queries) GetDebugletOrder

func (q *Queries) GetDebugletOrder(ctx context.Context, arg GetDebugletOrderParams) (DebugletOrder, error)

func (*Queries) GetDebugletOwnerUUID

func (q *Queries) GetDebugletOwnerUUID(ctx context.Context, argUuid uuid.UUID) (uuid.UUID, error)

func (*Queries) GetEarnings

func (q *Queries) GetEarnings(ctx context.Context) ([]Earning, error)

func (*Queries) GetEarningsIn

func (q *Queries) GetEarningsIn(ctx context.Context, arg GetEarningsInParams) (Earning, error)

func (*Queries) GetEarningsOf

func (q *Queries) GetEarningsOf(ctx context.Context, executorID string) ([]Earning, error)

func (*Queries) GetExecutorEnrollment

func (q *Queries) GetExecutorEnrollment(ctx context.Context, executorID string) (string, error)

func (*Queries) GetExecutorEnrollmentToken

func (q *Queries) GetExecutorEnrollmentToken(ctx context.Context, selector string) (GetExecutorEnrollmentTokenRow, error)

func (*Queries) GetOAuthIdentity

func (q *Queries) GetOAuthIdentity(ctx context.Context, arg GetOAuthIdentityParams) (int64, error)

func (*Queries) GetOwnedDebugletByUUID

func (q *Queries) GetOwnedDebugletByUUID(ctx context.Context, arg GetOwnedDebugletByUUIDParams) (Debuglet, error)

func (*Queries) GetSessionBySelector

func (q *Queries) GetSessionBySelector(ctx context.Context, selector string) (GetSessionBySelectorRow, error)

func (*Queries) GetTransactionByID

func (q *Queries) GetTransactionByID(ctx context.Context, id string) (Transaction, error)

func (*Queries) GetTransactionOrders

func (q *Queries) GetTransactionOrders(ctx context.Context, transactionID string) ([]DebugletOrder, error)

func (*Queries) GetTransactionOwnerUUID

func (q *Queries) GetTransactionOwnerUUID(ctx context.Context, transactionID string) (uuid.UUID, error)

func (*Queries) GetTransactionState

func (q *Queries) GetTransactionState(ctx context.Context, key string) (TransactionState, error)

func (*Queries) GetUserByUUID

func (q *Queries) GetUserByUUID(ctx context.Context, argUuid uuid.UUID) (User, error)

func (*Queries) GetUserCredential

func (q *Queries) GetUserCredential(ctx context.Context, arg GetUserCredentialParams) (GetUserCredentialRow, error)

func (*Queries) InsertDebugletUser

func (q *Queries) InsertDebugletUser(ctx context.Context, arg InsertDebugletUserParams) error

func (*Queries) ListDebugletLogs

func (q *Queries) ListDebugletLogs(ctx context.Context, arg ListDebugletLogsParams) ([]DebugletLog, error)

func (*Queries) ListDebuglets

func (q *Queries) ListDebuglets(ctx context.Context, arg ListDebugletsParams) ([]Debuglet, error)

func (*Queries) ListDebugletsByUserUUID

func (q *Queries) ListDebugletsByUserUUID(ctx context.Context, arg ListDebugletsByUserUUIDParams) ([]Debuglet, error)

func (*Queries) ListDebugletsEndAfter

func (q *Queries) ListDebugletsEndAfter(ctx context.Context, endTime models.UTCTime) ([]Debuglet, error)

func (*Queries) ListUserUUIDs

func (q *Queries) ListUserUUIDs(ctx context.Context) ([]uuid.UUID, error)

func (*Queries) RevokeSessionBySelector

func (q *Queries) RevokeSessionBySelector(ctx context.Context, selector string) error

func (*Queries) RevokeUserSessions

func (q *Queries) RevokeUserSessions(ctx context.Context, argUuid uuid.UUID) error

func (*Queries) SetExecutorEnrollment

func (q *Queries) SetExecutorEnrollment(ctx context.Context, arg SetExecutorEnrollmentParams) error

func (*Queries) SetRefundAddress

func (q *Queries) SetRefundAddress(ctx context.Context, arg SetRefundAddressParams) error

func (*Queries) SetTransactionOwner

func (q *Queries) SetTransactionOwner(ctx context.Context, arg SetTransactionOwnerParams) error

func (*Queries) SetUserRole

func (q *Queries) SetUserRole(ctx context.Context, arg SetUserRoleParams) (int64, error)

func (*Queries) SettleEarning

func (q *Queries) SettleEarning(ctx context.Context, arg SettleEarningParams) error

func (*Queries) UpdateDebugletOrderState

func (q *Queries) UpdateDebugletOrderState(ctx context.Context, arg UpdateDebugletOrderStateParams) (DebugletOrder, error)

func (*Queries) UpdateDebugletState

func (q *Queries) UpdateDebugletState(ctx context.Context, arg UpdateDebugletStateParams) (Debuglet, error)

func (*Queries) UpdateOAuthIdentityLogin

func (q *Queries) UpdateOAuthIdentityLogin(ctx context.Context, arg UpdateOAuthIdentityLoginParams) error

func (*Queries) UpdateTransactionState

func (q *Queries) UpdateTransactionState(ctx context.Context, arg UpdateTransactionStateParams) (TransactionState, error)

func (*Queries) UpdateTransactionStatus

func (q *Queries) UpdateTransactionStatus(ctx context.Context, arg UpdateTransactionStatusParams) error

func (*Queries) UpsertUserCredential

func (q *Queries) UpsertUserCredential(ctx context.Context, arg UpsertUserCredentialParams) error

func (*Queries) WithTx

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

type Session

type Session struct {
	ID           int64
	Selector     string
	VerifierHash []byte
	CsrfHash     []byte
	UserID       int64
	CreatedAt    models.UTCTime
	ExpiresAt    models.UTCTime
	Revoked      int64
}

type SetExecutorEnrollmentParams

type SetExecutorEnrollmentParams struct {
	ExecutorID  string
	Fingerprint string
	EnrolledAt  models.UTCTime
}

type SetRefundAddressParams

type SetRefundAddressParams struct {
	RefundAddress string
	TransactionID string
	OrderID       int64
}

type SetTransactionOwnerParams

type SetTransactionOwnerParams struct {
	TransactionID string
	Uuid          uuid.UUID
}

type SetUserRoleParams

type SetUserRoleParams struct {
	Role string
	Uuid uuid.UUID
}

type SettleEarningParams

type SettleEarningParams struct {
	ExecutorID string
	Currency   string
}

type Transaction

type Transaction struct {
	ID        string
	AuthKey   string
	Price     int64
	Method    string
	ExpiresAt models.UTCTime
	Hash      string
	Currency  string
	Status    int64
}

type TransactionState

type TransactionState struct {
	Key   string
	Value string
}

type TransactionUser

type TransactionUser struct {
	TransactionID string
	UserID        int64
}

type UpdateDebugletOrderStateParams

type UpdateDebugletOrderStateParams struct {
	State         int64
	TransactionID string
	OrderID       int64
}

type UpdateDebugletStateParams

type UpdateDebugletStateParams struct {
	State                 models.DebugletRunState
	Uuid                  uuid.UUID
	ExitedState           models.DebugletRunState
	StateRank             models.DebugletRunState
	ExecutorID            string
	DispatcherIncarnation string
	SessionID             string
}

type UpdateOAuthIdentityLoginParams

type UpdateOAuthIdentityLoginParams struct {
	Login     string
	UpdatedAt models.UTCTime
	Provider  string
	Subject   string
}

type UpdateTransactionStateParams

type UpdateTransactionStateParams struct {
	Key   string
	Value string
}

type UpdateTransactionStatusParams

type UpdateTransactionStatusParams struct {
	Status int64
	ID     string
}

type UpsertUserCredentialParams

type UpsertUserCredentialParams struct {
	UserID     int64
	Kind       string
	Selector   string
	SecretHash []byte
	CreatedAt  models.UTCTime
}

type User

type User struct {
	ID   int64
	Uuid uuid.UUID
	Name string
	Role string
}

type UserCredential

type UserCredential struct {
	UserID     int64
	Kind       string
	Selector   string
	SecretHash []byte
	CreatedAt  models.UTCTime
}

Jump to

Keyboard shortcuts

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