Documentation
¶
Index ¶
- type Account
- type AccountType
- type AdminListAllAuditLogsParams
- type AdminUpdateTenantPlanParams
- type Asset
- type AssetType
- type AuditAction
- type AuditLog
- type Category
- type CategoryType
- type CreateAccountParams
- type CreateAssetParams
- type CreateAuditLogParams
- type CreateCategoryParams
- type CreateMasterPurchaseParams
- type CreateOTPRequestParams
- type CreateTenantParams
- type CreateTransactionParams
- type CreateUserParams
- type DBTX
- type DeleteMasterPurchaseParams
- type GetAccountByIDParams
- type GetAssetWithTenantConfigParams
- type GetAssetWithTenantConfigRow
- type GetCategoryByIDParams
- type GetMasterPurchaseByIDParams
- type GetTenantAssetConfigByAssetIDParams
- type GetTransactionByIDParams
- type GetUserByIDParams
- type IncomeType
- type IncrementPaidInstallmentsParams
- type ListAccountsByUserParams
- type ListAuditLogsByEntityParams
- type ListAuditLogsByTenantParams
- type ListChildCategoriesParams
- type ListMasterPurchasesByAccountParams
- type ListPendingMasterPurchasesByClosingDayParams
- type ListTransactionsByTenantParams
- type MasterPurchase
- type MasterPurchaseStatus
- type NullAccountType
- type NullAssetType
- type NullAuditAction
- type NullCategoryType
- type NullIncomeType
- type NullMasterPurchaseStatus
- type NullReceivableStatus
- type NullTenantPlan
- type NullTransactionType
- type NullUserRole
- type OtpRequest
- type PortfolioSnapshot
- type Position
- type PositionIncomeEvent
- type PositionSnapshot
- type Querier
- type Queries
- func (q *Queries) AdminForceDeleteUser(ctx context.Context, id string) error
- func (q *Queries) AdminGetTenantByID(ctx context.Context, id string) (Tenant, error)
- func (q *Queries) AdminGetUserByID(ctx context.Context, id string) (User, error)
- func (q *Queries) AdminHardDeleteTenant(ctx context.Context, id string) error
- func (q *Queries) AdminListAllAuditLogs(ctx context.Context, arg AdminListAllAuditLogsParams) ([]AuditLog, error)
- func (q *Queries) AdminListAllTenants(ctx context.Context, withDeleted bool) ([]Tenant, error)
- func (q *Queries) AdminListAllUsers(ctx context.Context) ([]User, error)
- func (q *Queries) AdminRestoreTenant(ctx context.Context, id string) error
- func (q *Queries) AdminSuspendTenant(ctx context.Context, id string) error
- func (q *Queries) AdminUpdateTenantPlan(ctx context.Context, arg AdminUpdateTenantPlanParams) (Tenant, error)
- func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
- func (q *Queries) CreateAsset(ctx context.Context, arg CreateAssetParams) (Asset, error)
- func (q *Queries) CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)
- func (q *Queries) CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)
- func (q *Queries) CreateMasterPurchase(ctx context.Context, arg CreateMasterPurchaseParams) (MasterPurchase, error)
- func (q *Queries) CreateOTPRequest(ctx context.Context, arg CreateOTPRequestParams) (OtpRequest, error)
- func (q *Queries) CreateTenant(ctx context.Context, arg CreateTenantParams) (Tenant, error)
- func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) DeleteAsset(ctx context.Context, id string) error
- func (q *Queries) DeleteExpiredOTPs(ctx context.Context) error
- func (q *Queries) DeleteMasterPurchase(ctx context.Context, arg DeleteMasterPurchaseParams) error
- func (q *Queries) GetAccountByID(ctx context.Context, arg GetAccountByIDParams) (Account, error)
- func (q *Queries) GetActiveOTPByEmail(ctx context.Context, email string) (OtpRequest, error)
- func (q *Queries) GetAssetByID(ctx context.Context, id string) (Asset, error)
- func (q *Queries) GetAssetByTicker(ctx context.Context, ticker string) (Asset, error)
- func (q *Queries) GetAssetWithTenantConfig(ctx context.Context, arg GetAssetWithTenantConfigParams) (GetAssetWithTenantConfigRow, error)
- func (q *Queries) GetCategoryByID(ctx context.Context, arg GetCategoryByIDParams) (Category, error)
- func (q *Queries) GetMasterPurchaseByID(ctx context.Context, arg GetMasterPurchaseByIDParams) (MasterPurchase, error)
- func (q *Queries) GetTenantAssetConfigByAssetID(ctx context.Context, arg GetTenantAssetConfigByAssetIDParams) (TenantAssetConfig, error)
- func (q *Queries) GetTenantByID(ctx context.Context, id string) (Tenant, error)
- func (q *Queries) GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)
- func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (q *Queries) GetUserByID(ctx context.Context, arg GetUserByIDParams) (User, error)
- func (q *Queries) IncrementPaidInstallments(ctx context.Context, arg IncrementPaidInstallmentsParams) (MasterPurchase, error)
- func (q *Queries) ListAccountsByTenant(ctx context.Context, tenantID string) ([]Account, error)
- func (q *Queries) ListAccountsByUser(ctx context.Context, arg ListAccountsByUserParams) ([]Account, error)
- func (q *Queries) ListAssets(ctx context.Context) ([]Asset, error)
- func (q *Queries) ListAuditLogsByEntity(ctx context.Context, arg ListAuditLogsByEntityParams) ([]AuditLog, error)
- func (q *Queries) ListAuditLogsByTenant(ctx context.Context, arg ListAuditLogsByTenantParams) ([]AuditLog, error)
- func (q *Queries) ListCategoriesByTenant(ctx context.Context, tenantID string) ([]Category, error)
- func (q *Queries) ListChildCategories(ctx context.Context, arg ListChildCategoriesParams) ([]Category, error)
- func (q *Queries) ListMasterPurchasesByAccount(ctx context.Context, arg ListMasterPurchasesByAccountParams) ([]MasterPurchase, error)
- func (q *Queries) ListMasterPurchasesByTenant(ctx context.Context, tenantID string) ([]MasterPurchase, error)
- func (q *Queries) ListPendingMasterPurchasesByClosingDay(ctx context.Context, arg ListPendingMasterPurchasesByClosingDayParams) ([]MasterPurchase, error)
- func (q *Queries) ListTenantAssetConfigs(ctx context.Context, tenantID string) ([]TenantAssetConfig, error)
- func (q *Queries) ListTenants(ctx context.Context) ([]Tenant, error)
- func (q *Queries) ListTransactionsByTenant(ctx context.Context, arg ListTransactionsByTenantParams) ([]Transaction, error)
- func (q *Queries) ListUsersByTenant(ctx context.Context, tenantID string) ([]User, error)
- func (q *Queries) MarkOTPUsed(ctx context.Context, id string) error
- func (q *Queries) SoftDeleteAccount(ctx context.Context, arg SoftDeleteAccountParams) error
- func (q *Queries) SoftDeleteCategory(ctx context.Context, arg SoftDeleteCategoryParams) error
- func (q *Queries) SoftDeleteTenant(ctx context.Context, id string) error
- func (q *Queries) SoftDeleteTenantAssetConfig(ctx context.Context, arg SoftDeleteTenantAssetConfigParams) error
- func (q *Queries) SoftDeleteTransaction(ctx context.Context, arg SoftDeleteTransactionParams) error
- func (q *Queries) SoftDeleteUser(ctx context.Context, arg SoftDeleteUserParams) error
- func (q *Queries) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Account, error)
- func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) error
- func (q *Queries) UpdateCategory(ctx context.Context, arg UpdateCategoryParams) (Category, error)
- func (q *Queries) UpdateMasterPurchase(ctx context.Context, arg UpdateMasterPurchaseParams) (MasterPurchase, error)
- func (q *Queries) UpdateTenant(ctx context.Context, arg UpdateTenantParams) (Tenant, error)
- func (q *Queries) UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
- func (q *Queries) UpdateUserLastLogin(ctx context.Context, id string) error
- func (q *Queries) UpsertTenantAssetConfig(ctx context.Context, arg UpsertTenantAssetConfigParams) (TenantAssetConfig, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type ReceivableStatus
- type SoftDeleteAccountParams
- type SoftDeleteCategoryParams
- type SoftDeleteTenantAssetConfigParams
- type SoftDeleteTransactionParams
- type SoftDeleteUserParams
- type Tenant
- type TenantAssetConfig
- type TenantPlan
- type Transaction
- type TransactionType
- type UpdateAccountBalanceParams
- type UpdateAccountParams
- type UpdateCategoryParams
- type UpdateMasterPurchaseParams
- type UpdateTenantParams
- type UpdateTransactionParams
- type UpdateUserParams
- type UpsertTenantAssetConfigParams
- type User
- type UserRole
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 CreateAssetParams ¶ added in v1.13.0
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 CreateMasterPurchaseParams ¶ added in v1.10.0
type CreateMasterPurchaseParams 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"`
ClosingDay int16 `json:"closing_day"`
FirstInstallmentDate pgtype.Date `json:"first_installment_date"`
}
type CreateOTPRequestParams ¶
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 DeleteMasterPurchaseParams ¶ added in v1.10.0
type GetAccountByIDParams ¶
type GetAssetWithTenantConfigParams ¶ added in v1.13.0
type GetAssetWithTenantConfigRow ¶ added in v1.13.0
type GetAssetWithTenantConfigRow struct {
ID string `json:"id"`
Ticker string `json:"ticker"`
Isin pgtype.Text `json:"isin"`
AssetType AssetType `json:"asset_type"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
Name string `json:"name"`
Currency string `json:"currency"`
Details pgtype.Text `json:"details"`
ConfigID string `json:"config_id"`
TenantAddedAt pgtype.Timestamptz `json:"tenant_added_at"`
}
type GetCategoryByIDParams ¶
type GetMasterPurchaseByIDParams ¶ added in v1.10.0
type GetTenantAssetConfigByAssetIDParams ¶ added in v1.13.0
type GetUserByIDParams ¶
type IncomeType ¶ added in v1.13.0
type IncomeType string
const ( IncomeTypeNone IncomeType = "none" IncomeTypeDividend IncomeType = "dividend" IncomeTypeCoupon IncomeType = "coupon" IncomeTypeRent IncomeType = "rent" IncomeTypeInterest IncomeType = "interest" IncomeTypeSalary IncomeType = "salary" )
func (*IncomeType) Scan ¶ added in v1.13.0
func (e *IncomeType) Scan(src interface{}) error
type IncrementPaidInstallmentsParams ¶ added in v1.10.0
type ListMasterPurchasesByAccountParams ¶ added in v1.10.0
type ListPendingMasterPurchasesByClosingDayParams ¶ added in v1.10.0
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"`
Status MasterPurchaseStatus `json:"status"`
TotalAmountCents int64 `json:"total_amount_cents"`
InstallmentCount int16 `json:"installment_count"`
PaidInstallments int16 `json:"paid_installments"`
ClosingDay int16 `json:"closing_day"`
FirstInstallmentDate pgtype.Date `json:"first_installment_date"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}
type MasterPurchaseStatus ¶ added in v1.10.0
type MasterPurchaseStatus string
const ( MasterPurchaseStatusOpen MasterPurchaseStatus = "open" MasterPurchaseStatusClosed MasterPurchaseStatus = "closed" )
func (*MasterPurchaseStatus) Scan ¶ added in v1.10.0
func (e *MasterPurchaseStatus) Scan(src interface{}) error
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.
type NullAssetType ¶ added in v1.13.0
type NullAssetType struct {
AssetType AssetType `json:"asset_type"`
Valid bool `json:"valid"` // Valid is true if AssetType is not NULL
}
func (*NullAssetType) Scan ¶ added in v1.13.0
func (ns *NullAssetType) Scan(value interface{}) error
Scan implements the Scanner 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.
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.
type NullIncomeType ¶ added in v1.13.0
type NullIncomeType struct {
IncomeType IncomeType `json:"income_type"`
Valid bool `json:"valid"` // Valid is true if IncomeType is not NULL
}
func (*NullIncomeType) Scan ¶ added in v1.13.0
func (ns *NullIncomeType) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullMasterPurchaseStatus ¶ added in v1.10.0
type NullMasterPurchaseStatus struct {
MasterPurchaseStatus MasterPurchaseStatus `json:"master_purchase_status"`
Valid bool `json:"valid"` // Valid is true if MasterPurchaseStatus is not NULL
}
func (*NullMasterPurchaseStatus) Scan ¶ added in v1.10.0
func (ns *NullMasterPurchaseStatus) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullReceivableStatus ¶ added in v1.13.0
type NullReceivableStatus struct {
ReceivableStatus ReceivableStatus `json:"receivable_status"`
Valid bool `json:"valid"` // Valid is true if ReceivableStatus is not NULL
}
func (*NullReceivableStatus) Scan ¶ added in v1.13.0
func (ns *NullReceivableStatus) Scan(value interface{}) error
Scan implements the Scanner 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.
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.
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.
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 PortfolioSnapshot ¶ added in v1.13.0
type PortfolioSnapshot struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
SnapshotDate pgtype.Date `json:"snapshot_date"`
TotalValueCents int64 `json:"total_value_cents"`
TotalIncomeCents int64 `json:"total_income_cents"`
Currency string `json:"currency"`
Details []byte `json:"details"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type Position ¶ added in v1.13.0
type Position struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
AssetID string `json:"asset_id"`
AccountID string `json:"account_id"`
Quantity pgtype.Numeric `json:"quantity"`
AvgCostCents int64 `json:"avg_cost_cents"`
LastPriceCents int64 `json:"last_price_cents"`
Currency string `json:"currency"`
PurchasedAt pgtype.Timestamptz `json:"purchased_at"`
IncomeType IncomeType `json:"income_type"`
IncomeIntervalDays pgtype.Int4 `json:"income_interval_days"`
IncomeAmountCents pgtype.Int8 `json:"income_amount_cents"`
IncomeRateBps pgtype.Int4 `json:"income_rate_bps"`
NextIncomeAt pgtype.Timestamptz `json:"next_income_at"`
MaturityAt pgtype.Timestamptz `json:"maturity_at"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
DeletedAt pgtype.Timestamptz `json:"deleted_at"`
}
type PositionIncomeEvent ¶ added in v1.13.0
type PositionIncomeEvent struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
PositionID string `json:"position_id"`
IncomeType IncomeType `json:"income_type"`
AmountCents int64 `json:"amount_cents"`
Currency string `json:"currency"`
EventDate pgtype.Date `json:"event_date"`
Status ReceivableStatus `json:"status"`
RealizedAt pgtype.Timestamptz `json:"realized_at"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type PositionSnapshot ¶ added in v1.13.0
type PositionSnapshot struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
PositionID string `json:"position_id"`
SnapshotDate pgtype.Date `json:"snapshot_date"`
Quantity pgtype.Numeric `json:"quantity"`
AvgCostCents int64 `json:"avg_cost_cents"`
LastPriceCents int64 `json:"last_price_cents"`
Currency string `json:"currency"`
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)
CreateAsset(ctx context.Context, arg CreateAssetParams) (Asset, error)
CreateAuditLog(ctx context.Context, arg CreateAuditLogParams) (AuditLog, error)
CreateCategory(ctx context.Context, arg CreateCategoryParams) (Category, error)
CreateMasterPurchase(ctx context.Context, arg CreateMasterPurchaseParams) (MasterPurchase, 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)
DeleteAsset(ctx context.Context, id string) error
DeleteExpiredOTPs(ctx context.Context) error
DeleteMasterPurchase(ctx context.Context, arg DeleteMasterPurchaseParams) error
GetAccountByID(ctx context.Context, arg GetAccountByIDParams) (Account, error)
GetActiveOTPByEmail(ctx context.Context, email string) (OtpRequest, error)
GetAssetByID(ctx context.Context, id string) (Asset, error)
GetAssetByTicker(ctx context.Context, ticker string) (Asset, error)
// Returns the global asset with tenant overrides applied via COALESCE.
// Use this query in all asset-display contexts (ADR §2.7).
GetAssetWithTenantConfig(ctx context.Context, arg GetAssetWithTenantConfigParams) (GetAssetWithTenantConfigRow, error)
GetCategoryByID(ctx context.Context, arg GetCategoryByIDParams) (Category, error)
GetMasterPurchaseByID(ctx context.Context, arg GetMasterPurchaseByIDParams) (MasterPurchase, error)
GetTenantAssetConfigByAssetID(ctx context.Context, arg GetTenantAssetConfigByAssetIDParams) (TenantAssetConfig, 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)
IncrementPaidInstallments(ctx context.Context, arg IncrementPaidInstallmentsParams) (MasterPurchase, error)
ListAccountsByTenant(ctx context.Context, tenantID string) ([]Account, error)
ListAccountsByUser(ctx context.Context, arg ListAccountsByUserParams) ([]Account, error)
ListAssets(ctx context.Context) ([]Asset, 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)
ListMasterPurchasesByAccount(ctx context.Context, arg ListMasterPurchasesByAccountParams) ([]MasterPurchase, error)
ListMasterPurchasesByTenant(ctx context.Context, tenantID string) ([]MasterPurchase, error)
ListPendingMasterPurchasesByClosingDay(ctx context.Context, arg ListPendingMasterPurchasesByClosingDayParams) ([]MasterPurchase, error)
ListTenantAssetConfigs(ctx context.Context, tenantID string) ([]TenantAssetConfig, 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
SoftDeleteTenantAssetConfig(ctx context.Context, arg SoftDeleteTenantAssetConfigParams) 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)
UpdateMasterPurchase(ctx context.Context, arg UpdateMasterPurchaseParams) (MasterPurchase, 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
UpsertTenantAssetConfig(ctx context.Context, arg UpsertTenantAssetConfigParams) (TenantAssetConfig, error)
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AdminForceDeleteUser ¶
func (*Queries) AdminGetTenantByID ¶
func (*Queries) AdminGetUserByID ¶
func (*Queries) AdminHardDeleteTenant ¶
func (*Queries) AdminListAllAuditLogs ¶
func (*Queries) AdminListAllTenants ¶
func (*Queries) AdminListAllUsers ¶
func (*Queries) AdminRestoreTenant ¶
func (*Queries) AdminSuspendTenant ¶
func (*Queries) AdminUpdateTenantPlan ¶
func (*Queries) CreateAccount ¶
func (*Queries) CreateAsset ¶ added in v1.13.0
func (*Queries) CreateAuditLog ¶
func (*Queries) CreateCategory ¶
func (*Queries) CreateMasterPurchase ¶ added in v1.10.0
func (q *Queries) CreateMasterPurchase(ctx context.Context, arg CreateMasterPurchaseParams) (MasterPurchase, error)
func (*Queries) CreateOTPRequest ¶
func (q *Queries) CreateOTPRequest(ctx context.Context, arg CreateOTPRequestParams) (OtpRequest, error)
func (*Queries) CreateTenant ¶
func (*Queries) CreateTransaction ¶
func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)
func (*Queries) CreateUser ¶
func (*Queries) DeleteAsset ¶ added in v1.13.0
func (*Queries) DeleteMasterPurchase ¶ added in v1.10.0
func (q *Queries) DeleteMasterPurchase(ctx context.Context, arg DeleteMasterPurchaseParams) error
func (*Queries) GetAccountByID ¶
func (*Queries) GetActiveOTPByEmail ¶
func (*Queries) GetAssetByID ¶ added in v1.13.0
func (*Queries) GetAssetByTicker ¶ added in v1.13.0
func (*Queries) GetAssetWithTenantConfig ¶ added in v1.13.0
func (q *Queries) GetAssetWithTenantConfig(ctx context.Context, arg GetAssetWithTenantConfigParams) (GetAssetWithTenantConfigRow, error)
Returns the global asset with tenant overrides applied via COALESCE. Use this query in all asset-display contexts (ADR §2.7).
func (*Queries) GetCategoryByID ¶
func (*Queries) GetMasterPurchaseByID ¶ added in v1.10.0
func (q *Queries) GetMasterPurchaseByID(ctx context.Context, arg GetMasterPurchaseByIDParams) (MasterPurchase, error)
func (*Queries) GetTenantAssetConfigByAssetID ¶ added in v1.13.0
func (q *Queries) GetTenantAssetConfigByAssetID(ctx context.Context, arg GetTenantAssetConfigByAssetIDParams) (TenantAssetConfig, error)
func (*Queries) GetTenantByID ¶
func (*Queries) GetTransactionByID ¶
func (q *Queries) GetTransactionByID(ctx context.Context, arg GetTransactionByIDParams) (Transaction, error)
func (*Queries) GetUserByEmail ¶
func (*Queries) GetUserByID ¶
func (*Queries) IncrementPaidInstallments ¶ added in v1.10.0
func (q *Queries) IncrementPaidInstallments(ctx context.Context, arg IncrementPaidInstallmentsParams) (MasterPurchase, error)
func (*Queries) ListAccountsByTenant ¶
func (*Queries) ListAccountsByUser ¶
func (*Queries) ListAssets ¶ added in v1.13.0
func (*Queries) ListAuditLogsByEntity ¶
func (*Queries) ListAuditLogsByTenant ¶
func (*Queries) ListCategoriesByTenant ¶
func (*Queries) ListChildCategories ¶
func (*Queries) ListMasterPurchasesByAccount ¶ added in v1.10.0
func (q *Queries) ListMasterPurchasesByAccount(ctx context.Context, arg ListMasterPurchasesByAccountParams) ([]MasterPurchase, error)
func (*Queries) ListMasterPurchasesByTenant ¶ added in v1.10.0
func (*Queries) ListPendingMasterPurchasesByClosingDay ¶ added in v1.10.0
func (q *Queries) ListPendingMasterPurchasesByClosingDay(ctx context.Context, arg ListPendingMasterPurchasesByClosingDayParams) ([]MasterPurchase, error)
func (*Queries) ListTenantAssetConfigs ¶ added in v1.13.0
func (*Queries) ListTransactionsByTenant ¶
func (q *Queries) ListTransactionsByTenant(ctx context.Context, arg ListTransactionsByTenantParams) ([]Transaction, error)
func (*Queries) ListUsersByTenant ¶
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 (*Queries) SoftDeleteTenantAssetConfig ¶ added in v1.13.0
func (q *Queries) SoftDeleteTenantAssetConfig(ctx context.Context, arg SoftDeleteTenantAssetConfigParams) 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 (*Queries) UpdateAccountBalance ¶
func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) error
func (*Queries) UpdateCategory ¶
func (*Queries) UpdateMasterPurchase ¶ added in v1.10.0
func (q *Queries) UpdateMasterPurchase(ctx context.Context, arg UpdateMasterPurchaseParams) (MasterPurchase, error)
func (*Queries) UpdateTenant ¶
func (*Queries) UpdateTransaction ¶
func (q *Queries) UpdateTransaction(ctx context.Context, arg UpdateTransactionParams) (Transaction, error)
func (*Queries) UpdateUser ¶
func (*Queries) UpdateUserLastLogin ¶
func (*Queries) UpsertTenantAssetConfig ¶ added in v1.13.0
func (q *Queries) UpsertTenantAssetConfig(ctx context.Context, arg UpsertTenantAssetConfigParams) (TenantAssetConfig, error)
type ReceivableStatus ¶ added in v1.13.0
type ReceivableStatus string
const ( ReceivableStatusPending ReceivableStatus = "pending" ReceivableStatusReceived ReceivableStatus = "received" ReceivableStatusCancelled ReceivableStatus = "cancelled" )
func (*ReceivableStatus) Scan ¶ added in v1.13.0
func (e *ReceivableStatus) Scan(src interface{}) error
type SoftDeleteAccountParams ¶
type SoftDeleteTenantAssetConfigParams ¶ added in v1.13.0
type SoftDeleteUserParams ¶
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 TenantAssetConfig ¶ added in v1.13.0
type TenantAssetConfig struct {
ID string `json:"id"`
TenantID string `json:"tenant_id"`
AssetID string `json:"asset_id"`
Name pgtype.Text `json:"name"`
Currency pgtype.Text `json:"currency"`
Details pgtype.Text `json:"details"`
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 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 UpdateMasterPurchaseParams ¶ added in v1.10.0
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 UpsertTenantAssetConfigParams ¶ added in v1.13.0
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"`
}
Click to show internal directories.
Click to hide internal directories.