sqlc

package
v0.0.0-...-2a62b9b Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID           string             `json:"id"`
	TenantID     string             `json:"tenant_id"`
	UserID       string             `json:"user_id"`
	Name         string             `json:"name"`
	Type         AccountType        `json:"type"`
	Currency     string             `json:"currency"`
	BalanceCents int64              `json:"balance_cents"`
	CreatedAt    pgtype.Timestamptz `json:"created_at"`
	UpdatedAt    pgtype.Timestamptz `json:"updated_at"`
	DeletedAt    pgtype.Timestamptz `json:"deleted_at"`
}

type AccountType

type AccountType string
const (
	AccountTypeChecking   AccountType = "checking"
	AccountTypeSavings    AccountType = "savings"
	AccountTypeCreditCard AccountType = "credit_card"
	AccountTypeInvestment AccountType = "investment"
)

func (*AccountType) Scan

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

type AdminListAllAuditLogsParams

type AdminListAllAuditLogsParams struct {
	EntityType pgtype.Text        `json:"entity_type"`
	EntityID   pgtype.Text        `json:"entity_id"`
	ActorID    string             `json:"actor_id"`
	Action     NullAuditAction    `json:"action"`
	StartDate  pgtype.Timestamptz `json:"start_date"`
	EndDate    pgtype.Timestamptz `json:"end_date"`
	OffsetOff  int32              `json:"offset_off"`
	LimitOff   int32              `json:"limit_off"`
}

type AdminUpdateTenantPlanParams

type AdminUpdateTenantPlanParams struct {
	ID   string     `json:"id"`
	Plan TenantPlan `json:"plan"`
}

type AuditAction

type AuditAction string
const (
	AuditActionCreate       AuditAction = "create"
	AuditActionUpdate       AuditAction = "update"
	AuditActionSoftDelete   AuditAction = "soft_delete"
	AuditActionRestore      AuditAction = "restore"
	AuditActionLogin        AuditAction = "login"
	AuditActionLoginFailed  AuditAction = "login_failed"
	AuditActionOtpRequested AuditAction = "otp_requested"
	AuditActionOtpVerified  AuditAction = "otp_verified"
)

func (*AuditAction) Scan

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

type AuditLog

type AuditLog struct {
	ID         string             `json:"id"`
	TenantID   string             `json:"tenant_id"`
	ActorID    string             `json:"actor_id"`
	ActorRole  UserRole           `json:"actor_role"`
	Action     AuditAction        `json:"action"`
	EntityType string             `json:"entity_type"`
	EntityID   pgtype.Text        `json:"entity_id"`
	OldValues  []byte             `json:"old_values"`
	NewValues  []byte             `json:"new_values"`
	IpAddress  *netip.Addr        `json:"ip_address"`
	UserAgent  pgtype.Text        `json:"user_agent"`
	CreatedAt  pgtype.Timestamptz `json:"created_at"`
}

type Category

