use unambiguous numeric variable type

This commit is contained in:
MaysWind
2023-03-27 23:53:05 +08:00
parent 2797266de6
commit d4985a024d
17 changed files with 94 additions and 60 deletions
+3 -3
View File
@@ -55,7 +55,7 @@ type Account struct {
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 int `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) 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"`
@@ -116,7 +116,7 @@ type AccountMoveRequest struct {
// AccountNewDisplayOrderRequest represents a data pair of id and display order
type AccountNewDisplayOrderRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
}
// AccountDeleteRequest represents all parameters of account deleting request
@@ -136,7 +136,7 @@ type AccountInfoResponse struct {
Currency string `json:"currency"`
Balance int64 `json:"balance"`
Comment string `json:"comment"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
IsAsset bool `json:"isAsset,omitempty"`
IsLiability bool `json:"isLiability,omitempty"`
Hidden bool `json:"hidden"`
+7 -7
View File
@@ -102,7 +102,7 @@ type TransactionListByMaxTimeRequest struct {
Keyword string `form:"keyword"`
MaxTime int64 `form:"max_time" binding:"min=0"`
MinTime int64 `form:"min_time" binding:"min=0"`
Count int `form:"count" binding:"required,min=1,max=50"`
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"`
@@ -110,14 +110,14 @@ type TransactionListByMaxTimeRequest struct {
// TransactionListInMonthByPageRequest represents all parameters of transaction listing by month request
type TransactionListInMonthByPageRequest struct {
Year int `form:"year" binding:"required,min=1"`
Month int `form:"month" binding:"required,min=1"`
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 int `form:"page" binding:"required,min=1"`
Count int `form:"count" binding:"required,min=1,max=50"`
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"`
@@ -232,8 +232,8 @@ type TransactionAmountsResponseItem struct {
// TransactionMonthAmountsResponseItem represents an item of transaction month amounts
type TransactionMonthAmountsResponseItem struct {
Year int `json:"year"`
Month int `json:"month"`
Year int32 `json:"year"`
Month int32 `json:"month"`
Amounts []*TransactionAmountsResponseItemAmountInfo `json:"amounts"`
}
+3 -3
View File
@@ -21,7 +21,7 @@ type TransactionCategory struct {
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 int `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) 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"`
@@ -91,7 +91,7 @@ type TransactionCategoryMoveRequest struct {
// TransactionCategoryNewDisplayOrderRequest represents a data pair of id and display order
type TransactionCategoryNewDisplayOrderRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
}
// TransactionCategoryDeleteRequest represents all parameters of transaction category deleting request
@@ -108,7 +108,7 @@ type TransactionCategoryInfoResponse struct {
Icon int64 `json:"icon,string"`
Color string `json:"color"`
Comment string `json:"comment"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
Hidden bool `json:"hidden"`
SubCategories TransactionCategoryInfoResponseSlice `json:"subCategories,omitempty"`
}
+3 -3
View File
@@ -6,7 +6,7 @@ type TransactionTag struct {
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 int `xorm:"NOT NULL"`
DisplayOrder int32 `xorm:"NOT NULL"`
Hidden bool `xorm:"NOT NULL"`
CreatedUnixTime int64
UpdatedUnixTime int64
@@ -43,7 +43,7 @@ type TransactionTagMoveRequest struct {
// TransactionTagNewDisplayOrderRequest represents a data pair of id and display order
type TransactionTagNewDisplayOrderRequest struct {
Id int64 `json:"id,string" binding:"required,min=1"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
}
// TransactionTagDeleteRequest represents all parameters of transaction tag deleting request
@@ -55,7 +55,7 @@ type TransactionTagDeleteRequest struct {
type TransactionTagInfoResponse struct {
Id int64 `json:"id,string"`
Name string `json:"name"`
DisplayOrder int `json:"displayOrder"`
DisplayOrder int32 `json:"displayOrder"`
Hidden bool `json:"hidden"`
}