database

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package database consists of sqlc-generated query functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID          uuid.UUID
	CreatedAt   time.Time
	UpdatedAt   time.Time
	BudgetID    uuid.UUID
	AccountType string
	Name        string
	Notes       string
	IsDeleted   bool
}

type AccountTransfer

type AccountTransfer struct {
	FromTransactionID uuid.UUID
	ToTransactionID   uuid.UUID
}

type AddAccountParams

type AddAccountParams struct {
	BudgetID    uuid.UUID
	AccountType string
	Name        string
	Notes       string
}

type AssignAmountToCategoryParams

type AssignAmountToCategoryParams struct {
	MonthID    time.Time
	CategoryID uuid.UUID
	Amount     int64
}

type AssignBudgetMemberWithRoleParams

type AssignBudgetMemberWithRoleParams struct {
	BudgetID   uuid.UUID
	UserID     uuid.UUID
	MemberRole string
}

type Assignment

type Assignment struct {
	Month      time.Time
	CategoryID uuid.UUID
	Assigned   int64
}

type Budget

type Budget struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	AdminID   uuid.UUID
	Name      string
	Notes     string
}

type Category

type Category struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	BudgetID  uuid.UUID
	Name      string
	GroupID   *uuid.UUID
	Notes     string
}

type CategoryReport

type CategoryReport struct {
	Month        time.Time
	CategoryName string
	CategoryID   uuid.UUID
	BudgetID     uuid.UUID
	Assigned     int64
	Activity     int64
	Balance      int64
}

type CreateBudgetParams

type CreateBudgetParams struct {
	AdminID uuid.UUID
	Name    string
	Notes   string
}

type CreateCategoryParams

type CreateCategoryParams struct {
	BudgetID uuid.UUID
	GroupID  *uuid.UUID
	Name     string
	Notes    string
}

type CreateGroupParams

type CreateGroupParams struct {
	BudgetID uuid.UUID
	Name     string
	Notes    string
}

type CreatePayeeParams

type CreatePayeeParams struct {
	BudgetID uuid.UUID
	Name     string
	Notes    string
}

type CreateRefreshTokenParams

type CreateRefreshTokenParams struct {
	Token     string
	UserID    uuid.UUID
	ExpiresAt time.Time
}

type CreateUserParams

type CreateUserParams struct {
	Username       string
	HashedPassword string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteMonthAssignmentForCatParams

type DeleteMonthAssignmentForCatParams struct {
	Month      time.Time
	CategoryID uuid.UUID
}

type GetBudgetAccountIDAndTypeByNameParams

type GetBudgetAccountIDAndTypeByNameParams struct {
	AccountName string
	BudgetID    uuid.UUID
}

type GetBudgetAccountIDAndTypeByNameRow

type GetBudgetAccountIDAndTypeByNameRow struct {
	ID          uuid.UUID
	AccountType string
}

type GetBudgetAccountIDByNameParams

type GetBudgetAccountIDByNameParams struct {
	AccountName string
	BudgetID    uuid.UUID
}

type GetBudgetCapitalParams

type GetBudgetCapitalParams struct {
	BudgetID    uuid.UUID
	AccountType string
}

type GetBudgetCategoryIDByNameParams

type GetBudgetCategoryIDByNameParams struct {
	CategoryName string
	BudgetID     uuid.UUID
}

type GetBudgetGroupIDByNameParams

type GetBudgetGroupIDByNameParams struct {
	GroupName string
	BudgetID  uuid.UUID
}

type GetBudgetMemberRoleParams

type GetBudgetMemberRoleParams struct {
	BudgetID uuid.UUID
	UserID   uuid.UUID
}

type GetBudgetPayeeIDByNameParams

type GetBudgetPayeeIDByNameParams struct {
	PayeeName string
	BudgetID  uuid.UUID
}

type GetCategoriesParams

type GetCategoriesParams struct {
	BudgetID uuid.UUID
	GroupID  uuid.UUID
}

type GetGroupByIDParams

type GetGroupByIDParams struct {
	BudgetID uuid.UUID
	ID       uuid.UUID
}

type GetMonthCategoryReportParams

type GetMonthCategoryReportParams struct {
	MonthID    time.Time
	CategoryID uuid.UUID
	BudgetID   uuid.UUID
}

type GetMonthCategoryReportRow

type GetMonthCategoryReportRow struct {
	Month        time.Time
	CategoryName string
	CategoryID   uuid.UUID
	BudgetID     uuid.UUID
	Assigned     int64
	Activity     int64
	Balance      int64
	ID           uuid.UUID
	CreatedAt    time.Time
	UpdatedAt    time.Time
	BudgetID_2   uuid.UUID
	Name         string
	GroupID      *uuid.UUID
	Notes        string
}

type GetMonthCategoryReportsParams

type GetMonthCategoryReportsParams struct {
	MonthID  time.Time
	BudgetID uuid.UUID
}

type GetMonthCategoryReportsRow

type GetMonthCategoryReportsRow struct {
	Month        time.Time
	CategoryName string
	CategoryID   uuid.UUID
	BudgetID     uuid.UUID
	Assigned     int64
	Activity     int64
	Balance      int64
	ID           uuid.UUID
	CreatedAt    time.Time
	UpdatedAt    time.Time
	BudgetID_2   uuid.UUID
	Name         string
	GroupID      *uuid.UUID
	Notes        string
}

type GetMonthReportParams

type GetMonthReportParams struct {
	MonthID  time.Time
	BudgetID uuid.UUID
}

type GetMonthReportRow

type GetMonthReportRow struct {
	Assigned int64
	Activity int64
	Balance  int64
}

type GetTransactionDetailsParams

type GetTransactionDetailsParams struct {
	BudgetID   uuid.UUID
	AccountID  uuid.UUID
	PayeeID    uuid.UUID
	CategoryID uuid.UUID
	StartDate  time.Time
	EndDate    time.Time
}

type GetTransactionsParams

type GetTransactionsParams struct {
	BudgetID   uuid.UUID
	AccountID  uuid.UUID
	PayeeID    uuid.UUID
	CategoryID uuid.UUID
	StartDate  time.Time
	EndDate    time.Time
}

type GetUserBudgetsParams

type GetUserBudgetsParams struct {
	UserID uuid.UUID
	Roles  []string
}

type Group

type Group struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	BudgetID  uuid.UUID
	Name      string
	Notes     string
}