type Category struct {
	ID        string             `json:"id"`
	TenantID  string             `json:"tenant_id"`
	ParentID  pgtype.Text        `json:"parent_id"`
	Name      string             `json:"name"`
	Icon      pgtype.Text        `json:"icon"`
	Color     pgtype.Text        `json:"color"`
	Type      CategoryType       `json:"type"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type CategoryType

type CategoryType string
const (
	CategoryTypeIncome   CategoryType = "income"
	CategoryTypeExpense  CategoryType = "expense"
	CategoryTypeTransfer CategoryType = "transfer"
)

func (*CategoryType) Scan

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

type CreateAccountParams

type CreateAccountParams struct {
	ID           string      `json:"id"`
	TenantID     string      `json:"tenant_id"`
	UserID       string      `json:"user_id"`
	Name         string      `json:"name"`
	Type         AccountType `json:"type"`
	Currency     string      `json:"currency"`
	BalanceCents int64       `json:"balance_cents"`
}

type CreateAuditLogParams

type CreateAuditLogParams struct {
	ID         string      `json:"id"`
	TenantID   string      `json:"tenant_id"`
	ActorID    string      `json:"actor_id"`
	ActorRole  UserRole    `json:"actor_role"`
	Action     AuditAction `json:"action"`
	EntityType string      `json:"entity_type"`
	EntityID   pgtype.Text `json:"entity_id"`
	OldValues  []byte      `json:"old_values"`
	NewValues  []byte      `json:"new_values"`
	IpAddress  *netip.Addr `json:"ip_address"`
	UserAgent  pgtype.Text `json:"user_agent"`
}

type CreateCategoryParams

type CreateCategoryParams struct {
	ID       string       `json:"id"`
	TenantID string       `json:"tenant_id"`
	ParentID pgtype.Text  `json:"parent_id"`
	Name     string       `json:"name"`
	Icon     pgtype.Text  `json:"icon"`
	Color    pgtype.Text  `json:"color"`
	Type     CategoryType `json:"type"`
}

type CreateOTPRequestParams

type CreateOTPRequestParams struct {
	ID        string             `json:"id"`
	Email     string             `json:"email"`
	CodeHash  string             `json:"code_hash"`
	Used      bool               `json:"used"`
	ExpiresAt pgtype.Timestamptz `json:"expires_at"`
}

type CreateTenantParams

type CreateTenantParams struct {
	ID   string     `json:"id"`
	Name string     `json:"name"`
	Plan TenantPlan `json:"plan"`
}

type CreateTransactionParams

type CreateTransactionParams struct {
	ID               string             `json:"id"`
	TenantID         string             `json:"tenant_id"`
	AccountID        string             `json:"account_id"`
	CategoryID       string             `json:"category_id"`
	UserID           string             `json:"user_id"`
	MasterPurchaseID pgtype.Text        `json:"master_purchase_id"`
	Description      string             `json:"description"`
	AmountCents      int64              `json:"amount_cents"`
	Type             TransactionType    `json:"type"`
	OccurredAt       pgtype.Timestamptz `json:"occurred_at"`
}

type CreateUserParams

type CreateUserParams struct {
	ID       string   `json:"id"`
	TenantID string   `json:"tenant_id"`
	Email    string   `json:"email"`
	Name     string   `json:"name"`
	Role     UserRole `json:"role"`
}

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 GetAccountByIDParams

type GetAccountByIDParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type GetCategoryByIDParams

type GetCategoryByIDParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type GetTransactionByIDParams

type GetTransactionByIDParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type GetUserByIDParams

type GetUserByIDParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type ListAccountsByUserParams

type ListAccountsByUserParams struct {
	TenantID string `json:"tenant_id"`
	UserID   string `json:"user_id"`
}

type ListAuditLogsByEntityParams

type ListAuditLogsByEntityParams struct {
	TenantID   string      `json:"tenant_id"`
	EntityType string      `json:"entity_type"`
	EntityID   pgtype.Text `json:"entity_id"`
}

type ListAuditLogsByTenantParams

type ListAuditLogsByTenantParams struct {
	TenantID  string `json:"tenant_id"`
	OffsetOff int32  `json:"offset_off"`
	LimitOff  int32  `json:"limit_off"`
}

type ListChildCategoriesParams

type ListChildCategoriesParams struct {
	TenantID string      `json:"tenant_id"`
	ParentID pgtype.Text `json:"parent_id"`
}

type ListTransactionsByTenantParams

type ListTransactionsByTenantParams struct {
	TenantID    string              `json:"tenant_id"`
	AccountID   pgtype.Text         `json:"account_id"`
	CategoryID  pgtype.Text         `json:"category_id"`
	Type        NullTransactionType `json:"type"`
	StartDate   pgtype.Timestamptz  `json:"start_date"`
	EndDate     pgtype.Timestamptz  `json:"end_date"`
	OffsetCount int32               `json:"offset_count"`
	LimitCount  interface{}         `json:"limit_count"`
}

type MasterPurchase

type MasterPurchase struct {
	ID                     string             `json:"id"`
	TenantID               string             `json:"tenant_id"`
	AccountID              string             `json:"account_id"`
	CategoryID             string             `json:"category_id"`
	UserID                 string             `json:"user_id"`
	Description            string             `json:"description"`
	TotalAmountCents       int64              `json:"total_amount_cents"`
	InstallmentCount       int16              `json:"installment_count"`
	InstallmentCents       int64              `json:"installment_cents"`
	FirstDueDate           pgtype.Date        `json:"first_due_date"`
	LastSettledInstallment int16              `json:"last_settled_installment"`
	CreatedAt              pgtype.Timestamptz `json:"created_at"`
	UpdatedAt              pgtype.Timestamptz `json:"updated_at"`
	DeletedAt              pgtype.Timestamptz `json:"deleted_at"`
}

type NullAccountType

type NullAccountType struct {
	AccountType AccountType `json:"account_type"`
	Valid       bool        `json:"valid"` // Valid is true if AccountType is not NULL
}

func (*NullAccountType) Scan

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

Scan implements the Scanner interface.

func (NullAccountType) Value

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

Value implements the driver Valuer interface.

type NullAuditAction

type NullAuditAction struct {
	AuditAction AuditAction `json:"audit_action"`
	Valid       bool        `json:"valid"` // Valid is true if AuditAction is not NULL
}

func (*NullAuditAction) Scan

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

Scan implements the Scanner interface.

func (NullAuditAction) Value

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

Value implements the driver Valuer interface.

type NullCategoryType

type NullCategoryType struct {
	CategoryType CategoryType `json:"category_type"`
	Valid        bool         `json:"valid"` // Valid is true if CategoryType is not NULL
}

func (*NullCategoryType) Scan

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

Scan implements the Scanner interface.

func (NullCategoryType) Value

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

Value implements the driver Valuer interface.

type NullTenantPlan

type NullTenantPlan struct {
	TenantPlan TenantPlan `json:"tenant_plan"`
	Valid      bool       `json:"valid"` // Valid is true if TenantPlan is not NULL
}

func (*NullTenantPlan) Scan

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

Scan implements the Scanner interface.

func (NullTenantPlan) Value

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

Value implements the driver Valuer interface.

type NullTransactionType

type NullTransactionType struct {
	TransactionType TransactionType `json:"transaction_type"`
	Valid           bool            `json:"valid"` // Valid is true if TransactionType is not NULL
}

func (*NullTransactionType) Scan

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

Scan implements the Scanner interface.

func (NullTransactionType) Value

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

Value implements the driver Valuer interface.

type NullUserRole

type NullUserRole struct {
	UserRole UserRole `json:"user_role"`
	Valid    bool     `json:"valid"` // Valid is true if UserRole is not NULL
}

func (*NullUserRole) Scan

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

Scan implements the Scanner interface.

func (NullUserRole) Value

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

Value implements the driver Valuer interface.

type OtpRequest

type OtpRequest struct {
	ID        string             `json:"id"`
	Email     string             `json:"email"`
	CodeHash  string             `json:"code_hash"`
	Used      bool               `json:"used"`
	ExpiresAt pgtype.Timestamptz `json:"expires_at"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type Querier

type Querier interface {
	AdminForceDeleteUser(ctx context.Context, id string) error
	AdminGetTenantByID(ctx context.Context, id string) (Tenant, error)
	AdminGetUserByID(ctx context.Context, id string) (User, error)
	AdminHardDeleteTenant(ctx context.Context, id string) error
	AdminListAllAuditLogs(ctx context.Context, arg AdminListAllAuditLogsParams) ([]AuditLog, error)
	AdminListAllTenants(ctx context.Context, withDeleted bool) ([]Tenant, error)
	AdminListAllUsers(ctx context.Context) ([]User, error)
	AdminRestoreTenant(ctx context.Context, id string) error
	AdminSuspendTenant(ctx context.Context, id string) error
	AdminUpdateTenantPlan(ctx context.Context, arg AdminUpdateTenantPlanParams) (Tenant, error)
	CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
	CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)
	CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)
	CreateOTPRequest(ctx context.Context, arg CreateOTPRequestParams) (OtpRequest, error)
	CreateTenant(ctx context.Context, arg CreateTenantParams) (Tenant, error)
	CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	DeleteExpiredOTPs(ctx context.Context) error
	GetAccountByID(ctx context.Context, arg GetAccountByIDParams) (Account, error)
	GetActiveOTPByEmail(ctx context.Context, email string) (OtpRequest, error)
	GetCategoryByID(ctx context.Context, arg GetCategoryByIDParams) (Category, error)
	GetTenantByID(ctx context.Context, id string) (Tenant, error)
	GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)
	GetUserByEmail(ctx context.Context, email string) (User, error)
	GetUserByID(ctx context.Context, arg GetUserByIDParams) (User, error)
	ListAccountsByTenant(ctx context.Context, tenantID string) ([]Account, error)
	ListAccountsByUser(ctx context.Context, arg ListAccountsByUserParams) ([]Account, error)
	ListAuditLogsByEntity(ctx context.Context, arg ListAuditLogsByEntityParams) ([]AuditLog, error)
	ListAuditLogsByTenant(ctx context.Context, arg ListAuditLogsByTenantParams) ([]AuditLog, error)
	ListCategoriesByTenant(ctx context.Context, tenantID string) ([]Category, error)
	ListChildCategories(ctx context.Context, arg ListChildCategoriesParams) ([]Category, error)
	ListTenants(ctx context.Context) ([]Tenant, error)
	ListTransactionsByTenant(ctx context.Context, arg ListTransactionsByTenantParams) ([]Transaction, error)
	ListUsersByTenant(ctx context.Context, tenantID string) ([]User, error)
	MarkOTPUsed(ctx context.Context, id string) error
	SoftDeleteAccount(ctx context.Context, arg SoftDeleteAccountParams) error
	SoftDeleteCategory(ctx context.Context, arg SoftDeleteCategoryParams) error
	SoftDeleteTenant(ctx context.Context, id string) error
	SoftDeleteTransaction(ctx context.Context, arg SoftDeleteTransactionParams) error
	SoftDeleteUser(ctx context.Context, arg SoftDeleteUserParams) error
	UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Account, error)
	UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) error
	UpdateCategory(ctx context.Context, arg UpdateCategoryParams) (Category, error)
	UpdateTenant(ctx context.Context, arg UpdateTenantParams) (Tenant, error)
	UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
	UpdateUserLastLogin(ctx context.Context, id string) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AdminForceDeleteUser

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

