Documentation ¶
Index ¶
- Constants
- type Account
- type AccountCategory
- type AccountCreateRequest
- type AccountDeleteRequest
- type AccountGetRequest
- type AccountHideRequest
- type AccountInfoResponse
- type AccountInfoResponseSlice
- type AccountListRequest
- type AccountModifyRequest
- type AccountMoveRequest
- type AccountNewDisplayOrderRequest
- type AccountType
- type AuthResponse
- type ClearDataRequest
- type DataStatisticsResponse
- type LatestExchangeRate
- type LatestExchangeRateResponse
- type LatestExchangeRateSlice
- type TokenInfoResponse
- type TokenInfoResponseSlice
- type TokenRecord
- type TokenRefreshResponse
- type TokenRevokeRequest
- type Transaction
- type TransactionAccountAmount
- type TransactionAccountsAmount
- type TransactionAmountsRequest
- type TransactionAmountsRequestItem
- type TransactionAmountsResponseItem
- type TransactionAmountsResponseItemAmountInfo
- type TransactionCategory
- type TransactionCategoryCreateBatchRequest
- type TransactionCategoryCreateRequest
- type TransactionCategoryCreateWithSubCategories
- type TransactionCategoryDeleteRequest
- type TransactionCategoryGetRequest
- type TransactionCategoryHideRequest
- type TransactionCategoryInfoResponse
- type TransactionCategoryInfoResponseSlice
- type TransactionCategoryListRequest
- type TransactionCategoryModifyRequest
- type TransactionCategoryMoveRequest
- type TransactionCategoryNewDisplayOrderRequest
- type TransactionCategoryType
- type TransactionCountRequest
- type TransactionCountResponse
- type TransactionCreateRequest
- type TransactionDbType
- type TransactionDeleteRequest
- type TransactionEditScope
- type TransactionGetRequest
- type TransactionInfoPageWrapperResponse
- type TransactionInfoPageWrapperResponse2
- type TransactionInfoResponse
- type TransactionInfoResponseSlice
- type TransactionListByMaxTimeRequest
- type TransactionListInMonthByPageRequest
- type TransactionModifyRequest
- type TransactionMonthAmountsRequest
- type TransactionMonthAmountsResponseItem
- type TransactionMonthAmountsResponseItemSlice
- type TransactionStatisticRequest
- type TransactionStatisticResponse
- type TransactionStatisticResponseItem
- type TransactionTag
- type TransactionTagCreateRequest
- type TransactionTagDeleteRequest
- type TransactionTagGetRequest
- type TransactionTagHideRequest
- type TransactionTagIndex
- type TransactionTagInfoResponse
- type TransactionTagInfoResponseSlice
- type TransactionTagModifyRequest
- type TransactionTagMoveRequest
- type TransactionTagNewDisplayOrderRequest
- type TransactionType
- type TwoFactor
- type TwoFactorDisableRequest
- type TwoFactorEnableConfirmRequest
- type TwoFactorEnableConfirmResponse
- type TwoFactorEnableResponse
- type TwoFactorLoginRequest
- type TwoFactorRecoveryCode
- type TwoFactorRecoveryCodeLoginRequest
- type TwoFactorRegenerateRecoveryCodeRequest
- type TwoFactorStatusResponse
- type User
- type UserBasicInfo
- type UserLoginRequest
- type UserProfileResponse
- type UserProfileUpdateRequest
- type UserProfileUpdateResponse
- type UserRegisterRequest
- type WeekDay
Constants ¶
const LevelOneAccountParentId = 0
LevelOneAccountParentId represents the parent id of level-one account
const LevelOneTransactionParentId = 0
LevelOneTransactionParentId represents the parent id of level-one transaction category
const TokenMaxUserAgentLength = 255
TokenMaxUserAgentLength represents the maximum size of user agent stored in database
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountId int64 `xorm:"PK"` Uid int64 `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` Deleted bool `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` Category AccountCategory `xorm:"NOT NULL"` Type AccountType `xorm:"NOT NULL"` ParentAccountId int64 `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` Name string `xorm:"VARCHAR(32) NOT NULL"` DisplayOrder int32 `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` Icon int64 `xorm:"NOT NULL"` Color string `xorm:"VARCHAR(6) NOT NULL"` Currency string `xorm:"VARCHAR(3) NOT NULL"` Balance int64 `xorm:"NOT NULL"` Comment string `xorm:"VARCHAR(255) NOT NULL"` Hidden bool `xorm:"NOT NULL"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 }
Account represents account data stored in database
func (*Account) ToAccountInfoResponse ¶
func (a *Account) ToAccountInfoResponse() *AccountInfoResponse
ToAccountInfoResponse returns a view-object according to database model
type AccountCategory ¶
type AccountCategory byte
AccountCategory represents account category
const ( ACCOUNT_CATEGORY_CASH AccountCategory = 1 ACCOUNT_CATEGORY_DEBIT_CARD AccountCategory = 2 ACCOUNT_CATEGORY_CREDIT_CARD AccountCategory = 3 ACCOUNT_CATEGORY_VIRTUAL AccountCategory = 4 ACCOUNT_CATEGORY_DEBT AccountCategory = 5 ACCOUNT_CATEGORY_RECEIVABLES AccountCategory = 6 ACCOUNT_CATEGORY_INVESTMENT AccountCategory = 7 )
Account categories
type AccountCreateRequest ¶
type AccountCreateRequest struct { Name string `json:"name" binding:"required,notBlank,max=32"` Category AccountCategory `json:"category" binding:"required"` Type AccountType `json:"type" binding:"required"` Icon int64 `json:"icon,string" binding:"required,min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` Currency string `json:"currency" binding:"required,len=3,validCurrency"` Balance int64 `json:"balance"` Comment string `json:"comment" binding:"max=255"` SubAccounts []*AccountCreateRequest `json:"subAccounts" binding:"omitempty"` }
AccountCreateRequest represents all parameters of account creation request
type AccountDeleteRequest ¶
type AccountDeleteRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
}
AccountDeleteRequest represents all parameters of account deleting request
type AccountGetRequest ¶
type AccountGetRequest struct {
Id int64 `form:"id,string" binding:"required,min=1"`
}
AccountGetRequest represents all parameters of account getting request
type AccountHideRequest ¶
type AccountHideRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Hidden bool `json:"hidden"` }
AccountHideRequest represents all parameters of account hiding request
type AccountInfoResponse ¶
type AccountInfoResponse struct { Id int64 `json:"id,string"` Name string `json:"name"` ParentId int64 `json:"parentId,string"` Category AccountCategory `json:"category"` Type AccountType `json:"type"` Icon int64 `json:"icon,string"` Color string `json:"color"` Currency string `json:"currency"` Balance int64 `json:"balance"` Comment string `json:"comment"` DisplayOrder int32 `json:"displayOrder"` IsAsset bool `json:"isAsset,omitempty"` IsLiability bool `json:"isLiability,omitempty"` Hidden bool `json:"hidden"` SubAccounts AccountInfoResponseSlice `json:"subAccounts,omitempty"` }
AccountInfoResponse represents a view-object of account
type AccountInfoResponseSlice ¶
type AccountInfoResponseSlice []*AccountInfoResponse
AccountInfoResponseSlice represents the slice data structure of AccountInfoResponse
func (AccountInfoResponseSlice) Len ¶
func (a AccountInfoResponseSlice) Len() int
Len returns the count of items
func (AccountInfoResponseSlice) Less ¶
func (a AccountInfoResponseSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (AccountInfoResponseSlice) Swap ¶
func (a AccountInfoResponseSlice) Swap(i, j int)
Swap swaps two items
type AccountListRequest ¶
type AccountListRequest struct {
VisibleOnly bool `form:"visible_only"`
}
AccountListRequest represents all parameters of account listing request
type AccountModifyRequest ¶
type AccountModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Name string `json:"name" binding:"required,notBlank,max=32"` Category AccountCategory `json:"category" binding:"required"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` Comment string `json:"comment" binding:"max=255"` Hidden bool `json:"hidden"` SubAccounts []*AccountModifyRequest `json:"subAccounts" binding:"omitempty"` }
AccountModifyRequest represents all parameters of account modification request
type AccountMoveRequest ¶
type AccountMoveRequest struct {
NewDisplayOrders []*AccountNewDisplayOrderRequest `json:"newDisplayOrders"`
}
AccountMoveRequest represents all parameters of account moving request
type AccountNewDisplayOrderRequest ¶
type AccountNewDisplayOrderRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` DisplayOrder int32 `json:"displayOrder"` }
AccountNewDisplayOrderRequest represents a data pair of id and display order
type AccountType ¶
type AccountType byte
AccountType represents account type
const ( ACCOUNT_TYPE_SINGLE_ACCOUNT AccountType = 1 ACCOUNT_TYPE_MULTI_SUB_ACCOUNTS AccountType = 2 )
Account types
type AuthResponse ¶
type AuthResponse struct { Token string `json:"token"` Need2FA bool `json:"need2FA"` User *UserBasicInfo `json:"user"` }
AuthResponse returns a view-object of user authorization
type ClearDataRequest ¶
type ClearDataRequest struct {
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
ClearDataRequest represents all parameters of clear user data request
type DataStatisticsResponse ¶ added in v0.2.0
type DataStatisticsResponse struct { TotalAccountCount int64 `json:"totalAccountCount,string"` TotalTransactionCategoryCount int64 `json:"totalTransactionCategoryCount,string"` TotalTransactionTagCount int64 `json:"totalTransactionTagCount,string"` TotalTransactionCount int64 `json:"totalTransactionCount,string"` }
DataStatisticsResponse represents a view-object of user data statistic
type LatestExchangeRate ¶
LatestExchangeRate represents a data pair of currency and exchange rate
type LatestExchangeRateResponse ¶
type LatestExchangeRateResponse struct { DataSource string `json:"dataSource"` ReferenceUrl string `json:"referenceUrl"` UpdateTime int64 `json:"updateTime"` BaseCurrency string `json:"baseCurrency"` ExchangeRates LatestExchangeRateSlice `json:"exchangeRates"` }
LatestExchangeRateResponse returns a view-object which contains latest exchange rate
type LatestExchangeRateSlice ¶
type LatestExchangeRateSlice []*LatestExchangeRate
LatestExchangeRateSlice represents the slice data structure of LatestExchangeRate
func (LatestExchangeRateSlice) Len ¶
func (s LatestExchangeRateSlice) Len() int
Len returns the count of items
func (LatestExchangeRateSlice) Less ¶
func (s LatestExchangeRateSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (LatestExchangeRateSlice) Swap ¶
func (s LatestExchangeRateSlice) Swap(i, j int)
Swap swaps two items
type TokenInfoResponse ¶
type TokenInfoResponse struct { TokenId string `json:"tokenId"` TokenType core.TokenType `json:"tokenType"` UserAgent string `json:"userAgent"` CreatedAt int64 `json:"createdAt"` ExpiredAt int64 `json:"expiredAt"` IsCurrent bool `json:"isCurrent"` }
TokenInfoResponse represents a view-object of token
type TokenInfoResponseSlice ¶
type TokenInfoResponseSlice []*TokenInfoResponse
TokenInfoResponseSlice represents the slice data structure of TokenInfoResponse
func (TokenInfoResponseSlice) Len ¶
func (a TokenInfoResponseSlice) Len() int
Len returns the count of items
func (TokenInfoResponseSlice) Less ¶
func (a TokenInfoResponseSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (TokenInfoResponseSlice) Swap ¶
func (a TokenInfoResponseSlice) Swap(i, j int)
Swap swaps two items
type TokenRecord ¶
type TokenRecord struct { Uid int64 `xorm:"PK INDEX(IDX_token_record_uid_type_expired_time)"` UserTokenId int64 `xorm:"PK"` TokenType core.TokenType `xorm:"INDEX(IDX_token_record_uid_type_expired_time) TINYINT NOT NULL"` Secret string `xorm:"VARCHAR(10) NOT NULL"` UserAgent string `xorm:"VARCHAR(255)"` CreatedUnixTime int64 `xorm:"PK"` ExpiredUnixTime int64 `xorm:"INDEX(IDX_token_record_uid_type_expired_time)"` }
TokenRecord represents token data stored in database
type TokenRefreshResponse ¶
type TokenRefreshResponse struct { NewToken string `json:"newToken"` OldTokenId string `json:"oldTokenId"` User *UserBasicInfo `json:"user"` }
TokenRefreshResponse represents all parameters of token refreshing request
type TokenRevokeRequest ¶
type TokenRevokeRequest struct {
TokenId string `json:"tokenId" binding:"required,notBlank"`
}
TokenRevokeRequest represents all parameters of token revoking request
type Transaction ¶
type Transaction struct { TransactionId int64 `xorm:"PK"` Uid int64 `` /* 236-byte string literal not displayed */ Deleted bool `` /* 203-byte string literal not displayed */ Type TransactionDbType `xorm:"INDEX(IDX_transaction_uid_deleted_type_time) NOT NULL"` CategoryId int64 `xorm:"INDEX(IDX_transaction_uid_deleted_category_id_time) NOT NULL"` AccountId int64 `xorm:"INDEX(IDX_transaction_uid_deleted_account_id_time) NOT NULL"` TransactionTime int64 `` /* 236-byte string literal not displayed */ TimezoneUtcOffset int16 `xorm:"NOT NULL"` Amount int64 `xorm:"NOT NULL"` RelatedId int64 `xorm:"NOT NULL"` RelatedAccountId int64 `xorm:"NOT NULL"` RelatedAccountAmount int64 `xorm:"NOT NULL"` HideAmount bool `xorm:"NOT NULL"` Comment string `xorm:"VARCHAR(255) NOT NULL"` CreatedIp string `xorm:"VARCHAR(39)"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 }
Transaction represents transaction data stored in database
func (*Transaction) IsEditable ¶
func (t *Transaction) IsEditable(currentUser *User, utcOffset int16, account *Account, relatedAccount *Account) bool
IsEditable returns whether this transaction can be edited
func (*Transaction) ToTransactionInfoResponse ¶
func (t *Transaction) ToTransactionInfoResponse(tagIds []int64, editable bool) *TransactionInfoResponse
ToTransactionInfoResponse returns a view-object according to database model
type TransactionAccountAmount ¶
type TransactionAccountAmount struct { AccountId int64 TotalIncomeAmount int64 TotalExpenseAmount int64 }
TransactionAccountAmount represents transaction account amount
type TransactionAccountsAmount ¶
type TransactionAccountsAmount map[int64]*TransactionAccountAmount
TransactionAccountsAmount represents transaction accounts amount map
type TransactionAmountsRequest ¶
type TransactionAmountsRequest struct {
Query string `form:"query"`
}
TransactionAmountsRequest represents all parameters of transaction amounts request
func (*TransactionAmountsRequest) GetTransactionAmountsRequestItems ¶
func (t *TransactionAmountsRequest) GetTransactionAmountsRequestItems() ([]*TransactionAmountsRequestItem, error)
GetTransactionAmountsRequestItems returns request items by query parameters
type TransactionAmountsRequestItem ¶
TransactionAmountsRequestItem represents an item of transaction amounts request
type TransactionAmountsResponseItem ¶
type TransactionAmountsResponseItem struct { StartTime int64 `json:"startTime"` EndTime int64 `json:"endTime"` Amounts []*TransactionAmountsResponseItemAmountInfo `json:"amounts"` }
TransactionAmountsResponseItem represents an item of transaction amounts
type TransactionAmountsResponseItemAmountInfo ¶
type TransactionAmountsResponseItemAmountInfo struct { Currency string `json:"currency"` IncomeAmount int64 `json:"incomeAmount"` ExpenseAmount int64 `json:"expenseAmount"` }
TransactionAmountsResponseItemAmountInfo represents amount info for an response item
type TransactionCategory ¶
type TransactionCategory struct { CategoryId int64 `xorm:"PK"` Uid int64 `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Deleted bool `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Type TransactionCategoryType `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` ParentCategoryId int64 `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Name string `xorm:"VARCHAR(32) NOT NULL"` DisplayOrder int32 `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Icon int64 `xorm:"NOT NULL"` Color string `xorm:"VARCHAR(6) NOT NULL"` Hidden bool `xorm:"NOT NULL"` Comment string `xorm:"VARCHAR(255) NOT NULL"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 }
TransactionCategory represents transaction category data stored in database
func (*TransactionCategory) ToTransactionCategoryInfoResponse ¶
func (c *TransactionCategory) ToTransactionCategoryInfoResponse() *TransactionCategoryInfoResponse
ToTransactionCategoryInfoResponse returns a view-object according to database model
type TransactionCategoryCreateBatchRequest ¶
type TransactionCategoryCreateBatchRequest struct {
Categories []*TransactionCategoryCreateWithSubCategories `json:"categories" binding:"required"`
}
TransactionCategoryCreateBatchRequest represents all parameters of transaction category batch creation request
type TransactionCategoryCreateRequest ¶
type TransactionCategoryCreateRequest struct { Name string `json:"name" binding:"required,notBlank,max=32"` Type TransactionCategoryType `json:"type" binding:"required"` ParentId int64 `json:"parentId,string" binding:"min=0"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` Comment string `json:"comment" binding:"max=255"` }
TransactionCategoryCreateRequest represents all parameters of single transaction category creation request
type TransactionCategoryCreateWithSubCategories ¶
type TransactionCategoryCreateWithSubCategories struct { Name string `json:"name" binding:"required,notBlank,max=32"` Type TransactionCategoryType `json:"type" binding:"required"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` Comment string `json:"comment" binding:"max=255"` SubCategories []*TransactionCategoryCreateRequest `json:"subCategories" binding:"required"` }
TransactionCategoryCreateWithSubCategories represents all parameters of multi transaction categories creation request
type TransactionCategoryDeleteRequest ¶
type TransactionCategoryDeleteRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
}
TransactionCategoryDeleteRequest represents all parameters of transaction category deleting request
type TransactionCategoryGetRequest ¶
type TransactionCategoryGetRequest struct {
Id int64 `form:"id,string" binding:"required,min=1"`
}
TransactionCategoryGetRequest represents all parameters of transaction category getting request
type TransactionCategoryHideRequest ¶
type TransactionCategoryHideRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Hidden bool `json:"hidden"` }
TransactionCategoryHideRequest represents all parameters of transaction category hiding request
type TransactionCategoryInfoResponse ¶
type TransactionCategoryInfoResponse struct { Id int64 `json:"id,string"` Name string `json:"name"` ParentId int64 `json:"parentId,string"` Type TransactionCategoryType `json:"type"` Icon int64 `json:"icon,string"` Color string `json:"color"` Comment string `json:"comment"` DisplayOrder int32 `json:"displayOrder"` Hidden bool `json:"hidden"` SubCategories TransactionCategoryInfoResponseSlice `json:"subCategories,omitempty"` }
TransactionCategoryInfoResponse represents a view-object of transaction category
type TransactionCategoryInfoResponseSlice ¶
type TransactionCategoryInfoResponseSlice []*TransactionCategoryInfoResponse
TransactionCategoryInfoResponseSlice represents the slice data structure of TransactionCategoryInfoResponse
func (TransactionCategoryInfoResponseSlice) Len ¶
func (s TransactionCategoryInfoResponseSlice) Len() int
Len returns the count of items
func (TransactionCategoryInfoResponseSlice) Less ¶
func (s TransactionCategoryInfoResponseSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (TransactionCategoryInfoResponseSlice) Swap ¶
func (s TransactionCategoryInfoResponseSlice) Swap(i, j int)
Swap swaps two items
type TransactionCategoryListRequest ¶
type TransactionCategoryListRequest struct { Type TransactionCategoryType `form:"type" binding:"min=0"` ParentId int64 `form:"parent_id,string,default=-1" binding:"min=-1"` }
TransactionCategoryListRequest represents all parameters of transaction category listing request
type TransactionCategoryModifyRequest ¶
type TransactionCategoryModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Name string `json:"name" binding:"required,notBlank,max=32"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` Comment string `json:"comment" binding:"max=255"` Hidden bool `json:"hidden"` }
TransactionCategoryModifyRequest represents all parameters of transaction category modification request
type TransactionCategoryMoveRequest ¶
type TransactionCategoryMoveRequest struct {
NewDisplayOrders []*TransactionCategoryNewDisplayOrderRequest `json:"newDisplayOrders"`
}
TransactionCategoryMoveRequest represents all parameters of transaction category moving request
type TransactionCategoryNewDisplayOrderRequest ¶
type TransactionCategoryNewDisplayOrderRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` DisplayOrder int32 `json:"displayOrder"` }
TransactionCategoryNewDisplayOrderRequest represents a data pair of id and display order
type TransactionCategoryType ¶
type TransactionCategoryType byte
TransactionCategoryType represents transaction category type
const ( CATEGORY_TYPE_INCOME TransactionCategoryType = 1 CATEGORY_TYPE_EXPENSE TransactionCategoryType = 2 CATEGORY_TYPE_TRANSFER TransactionCategoryType = 3 )
Transaction category types
type TransactionCountRequest ¶
type TransactionCountRequest struct { Type TransactionDbType `form:"type" binding:"min=0,max=4"` CategoryId int64 `form:"category_id" binding:"min=0"` AccountId int64 `form:"account_id" binding:"min=0"` Keyword string `form:"keyword"` MaxTime int64 `form:"max_time" binding:"min=0"` MinTime int64 `form:"min_time" binding:"min=0"` }
TransactionCountRequest represents transaction count request
type TransactionCountResponse ¶
type TransactionCountResponse struct {
TotalCount int64 `json:"totalCount"`
}
TransactionCountResponse represents transaction count response
type TransactionCreateRequest ¶
type TransactionCreateRequest struct { Type TransactionType `json:"type" binding:"required"` CategoryId int64 `json:"categoryId,string"` Time int64 `json:"time" binding:"required,min=1"` UtcOffset int16 `json:"utcOffset" binding:"min=-720,max=840"` SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"` DestinationAccountId int64 `json:"destinationAccountId,string" binding:"min=0"` SourceAmount int64 `json:"sourceAmount" binding:"min=-99999999999,max=99999999999"` DestinationAmount int64 `json:"destinationAmount" binding:"min=-99999999999,max=99999999999"` HideAmount bool `json:"hideAmount"` TagIds []string `json:"tagIds"` Comment string `json:"comment" binding:"max=255"` }
TransactionCreateRequest represents all parameters of transaction creation request
type TransactionDbType ¶
type TransactionDbType byte
TransactionDbType represents transaction type in database
const ( TRANSACTION_DB_TYPE_MODIFY_BALANCE TransactionDbType = 1 TRANSACTION_DB_TYPE_INCOME TransactionDbType = 2 TRANSACTION_DB_TYPE_EXPENSE TransactionDbType = 3 TRANSACTION_DB_TYPE_TRANSFER_OUT TransactionDbType = 4 TRANSACTION_DB_TYPE_TRANSFER_IN TransactionDbType = 5 )
Transaction db types
type TransactionDeleteRequest ¶
type TransactionDeleteRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
}
TransactionDeleteRequest represents all parameters of transaction deleting request
type TransactionEditScope ¶
type TransactionEditScope byte
TransactionEditScope represents the scope which transaction can be edited
const ( TRANSACTION_EDIT_SCOPE_NONE TransactionEditScope = 0 TRANSACTION_EDIT_SCOPE_ALL TransactionEditScope = 1 TRANSACTION_EDIT_SCOPE_TODAY_OR_LATER TransactionEditScope = 2 TRANSACTION_EDIT_SCOPE_LAST_24H_OR_LATER TransactionEditScope = 3 TRANSACTION_EDIT_SCOPE_THIS_WEEK_OR_LATER TransactionEditScope = 4 TRANSACTION_EDIT_SCOPE_THIS_MONTH_OR_LATER TransactionEditScope = 5 TRANSACTION_EDIT_SCOPE_THIS_YEAR_OR_LATER TransactionEditScope = 6 TRANSACTION_EDIT_SCOPE_INVALID TransactionEditScope = 255 )
Editable Transaction Scopes
func (TransactionEditScope) String ¶
func (s TransactionEditScope) String() string
String returns a textual representation of the editable transaction scopes enum
type TransactionGetRequest ¶
type TransactionGetRequest struct { Id int64 `form:"id,string" binding:"required,min=1"` TrimAccount bool `form:"trim_account"` TrimCategory bool `form:"trim_category"` TrimTag bool `form:"trim_tag"` }
TransactionGetRequest represents all parameters of transaction getting request
type TransactionInfoPageWrapperResponse ¶
type TransactionInfoPageWrapperResponse struct { Items TransactionInfoResponseSlice `json:"items"` NextTimeSequenceId *int64 `json:"nextTimeSequenceId,string"` }
TransactionInfoPageWrapperResponse represents a response of transaction which contains items and next id
type TransactionInfoPageWrapperResponse2 ¶
type TransactionInfoPageWrapperResponse2 struct { Items TransactionInfoResponseSlice `json:"items"` TotalCount int64 `json:"totalCount"` }
TransactionInfoPageWrapperResponse2 represents a response of transaction which contains items and count
type TransactionInfoResponse ¶
type TransactionInfoResponse struct { Id int64 `json:"id,string"` TimeSequenceId int64 `json:"timeSequenceId,string"` Type TransactionType `json:"type"` CategoryId int64 `json:"categoryId,string"` Category *TransactionCategoryInfoResponse `json:"category,omitempty"` Time int64 `json:"time"` UtcOffset int16 `json:"utcOffset"` SourceAccountId int64 `json:"sourceAccountId,string"` SourceAccount *AccountInfoResponse `json:"sourceAccount,omitempty"` DestinationAccountId int64 `json:"destinationAccountId,string,omitempty"` DestinationAccount *AccountInfoResponse `json:"destinationAccount,omitempty"` SourceAmount int64 `json:"sourceAmount"` DestinationAmount int64 `json:"destinationAmount,omitempty"` HideAmount bool `json:"hideAmount"` TagIds []string `json:"tagIds"` Tags []*TransactionTagInfoResponse `json:"tags,omitempty"` Comment string `json:"comment"` Editable bool `json:"editable"` }
TransactionInfoResponse represents a view-object of transaction
type TransactionInfoResponseSlice ¶
type TransactionInfoResponseSlice []*TransactionInfoResponse
TransactionInfoResponseSlice represents the slice data structure of TransactionInfoResponse
func (TransactionInfoResponseSlice) Len ¶
func (s TransactionInfoResponseSlice) Len() int
Len returns the count of items
func (TransactionInfoResponseSlice) Less ¶
func (s TransactionInfoResponseSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (TransactionInfoResponseSlice) Swap ¶
func (s TransactionInfoResponseSlice) Swap(i, j int)
Swap swaps two items
type TransactionListByMaxTimeRequest ¶
type TransactionListByMaxTimeRequest struct { Type TransactionDbType `form:"type" binding:"min=0,max=4"` CategoryId int64 `form:"category_id" binding:"min=0"` AccountId int64 `form:"account_id" binding:"min=0"` Keyword string `form:"keyword"` MaxTime int64 `form:"max_time" binding:"min=0"` MinTime int64 `form:"min_time" binding:"min=0"` Count int32 `form:"count" binding:"required,min=1,max=50"` TrimAccount bool `form:"trim_account"` TrimCategory bool `form:"trim_category"` TrimTag bool `form:"trim_tag"` }
TransactionListByMaxTimeRequest represents all parameters of transaction listing by max time request
type TransactionListInMonthByPageRequest ¶
type TransactionListInMonthByPageRequest struct { Year int32 `form:"year" binding:"required,min=1"` Month int32 `form:"month" binding:"required,min=1"` Type TransactionDbType `form:"type" binding:"min=0,max=4"` CategoryId int64 `form:"category_id" binding:"min=0"` AccountId int64 `form:"account_id" binding:"min=0"` Keyword string `form:"keyword"` Page int32 `form:"page" binding:"required,min=1"` Count int32 `form:"count" binding:"required,min=1,max=50"` TrimAccount bool `form:"trim_account"` TrimCategory bool `form:"trim_category"` TrimTag bool `form:"trim_tag"` }
TransactionListInMonthByPageRequest represents all parameters of transaction listing by month request
type TransactionModifyRequest ¶
type TransactionModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` CategoryId int64 `json:"categoryId,string"` Time int64 `json:"time" binding:"required,min=1"` UtcOffset int16 `json:"utcOffset" binding:"min=-720,max=840"` SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"` DestinationAccountId int64 `json:"destinationAccountId,string" binding:"min=0"` SourceAmount int64 `json:"sourceAmount" binding:"min=-99999999999,max=99999999999"` DestinationAmount int64 `json:"destinationAmount" binding:"min=-99999999999,max=99999999999"` HideAmount bool `json:"hideAmount"` TagIds []string `json:"tagIds"` Comment string `json:"comment" binding:"max=255"` }
TransactionModifyRequest represents all parameters of transaction modification request
type TransactionMonthAmountsRequest ¶
type TransactionMonthAmountsRequest struct { StartYearMonth string `form:"start_year_month"` EndYearMonth string `form:"end_year_month"` }
TransactionMonthAmountsRequest represents all parameters of transaction month amounts request
func (*TransactionMonthAmountsRequest) GetStartTimeAndEndTime ¶
func (t *TransactionMonthAmountsRequest) GetStartTimeAndEndTime(utcOffset int16) (int64, int64, error)
GetStartTimeAndEndTime returns start unix time and end unix time by request parameter
type TransactionMonthAmountsResponseItem ¶
type TransactionMonthAmountsResponseItem struct { Year int32 `json:"year"` Month int32 `json:"month"` Amounts []*TransactionAmountsResponseItemAmountInfo `json:"amounts"` }
TransactionMonthAmountsResponseItem represents an item of transaction month amounts
type TransactionMonthAmountsResponseItemSlice ¶
type TransactionMonthAmountsResponseItemSlice []*TransactionMonthAmountsResponseItem
TransactionMonthAmountsResponseItemSlice represents the slice data structure of TransactionMonthAmountsResponseItem
func (TransactionMonthAmountsResponseItemSlice) Len ¶
func (s TransactionMonthAmountsResponseItemSlice) Len() int
Len returns the count of items
func (TransactionMonthAmountsResponseItemSlice) Less ¶
func (s TransactionMonthAmountsResponseItemSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (TransactionMonthAmountsResponseItemSlice) Swap ¶
func (s TransactionMonthAmountsResponseItemSlice) Swap(i, j int)
Swap swaps two items
type TransactionStatisticRequest ¶
type TransactionStatisticRequest struct { StartTime int64 `form:"start_time" binding:"min=0"` EndTime int64 `form:"end_time" binding:"min=0"` }
TransactionStatisticRequest represents all parameters of transaction statistic request
type TransactionStatisticResponse ¶
type TransactionStatisticResponse struct { StartTime int64 `json:"startTime"` EndTime int64 `json:"endTime"` Items []*TransactionStatisticResponseItem `json:"items"` }
TransactionStatisticResponse represents an item of transaction amounts
type TransactionStatisticResponseItem ¶
type TransactionStatisticResponseItem struct { CategoryId int64 `json:"categoryId,string"` AccountId int64 `json:"accountId,string"` TotalAmount int64 `json:"amount"` }
TransactionStatisticResponseItem represents total amount item for an response
type TransactionTag ¶
type TransactionTag struct { TagId int64 `xorm:"PK"` Uid int64 `xorm:"INDEX(IDX_tag_uid_deleted_name) NOT NULL"` Deleted bool `xorm:"INDEX(IDX_tag_uid_deleted_name) NOT NULL"` Name string `xorm:"INDEX(IDX_tag_uid_deleted_name) VARCHAR(32) NOT NULL"` DisplayOrder int32 `xorm:"NOT NULL"` Hidden bool `xorm:"NOT NULL"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 }
TransactionTag represents transaction tag data stored in database
func (*TransactionTag) ToTransactionTagInfoResponse ¶
func (t *TransactionTag) ToTransactionTagInfoResponse() *TransactionTagInfoResponse
ToTransactionTagInfoResponse returns a view-object according to database model
type TransactionTagCreateRequest ¶
type TransactionTagCreateRequest struct {
Name string `json:"name" binding:"required,notBlank,max=32"`
}
TransactionTagCreateRequest represents all parameters of transaction tag creation request
type TransactionTagDeleteRequest ¶
type TransactionTagDeleteRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
}
TransactionTagDeleteRequest represents all parameters of transaction tag deleting request
type TransactionTagGetRequest ¶
type TransactionTagGetRequest struct {
Id int64 `form:"id,string" binding:"required,min=1"`
}
TransactionTagGetRequest represents all parameters of transaction tag getting request
type TransactionTagHideRequest ¶
type TransactionTagHideRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Hidden bool `json:"hidden"` }
TransactionTagHideRequest represents all parameters of transaction tag hiding request
type TransactionTagIndex ¶
type TransactionTagIndex struct { TagIndexId int64 `xorm:"PK"` Uid int64 `` /* 202-byte string literal not displayed */ Deleted bool `` /* 211-byte string literal not displayed */ TagId int64 `` /* 142-byte string literal not displayed */ TransactionId int64 `` /* 133-byte string literal not displayed */ TransactionTime int64 `xorm:"INDEX(IDX_transaction_tag_index_uid_deleted_tag_id_transaction_time) NOT NULL"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 }
TransactionTagIndex represents transaction and transaction tag relation stored in database
type TransactionTagInfoResponse ¶
type TransactionTagInfoResponse struct { Id int64 `json:"id,string"` Name string `json:"name"` DisplayOrder int32 `json:"displayOrder"` Hidden bool `json:"hidden"` }
TransactionTagInfoResponse represents a view-object of transaction tag
type TransactionTagInfoResponseSlice ¶
type TransactionTagInfoResponseSlice []*TransactionTagInfoResponse
TransactionTagInfoResponseSlice represents the slice data structure of TransactionTagInfoResponse
func (TransactionTagInfoResponseSlice) Len ¶
func (s TransactionTagInfoResponseSlice) Len() int
Len returns the count of items
func (TransactionTagInfoResponseSlice) Less ¶
func (s TransactionTagInfoResponseSlice) Less(i, j int) bool
Less reports whether the first item is less than the second one
func (TransactionTagInfoResponseSlice) Swap ¶
func (s TransactionTagInfoResponseSlice) Swap(i, j int)
Swap swaps two items
type TransactionTagModifyRequest ¶
type TransactionTagModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` Name string `json:"name" binding:"required,notBlank,max=32"` }
TransactionTagModifyRequest represents all parameters of transaction tag modification request
type TransactionTagMoveRequest ¶
type TransactionTagMoveRequest struct {
NewDisplayOrders []*TransactionTagNewDisplayOrderRequest `json:"newDisplayOrders"`
}
TransactionTagMoveRequest represents all parameters of transaction tag moving request
type TransactionTagNewDisplayOrderRequest ¶
type TransactionTagNewDisplayOrderRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` DisplayOrder int32 `json:"displayOrder"` }
TransactionTagNewDisplayOrderRequest represents a data pair of id and display order
type TransactionType ¶
type TransactionType byte
TransactionType represents transaction type
const ( TRANSACTION_TYPE_MODIFY_BALANCE TransactionType = 1 TRANSACTION_TYPE_INCOME TransactionType = 2 TRANSACTION_TYPE_EXPENSE TransactionType = 3 TRANSACTION_TYPE_TRANSFER TransactionType = 4 )
Transaction types
type TwoFactor ¶
type TwoFactor struct { Uid int64 `xorm:"PK"` Secret string `xorm:"VARCHAR(80) NOT NULL"` CreatedUnixTime int64 }
TwoFactor represents user 2fa data stored in database
type TwoFactorDisableRequest ¶
type TwoFactorDisableRequest struct {
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
TwoFactorDisableRequest represents all parameters of 2fa disabling request
type TwoFactorEnableConfirmRequest ¶
type TwoFactorEnableConfirmRequest struct { Secret string `json:"secret" binding:"required,notBlank,len=32"` Passcode string `json:"passcode" binding:"required,notBlank,len=6"` }
TwoFactorEnableConfirmRequest represents all parameters of 2fa confirm request
type TwoFactorEnableConfirmResponse ¶
type TwoFactorEnableConfirmResponse struct { Token string `json:"token,omitempty"` RecoveryCodes []string `json:"recoveryCodes"` }
TwoFactorEnableConfirmResponse represents all response parameters after user have enabled 2fa
type TwoFactorEnableResponse ¶
TwoFactorEnableResponse represents all response parameters when user requests to enable 2fa
type TwoFactorLoginRequest ¶
type TwoFactorLoginRequest struct {
Passcode string `json:"passcode" binding:"required,notBlank,len=6"`
}
TwoFactorLoginRequest represents all parameters of 2fa login request
type TwoFactorRecoveryCode ¶
type TwoFactorRecoveryCode struct { Uid int64 `xorm:"PK"` RecoveryCode string `xorm:"VARCHAR(64) PK"` Used bool `xorm:"NOT NULL"` CreatedUnixTime int64 UsedUnixTime int64 }
TwoFactorRecoveryCode represents user 2fa recovery codes stored in database
type TwoFactorRecoveryCodeLoginRequest ¶
type TwoFactorRecoveryCodeLoginRequest struct {
RecoveryCode string `json:"recoveryCode" binding:"required,notBlank,len=11"`
}
TwoFactorRecoveryCodeLoginRequest represents all parameters of 2fa login request via recovery code
type TwoFactorRegenerateRecoveryCodeRequest ¶
type TwoFactorRegenerateRecoveryCodeRequest struct {
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
TwoFactorRegenerateRecoveryCodeRequest represents all parameters of 2fa regenerating recovery codes request
type TwoFactorStatusResponse ¶
type TwoFactorStatusResponse struct { Enable bool `json:"enable"` CreatedAt int64 `json:"createdAt,omitempty"` }
TwoFactorStatusResponse represents a view-object of 2fa status
type User ¶
type User struct { Uid int64 `xorm:"PK"` Username string `xorm:"VARCHAR(32) UNIQUE NOT NULL"` Email string `xorm:"VARCHAR(100) UNIQUE NOT NULL"` Nickname string `xorm:"VARCHAR(64) NOT NULL"` Password string `xorm:"VARCHAR(64) NOT NULL"` Salt string `xorm:"VARCHAR(10) NOT NULL"` DefaultCurrency string `xorm:"VARCHAR(3) NOT NULL"` DefaultAccountId int64 FirstDayOfWeek WeekDay `xorm:"TINYINT NOT NULL"` TransactionEditScope TransactionEditScope `xorm:"TINYINT NOT NULL"` Deleted bool `xorm:"NOT NULL"` EmailVerified bool `xorm:"NOT NULL"` CreatedUnixTime int64 UpdatedUnixTime int64 DeletedUnixTime int64 LastLoginUnixTime int64 }
User represents user data stored in database
func (*User) CanEditTransactionByTransactionTime ¶
CanEditTransactionByTransactionTime returns whether this user can edit transaction with specified transaction time
func (*User) ToUserBasicInfo ¶
func (u *User) ToUserBasicInfo() *UserBasicInfo
ToUserBasicInfo returns a user basic view-object according to database model
func (*User) ToUserProfileResponse ¶
func (u *User) ToUserProfileResponse() *UserProfileResponse
ToUserProfileResponse returns a user profile view-object according to database model
type UserBasicInfo ¶
type UserBasicInfo struct { Username string `json:"username"` Email string `json:"email"` Nickname string `json:"nickname"` DefaultCurrency string `json:"defaultCurrency"` DefaultAccountId int64 `json:"defaultAccountId,string"` FirstDayOfWeek WeekDay `json:"firstDayOfWeek"` TransactionEditScope TransactionEditScope `json:"transactionEditScope"` }
UserBasicInfo represents a view-object of user basic info
type UserLoginRequest ¶
type UserLoginRequest struct { LoginName string `json:"loginName" binding:"required,notBlank,max=100,validUsername|validEmail"` Password string `json:"password" binding:"required,min=6,max=128"` }
UserLoginRequest represents all parameters of user login request
type UserProfileResponse ¶
type UserProfileResponse struct { Username string `json:"username"` Email string `json:"email"` Nickname string `json:"nickname"` DefaultCurrency string `json:"defaultCurrency"` DefaultAccountId int64 `json:"defaultAccountId,string"` FirstDayOfWeek WeekDay `json:"firstDayOfWeek"` TransactionEditScope TransactionEditScope `json:"transactionEditScope"` LastLoginAt int64 `json:"lastLoginAt"` }
UserProfileResponse represents a view-object of user profile
type UserProfileUpdateRequest ¶
type UserProfileUpdateRequest struct { Email string `json:"email" binding:"omitempty,notBlank,max=100,validEmail"` Nickname string `json:"nickname" binding:"omitempty,notBlank,max=64"` Password string `json:"password" binding:"omitempty,min=6,max=128"` OldPassword string `json:"oldPassword" binding:"omitempty,min=6,max=128"` DefaultCurrency string `json:"defaultCurrency" binding:"omitempty,len=3,validCurrency"` DefaultAccountId int64 `json:"defaultAccountId,string" binding:"omitempty,min=1"` FirstDayOfWeek *WeekDay `json:"firstDayOfWeek" binding:"omitempty,min=0,max=6"` TransactionEditScope *TransactionEditScope `json:"transactionEditScope" binding:"omitempty,min=0,max=7"` }
UserProfileUpdateRequest represents all parameters of user updating profile request
type UserProfileUpdateResponse ¶
type UserProfileUpdateResponse struct { User *UserBasicInfo `json:"user"` NewToken string `json:"newToken,omitempty"` }
UserProfileUpdateResponse represents the data returns to frontend after updating profile
type UserRegisterRequest ¶
type UserRegisterRequest struct { Username string `json:"username" binding:"required,notBlank,max=32,validUsername"` Email string `json:"email" binding:"required,notBlank,max=100,validEmail"` Nickname string `json:"nickname" binding:"required,notBlank,max=64"` Password string `json:"password" binding:"required,min=6,max=128"` DefaultCurrency string `json:"defaultCurrency" binding:"required,len=3,validCurrency"` FirstDayOfWeek WeekDay `json:"firstDayOfWeek" binding:"min=0,max=6"` }
UserRegisterRequest represents all parameters of user registering request
type WeekDay ¶
type WeekDay byte
WeekDay represents week day