type LogAccountTransferParams

type LogAccountTransferParams struct {
	FromTransactionID uuid.UUID
	ToTransactionID   uuid.UUID
}

type LogTransactionParams

type LogTransactionParams struct {
	BudgetID        uuid.UUID
	LoggerID        uuid.UUID
	AccountID       uuid.UUID
	TransactionType string
	TransactionDate time.Time
	PayeeID         uuid.UUID
	Notes           string
	Cleared         bool
}

type LogTransactionSplitsParams

type LogTransactionSplitsParams struct {
	TransactionID uuid.UUID
	Amounts       []byte
}

type Membership

type Membership struct {
	CreatedAt  time.Time
	UpdatedAt  time.Time
	BudgetID   uuid.UUID
	UserID     uuid.UUID
	MemberRole string
}

type Payee

type Payee struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	BudgetID  uuid.UUID
	Name      string
	Notes     string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddAccount

func (q *Queries) AddAccount(ctx context.Context, arg AddAccountParams) (Account, error)

func (*Queries) AssignAmountToCategory

func (q *Queries) AssignAmountToCategory(ctx context.Context, arg AssignAmountToCategoryParams) (Assignment, error)

func (*Queries) AssignBudgetMemberWithRole

func (q *Queries) AssignBudgetMemberWithRole(ctx context.Context, arg AssignBudgetMemberWithRoleParams) (Membership, error)

func (*Queries) CreateBudget

func (q *Queries) CreateBudget(ctx context.Context, arg CreateBudgetParams) (Budget, error)

func (*Queries) CreateCategory

func (q *Queries) CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)

func (*Queries) CreateGroup

func (q *Queries) CreateGroup(ctx context.Context, arg CreateGroupParams) (Group, error)

GROUP CRUD

func (*Queries) CreatePayee

func (q *Queries) CreatePayee(ctx context.Context, arg CreatePayeeParams) (Payee, error)

func (*Queries) CreateRefreshToken

func (q *Queries) CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshToken, error)

TOKEN CRUD

func (*Queries) CreateUser

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

USER CRUD

func (*Queries) DeleteAccountHard