func (*Queries) AdminGetTenantByID

func (q *Queries) AdminGetTenantByID(ctx context.Context, id string) (Tenant, error)

func (*Queries) AdminGetUserByID

func (q *Queries) AdminGetUserByID(ctx context.Context, id string) (User, error)

func (*Queries) AdminHardDeleteTenant

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

func (*Queries) AdminListAllAuditLogs

func (q *Queries) AdminListAllAuditLogs(ctx context.Context, arg AdminListAllAuditLogsParams) ([]AuditLog, error)

func (*Queries) AdminListAllTenants

func (q *Queries) AdminListAllTenants(ctx context.Context, withDeleted bool) ([]Tenant, error)

func (*Queries) AdminListAllUsers

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

func (*Queries) AdminRestoreTenant

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

func (*Queries) AdminSuspendTenant

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

func (*Queries) AdminUpdateTenantPlan

func (q *Queries) AdminUpdateTenantPlan(ctx context.Context, arg AdminUpdateTenantPlanParams) (Tenant, error)

func (*Queries) CreateAccount

func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)

func (*Queries) CreateAuditLog

func (q *Queries) CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)

func (*Queries) CreateCategory

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

func (*Queries) CreateOTPRequest

func (q *Queries) CreateOTPRequest(ctx context.Context, arg CreateOTPRequestParams) (OtpRequest, error)