func (q *Queries) DeleteAccountHard(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteAccountSoft

func (q *Queries) DeleteAccountSoft(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteBudget

func (q *Queries) DeleteBudget(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteCategoryByID

func (q *Queries) DeleteCategoryByID(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteGroupByID

func (q *Queries) DeleteGroupByID(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteMonthAssignmentForCat

func (q *Queries) DeleteMonthAssignmentForCat(ctx context.Context, arg DeleteMonthAssignmentForCatParams) error

func (*Queries) DeletePayee

func (q *Queries) DeletePayee(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteTransaction

func (q *Queries) DeleteTransaction(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteTransactionSplits

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

func (*Queries) DeleteUserByID

func (q *Queries) DeleteUserByID(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteUsers

func (q *Queries) DeleteUsers(ctx context.Context) error

func (*Queries) GetAccountByID

func (q *Queries) GetAccountByID(ctx context.Context, id uuid.UUID) (Account, error)

func (*Queries) GetAccountsFromBudget

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

func (*Queries) GetAllUsers

func (q *Queries) GetAllUsers(ctx context.Context) ([]User, error)

func (*Queries) GetBudgetAccountCapital

func (q *Queries) GetBudgetAccountCapital(ctx context.Context, accountID uuid.UUID) (int64, error)

func (*Queries) GetBudgetAccountIDByName

func (q *Queries) GetBudgetAccountIDByName(ctx context.Context, arg GetBudgetAccountIDByNameParams) (uuid.UUID, error)

RESOURCE ID RETRIEVAL

func (*Queries) GetBudgetByID

func (q *Queries) GetBudgetByID(ctx context.Context, id uuid.UUID) (Budget, error)

func (*Queries) GetBudgetCapital

func (q *Queries) GetBudgetCapital(ctx context.Context, arg GetBudgetCapitalParams) (int64, error)

func (*Queries) GetBudgetCategoryIDByName

func (q *Queries) GetBudgetCategoryIDByName(ctx context.Context, arg GetBudgetCategoryIDByNameParams) (uuid.UUID, error)

func (*Queries) GetBudgetGroupIDByName

func (q *Queries) GetBudgetGroupIDByName(ctx context.Context, arg GetBudgetGroupIDByNameParams) (uuid.UUID, error)

func (*Queries) GetBudgetMemberRole

func (q *Queries) GetBudgetMemberRole(ctx context.Context, arg GetBudgetMemberRoleParams) (string, error)

func (*Queries) GetBudgetPayeeIDByName

func (q *Queries) GetBudgetPayeeIDByName(ctx context.Context, arg GetBudgetPayeeIDByNameParams) (uuid.UUID, error)

func (*Queries) GetBudgetPayees

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

func (*Queries) GetCategories

func (q *Queries) GetCategories(ctx context.Context, arg GetCategoriesParams) ([]Category, error)

func (*Queries) GetCategoryByID

func (q *Queries) GetCategoryByID(ctx context.Context, id uuid.UUID) (Category, error)

func (*Queries) GetGroupByID

func (q *Queries) GetGroupByID(ctx context.Context, arg GetGroupByIDParams) (Group, error)

func (*Queries) GetGroupsByBudgetID

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

func (*Queries) GetLinkedTransaction

func (q *Queries) GetLinkedTransaction(ctx context.Context, fromTransactionID uuid.UUID) (Transaction, error)

func (*Queries) GetMonthCategoryReport

func (q *Queries) GetMonthCategoryReport(ctx context.Context, arg GetMonthCategoryReportParams) (GetMonthCategoryReportRow, error)

func (*Queries) GetMonthCategoryReports

func (q *Queries) GetMonthCategoryReports(ctx context.Context, arg GetMonthCategoryReportsParams) ([]GetMonthCategoryReportsRow, error)

func (*Queries) GetMonthReport

func (q *Queries) GetMonthReport(ctx context.Context, arg GetMonthReportParams) (GetMonthReportRow, error)

func (*Queries) GetPayeeByID

func (q *Queries) GetPayeeByID(ctx context.Context, id uuid.UUID) (Payee, error)

func (*Queries) GetSplitsByTransactionID

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

func (*Queries) GetTransactionByID

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

func (*Queries) GetTransactionDetails

func (q *Queries) GetTransactionDetails(ctx context.Context, arg GetTransactionDetailsParams) ([]TransactionDetail, error)

HACK: When it comes to nullable values, sqlc seems to have a difficult time inferring any sort of nullability on query parameters. This zero-value approach ensures that the zero-value UUIDs and timestamps passed to the query are properly compared.

func (*Queries) GetTransactionDetailsByID

func (q *Queries) GetTransactionDetailsByID(ctx context.Context, id uuid.UUID) (TransactionDetail, error)

func (*Queries) GetTransactions

func (q *Queries) GetTransactions(ctx context.Context, arg GetTransactionsParams) ([]Transaction, error)

func (*Queries) GetUserBudgets

func (q *Queries) GetUserBudgets(ctx context.Context, arg GetUserBudgetsParams) ([]Budget, error)

func (*Queries) GetUserByRefreshToken

func (q *Queries) GetUserByRefreshToken(ctx context.Context, token string) (User, error)

func (*Queries) GetUserByUsername

func (q *Queries) GetUserByUsername(ctx context.Context, username string) (User, error)

func (*Queries) GetUserCount

func (q *Queries) GetUserCount(ctx context.Context) (int64, error)

USER ACTIONS

func (*Queries) IsPayeeInUse

func (q *Queries) IsPayeeInUse(ctx context.Context, payeeID uuid.UUID) (bool, error)

func (*Queries) LogAccountTransfer

func (q *Queries) LogAccountTransfer(ctx context.Context, arg LogAccountTransferParams) (AccountTransfer, error)

func (*Queries) LogTransaction

func (q *Queries) LogTransaction(ctx context.Context, arg LogTransactionParams) (Transaction, error)

func (*Queries) LogTransactionSplits

func (q *Queries) LogTransactionSplits(ctx context.Context, arg LogTransactionSplitsParams) ([]TransactionSplit, error)

func (*Queries) ReassignTransactions

func (q *Queries) ReassignTransactions(ctx context.Context, arg ReassignTransactionsParams) error

func (*Queries) RestoreAccount

func (q *Queries) RestoreAccount(ctx context.Context, id uuid.UUID) error

func (*Queries) RevokeBudgetMembership

func (q *Queries) RevokeBudgetMembership(ctx context.Context, arg RevokeBudgetMembershipParams) error

func (*Queries) RevokeRefreshToken

func (q *Queries) RevokeRefreshToken(ctx context.Context, token string) error

func (*Queries) UpdateAccount

func (q *Queries) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Account, error)

func (*Queries) UpdateBudget

func (q *Queries) UpdateBudget(ctx context.Context, arg UpdateBudgetParams) (Budget, error)

func (*Queries) UpdateCategory

func (q *Queries) UpdateCategory(ctx context.Context, arg UpdateCategoryParams) (Category, error)

func (*Queries) UpdateGroup

func (q *Queries) UpdateGroup(ctx context.Context, arg UpdateGroupParams) (Group, error)

func (*Queries) UpdatePayee

func (q *Queries) UpdatePayee(ctx context.Context, arg UpdatePayeeParams) (Payee, error)

func (*Queries) UpdateTransaction

func (q *Queries) UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) error

func (*Queries) UpdateUserCredentials

func (q *Queries) UpdateUserCredentials(ctx context.Context, arg UpdateUserCredentialsParams) (User, error)

func (*Queries) WithTx

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

type ReassignTransactionsParams

type ReassignTransactionsParams struct {
	NewPayeeID uuid.UUID
	OldPayeeID uuid.UUID
}

type RefreshToken

type RefreshToken struct {
	Token     string
	CreatedAt time.Time
	UpdatedAt time.Time
	UserID    uuid.UUID
	ExpiresAt time.Time
	RevokedAt pgtype.Timestamp
}

type RevokeBudgetMembershipParams

type RevokeBudgetMembershipParams struct {
	BudgetID uuid.UUID
	UserID   uuid.UUID
}

type Transaction

type Transaction struct {
	ID              uuid.UUID
	CreatedAt       time.Time
	UpdatedAt       time.Time
	BudgetID        uuid.UUID
	LoggerID        uuid.UUID
	AccountID       uuid.UUID
	TransactionType string
	TransactionDate time.Time
	PayeeID         uuid.UUID
	Notes           string
	Cleared         bool
}

type TransactionDetail

type TransactionDetail struct {
	ID              uuid.UUID
	TransactionDate time.Time
	TransactionType string
	Notes           string
	PayeeName       string
	BudgetName      pgtype.Text
	AccountName     pgtype.Text
	LoggerName      pgtype.Text
	TotalAmount     int64
	Splits          []byte
	Cleared         bool
}

type TransactionSplit

type TransactionSplit struct {
	ID            uuid.UUID
	TransactionID uuid.UUID
	CategoryID    *uuid.UUID
	Amount        int64
}

type UpdateAccountParams

type UpdateAccountParams struct {
	ID          uuid.UUID
	AccountType string
	Name        string
	Notes       string
}

type UpdateBudgetParams

type UpdateBudgetParams struct {
	ID    uuid.UUID
	Name  string
	Notes string
}

type UpdateCategoryParams

type UpdateCategoryParams struct {
	ID      uuid.UUID
	GroupID *uuid.UUID
	Name    string
	Notes   string
}

type UpdateGroupParams

type UpdateGroupParams struct {
	ID    uuid.UUID
	Name  string
	Notes string
}

type UpdatePayeeParams

type UpdatePayeeParams struct {
	ID    uuid.UUID
	Name  string
	Notes string
}

type UpdateTransactionParams

type UpdateTransactionParams struct {
	AccountID       uuid.UUID
	TransactionType string
	TransactionDate time.Time
	PayeeID         uuid.UUID
	Notes           string
	Cleared         bool
	TransactionID   uuid.UUID
}

type UpdateUserCredentialsParams

type UpdateUserCredentialsParams struct {
	ID             uuid.UUID
	Username       string
	HashedPassword string
}

type User

type User struct {
	ID             uuid.UUID
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Username       string
	HashedPassword string
}

Jump to

Keyboard shortcuts

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