func (*Queries) CreateTenant

func (q *Queries) CreateTenant(ctx context.Context, arg CreateTenantParams) (Tenant, 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) DeleteExpiredOTPs

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

func (*Queries) GetAccountByID

func (q *Queries) GetAccountByID(ctx context.Context, arg GetAccountByIDParams) (Account, error)

func (*Queries) GetActiveOTPByEmail

func (q *Queries) GetActiveOTPByEmail(ctx context.Context, email string) (OtpRequest, error)

func (*Queries) GetCategoryByID

func (q *Queries) GetCategoryByID(ctx context.Context, arg GetCategoryByIDParams) (Category, error)

func (*Queries) GetTenantByID

func (q *Queries) GetTenantByID(ctx context.Context, id string) (Tenant, error)

func (*Queries) GetTransactionByID

func (q *Queries) GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)

func (*Queries) GetUserByEmail

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

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, arg GetUserByIDParams) (User, error)

func (*Queries) ListAccountsByTenant

func (q *Queries) ListAccountsByTenant(ctx context.Context, tenantID string) ([]Account, error)

func (*Queries) ListAccountsByUser

func (q *Queries) ListAccountsByUser(ctx context.Context, arg ListAccountsByUserParams) ([]Account, error)

func (*Queries) ListAuditLogsByEntity

func (q *Queries) ListAuditLogsByEntity(ctx context.Context, arg ListAuditLogsByEntityParams) ([]AuditLog, error)

func (*Queries) ListAuditLogsByTenant

func (q *Queries) ListAuditLogsByTenant(ctx context.Context, arg ListAuditLogsByTenantParams) ([]AuditLog, error)

func (*Queries) ListCategoriesByTenant

func (q *Queries) ListCategoriesByTenant(ctx context.Context, tenantID string) ([]Category, error)

func (*Queries) ListChildCategories

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

func (*Queries) ListTenants

func (q *Queries) ListTenants(ctx context.Context) ([]Tenant, error)

func (*Queries) ListTransactionsByTenant

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

func (*Queries) ListUsersByTenant

func (q *Queries) ListUsersByTenant(ctx context.Context, tenantID string) ([]User, error)

func (*Queries) MarkOTPUsed

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

func (*Queries) SoftDeleteAccount

func (q *Queries) SoftDeleteAccount(ctx context.Context, arg SoftDeleteAccountParams) error

func (*Queries) SoftDeleteCategory

func (q *Queries) SoftDeleteCategory(ctx context.Context, arg SoftDeleteCategoryParams) error

func (*Queries) SoftDeleteTenant

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

func (*Queries) SoftDeleteTransaction

func (q *Queries) SoftDeleteTransaction(ctx context.Context, arg SoftDeleteTransactionParams) error

func (*Queries) SoftDeleteUser

func (q *Queries) SoftDeleteUser(ctx context.Context, arg SoftDeleteUserParams) error

func (*Queries) UpdateAccount

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

func (*Queries) UpdateAccountBalance

func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) error

func (*Queries) UpdateCategory

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

func (*Queries) UpdateTenant

func (q *Queries) UpdateTenant(ctx context.Context, arg UpdateTenantParams) (Tenant, error)

func (*Queries) UpdateTransaction

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

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)

func (*Queries) UpdateUserLastLogin

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

func (*Queries) WithTx

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

type SoftDeleteAccountParams

type SoftDeleteAccountParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type SoftDeleteCategoryParams

type SoftDeleteCategoryParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type SoftDeleteTransactionParams

type SoftDeleteTransactionParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type SoftDeleteUserParams

type SoftDeleteUserParams struct {
	TenantID string `json:"tenant_id"`
	ID       string `json:"id"`
}

type Tenant

type Tenant struct {
	ID        string             `json:"id"`
	Name      string             `json:"name"`
	Plan      TenantPlan         `json:"plan"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	UpdatedAt pgtype.Timestamptz `json:"updated_at"`
	DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}

type TenantPlan

type TenantPlan string
const (
	TenantPlanFree    TenantPlan = "free"
	TenantPlanBasic   TenantPlan = "basic"
	TenantPlanPremium TenantPlan = "premium"
)

func (*TenantPlan) Scan

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

type Transaction

type Transaction struct {
	ID               string             `json:"id"`
	TenantID         string             `json:"tenant_id"`
	AccountID        string             `json:"account_id"`
	CategoryID       string             `json:"category_id"`
	UserID           string             `json:"user_id"`
	MasterPurchaseID pgtype.Text        `json:"master_purchase_id"`
	Description      string             `json:"description"`
	AmountCents      int64              `json:"amount_cents"`
	Type             TransactionType    `json:"type"`
	OccurredAt       pgtype.Timestamptz `json:"occurred_at"`
	CreatedAt        pgtype.Timestamptz `json:"created_at"`
	UpdatedAt        pgtype.Timestamptz `json:"updated_at"`
	DeletedAt        pgtype.Timestamptz `json:"deleted_at"`
}

type TransactionType

type TransactionType string
const (
	TransactionTypeIncome   TransactionType = "income"
	TransactionTypeExpense  TransactionType = "expense"
	TransactionTypeTransfer TransactionType = "transfer"
)

func (*TransactionType) Scan

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

type UpdateAccountBalanceParams

type UpdateAccountBalanceParams struct {
	TenantID     string `json:"tenant_id"`
	ID           string `json:"id"`
	BalanceCents int64  `json:"balance_cents"`
}

type UpdateAccountParams

type UpdateAccountParams struct {
	TenantID string      `json:"tenant_id"`
	ID       string      `json:"id"`
	Name     string      `json:"name"`
	Type     AccountType `json:"type"`
	Currency string      `json:"currency"`
}

type UpdateCategoryParams

type UpdateCategoryParams struct {
	ParentID pgtype.Text  `json:"parent_id"`
	Name     string       `json:"name"`
	Icon     pgtype.Text  `json:"icon"`
	Color    pgtype.Text  `json:"color"`
	Type     CategoryType `json:"type"`
	TenantID string       `json:"tenant_id"`
	ID       string       `json:"id"`
}

type UpdateTenantParams

type UpdateTenantParams struct {
	ID   string     `json:"id"`
	Name string     `json:"name"`
	Plan TenantPlan `json:"plan"`
}

type UpdateTransactionParams

type UpdateTransactionParams struct {
	TenantID    string             `json:"tenant_id"`
	ID          string             `json:"id"`
	AccountID   string             `json:"account_id"`
	CategoryID  string             `json:"category_id"`
	Description string             `json:"description"`
	AmountCents int64              `json:"amount_cents"`
	Type        TransactionType    `json:"type"`
	OccurredAt  pgtype.Timestamptz `json:"occurred_at"`
}

type UpdateUserParams

type UpdateUserParams struct {
	TenantID string   `json:"tenant_id"`
	ID       string   `json:"id"`
	Email    string   `json:"email"`
	Name     string   `json:"name"`
	Role     UserRole `json:"role"`
}

type User

type User struct {
	ID          string             `json:"id"`
	TenantID    string             `json:"tenant_id"`
	Email       string             `json:"email"`
	Name        string             `json:"name"`
	Role        UserRole           `json:"role"`
	LastLoginAt pgtype.Timestamptz `json:"last_login_at"`
	CreatedAt   pgtype.Timestamptz `json:"created_at"`
	UpdatedAt   pgtype.Timestamptz `json:"updated_at"`
	DeletedAt   pgtype.Timestamptz `json:"deleted_at"`
}

type UserRole

type UserRole string
const (
	UserRoleSysadmin UserRole = "sysadmin"
	UserRoleAdmin    UserRole = "admin"
	UserRoleMember   UserRole = "member"
)

func (*UserRole) Scan

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

Jump to

Keyboard shortcuts

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