response

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(ctx *gin.Context)

func FailToError

func FailToError(ctx *gin.Context, err error)

func FailToParameter

func FailToParameter(ctx *gin.Context, err error)

func FailWithDetailed

func FailWithDetailed(data interface{}, message string, ctx *gin.Context)

func FailWithMessage

func FailWithMessage(message string, ctx *gin.Context)

func Forbidden

func Forbidden(ctx *gin.Context)

func FrequentOperation

func FrequentOperation(ctx *gin.Context)

func Ok

func Ok(ctx *gin.Context)

func OkWithData

func OkWithData(data interface{}, ctx *gin.Context)

func OkWithDetailed

func OkWithDetailed(data interface{}, message string, ctx *gin.Context)

func OkWithMessage

func OkWithMessage(message string, ctx *gin.Context)

func Response

func Response(status int, data interface{}, msg string, ctx *gin.Context)

func ResponseAndAbort

func ResponseAndAbort(status int, data interface{}, msg string, ctx *gin.Context)

func TokenExpired

func TokenExpired(ctx *gin.Context)

Types

type AccountDetail

type AccountDetail struct {
	AccountOne
	CreatorId   uint
	CreatorName string
	Role        accountModel.UserRole
	JoinTime    time.Time
}

func (*AccountDetail) SetData

func (a *AccountDetail) SetData(accountUser accountModel.User) error

func (*AccountDetail) SetDataFromAccount

func (a *AccountDetail) SetDataFromAccount(account accountModel.Account) error

SetDataFromAccount 通过account设置数据,数据中的user来源为account.UserId

func (*AccountDetail) SetDataFromAccountAndUser

func (a *AccountDetail) SetDataFromAccountAndUser(account accountModel.Account, user userModel.User) error

type AccountDetailList

type AccountDetailList []AccountDetail

func (*AccountDetailList) SetData

type AccountInfo

type AccountInfo struct {
	TodayTransTotal        *global.IEStatisticWithTime
	CurrentMonthTransTotal *global.IEStatisticWithTime
	RecentTrans            *TransactionDetailList
}

type AccountMapping

type AccountMapping struct {
	Id             uint
	MainAccount    AccountOne
	RelatedAccount AccountDetail
	CreateTime     time.Time
	UpdateTime     time.Time
}

AccountMapping 账本关联

func (*AccountMapping) SetData

func (a *AccountMapping) SetData(data accountModel.Mapping) error

type AccountOne

type AccountOne struct {
	Id         uint
	Name       string
	Icon       string
	Type       accountModel.Type
	Location   string
	CreateTime time.Time
	UpdateTime time.Time
}

func (*AccountOne) SetData

func (a *AccountOne) SetData(data accountModel.Account) error

type AccountTemplateList

type AccountTemplateList struct {
	List []AccountTemplateOne
}

type AccountTemplateOne

type AccountTemplateOne struct {
	Id   uint
	Name string
	Icon string
	Type accountModel.Type
}

type AccountUser

type AccountUser struct {
	Id         uint
	AccountId  uint
	UserId     uint
	Info       UserInfo
	Role       accountModel.UserRole
	CreateTime time.Time
}

func (*AccountUser) SetData

func (a *AccountUser) SetData(data accountModel.User) error

type AccountUserConfig

type AccountUserConfig struct {
	Id        uint
	AccountId uint
	UserId    uint
	Trans     struct {
		SyncMappingAccount bool
	}
	CreateTime time.Time
	UpdateTime time.Time
}

func (*AccountUserConfig) SetData

func (auc *AccountUserConfig) SetData(data accountModel.UserConfig) error

type AccountUserInfo

type AccountUserInfo struct {
	TodayTransTotal        *global.IEStatisticWithTime
	CurrentMonthTransTotal *global.IEStatisticWithTime
	RecentTrans            *TransactionDetailList
}

type AccountUserInvitation

type AccountUserInvitation struct {
	Id         uint
	Account    AccountOne
	Inviter    UserInfo
	Invitee    UserInfo
	Status     accountModel.UserInvitationStatus
	Role       accountModel.UserRole
	CreateTime time.Time
}

func (*AccountUserInvitation) SetData

type CategoryDetail

type CategoryDetail struct {
	Id            uint
	Name          string
	Icon          string
	FatherId      uint
	FatherName    string
	IncomeExpense constant.IncomeExpense
}

func (*CategoryDetail) SetData

func (cd *CategoryDetail) SetData(category categoryModel.Category, father categoryModel.Father) error

type CategoryDetailList

type CategoryDetailList []CategoryDetail

func (*CategoryDetailList) SetData

func (cdl *CategoryDetailList) SetData(categoryList dataTool.Slice[uint, categoryModel.Category]) error

type CategoryMappingTree

type CategoryMappingTree struct {
	Tree []CategoryMappingTreeFather
}

type CategoryMappingTreeFather

type CategoryMappingTreeFather struct {
	FatherId    uint
	ChildrenIds []uint
}

func (*CategoryMappingTreeFather) SetDataFromCategoryMapping

func (m *CategoryMappingTreeFather) SetDataFromCategoryMapping(data []categoryModel.Mapping) error

type CategoryOne

type CategoryOne struct {
	Id            uint
	Name          string
	AccountId     uint
	Icon          string
	IncomeExpense constant.IncomeExpense
}

func (*CategoryOne) SetData

func (co *CategoryOne) SetData(category categoryModel.Category) error

type CategoryTree

type CategoryTree struct {
	Tree []FatherOne
}

type CommonCaptcha

type CommonCaptcha struct {
	CaptchaId     string
	PicBase64     string
	CaptchaLength int
	OpenCaptcha   bool
}

type CreateResponse

type CreateResponse struct {
	Id        uint
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Data

type Data struct {
	Data interface{}
	Msg  string `example:"success"`

} // @name Response

type ExpirationTime

type ExpirationTime struct {
	ExpirationTime int
}

type Father

type Father struct {
	NameId
	Children []NameId
}

type FatherOne

type FatherOne struct {
	Id            uint
	Name          string
	AccountId     uint
	IncomeExpense constant.IncomeExpense
	Children      []CategoryOne
}

func (*FatherOne) SetData

func (fo *FatherOne) SetData(father categoryModel.Father, categoryList []categoryModel.Category) error

type Id

type Id struct {
	Id uint
}

type List

type List[T any] struct {
	List []T
}

type Login

type Login struct {
	Token               string
	TokenExpirationTime time.Time
	CurrentAccount      AccountDetail
	CurrentShareAccount AccountDetail
	User                UserOne
}

func (*Login) SetDataFormClientInto

func (l *Login) SetDataFormClientInto(data userModel.UserClientBaseInfo) error

type NameId

type NameId struct {
	Id   uint
	Name string
}

type NameValue

type NameValue struct {
	Name  string
	Value int
}

type NoContent

type NoContent struct {
	Data interface{}
	Msg  string

} // @name NoContent

type PageData

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

type ProductList

type ProductList struct {
	List []ProductOne
}

type ProductMappingTree

type ProductMappingTree struct {
	Tree []ProductMappingTreeFather
}

type ProductMappingTreeFather

type ProductMappingTreeFather struct {
	FatherId uint
	Children []uint
}

type ProductOne

type ProductOne struct {
	UniqueKey string
	Name      string
}

type ProductTransactionCategory

type ProductTransactionCategory struct {
	Id            uint
	Name          string
	IncomeExpense constant.IncomeExpense
}

type ProductTransactionCategoryList

type ProductTransactionCategoryList struct {
	List []ProductTransactionCategory
}

type Register

type Register struct {
	User                UserOne
	Token               string
	TokenExpirationTime time.Time
}

type Token

type Token struct {
	Token               string
	TokenExpirationTime time.Time
}

type TransactionCategoryAmountRank

type TransactionCategoryAmountRank struct {
	Category CategoryOne
	global.AmountCount
}

type TransactionDayStatistic

type TransactionDayStatistic struct {
	global.AmountCount
	Date time.Time
}

type TransactionDetail

type TransactionDetail struct {
	Id                 uint
	UserId             uint
	UserName           string
	AccountId          uint
	AccountName        string
	Amount             int
	CategoryId         uint
	CategoryIcon       string
	CategoryName       string
	CategoryFatherName string
	IncomeExpense      constant.IncomeExpense
	Remark             string
	RecordType         transactionModel.RecordType
	TradeTime          time.Time
	UpdateTime         time.Time
	CreateTime         time.Time
}

TransactionDetail 交易详情

func (*TransactionDetail) SetData

func (*TransactionDetail) SetDataIgnoreErr

func (t *TransactionDetail) SetDataIgnoreErr(
	trans transactionModel.Transaction, account *accountModel.Account,
) error

type TransactionDetailList

type TransactionDetailList []TransactionDetail

TransactionDetailList 交易详情列表

func (*TransactionDetailList) SetData

func (t *TransactionDetailList) SetData(transList []transactionModel.Transaction) error

type TransactionGetList

type TransactionGetList struct {
	List TransactionDetailList
	PageData
}

type TransactionInfo

type TransactionInfo struct {
	Id                 uint
	UserId             uint
	UserName           string
	AccountId          uint
	AccountName        string
	Amount             int
	CategoryId         uint
	CategoryIcon       string
	CategoryName       string
	CategoryFatherName string
	IncomeExpense      constant.IncomeExpense
	Remark             string
	TradeTime          time.Time
}

func (*TransactionInfo) SetData

func (ti *TransactionInfo) SetData(data transactionModel.Info) error

type TransactionInfoList

type TransactionInfoList []TransactionInfo

func (*TransactionInfoList) SetData

type TransactionStatistic

type TransactionStatistic struct {
	global.IEStatistic
	StartTime time.Time
	EndTime   time.Time
}

type TransactionTiming

type TransactionTiming struct {
	Trans  TransactionInfo
	Config TransactionTimingConfig
}

func (*TransactionTiming) SetData

func (tt *TransactionTiming) SetData(data transactionModel.Timing) error

type TransactionTimingConfig

type TransactionTimingConfig struct {
	Id, AccountId, UserId uint
	Type                  transactionModel.TimingType
	OffsetDays            int
	NextTime              time.Time
	Username              string
	Close                 bool
	CreatedAt             time.Time
	UpdatedAt             time.Time
}

type TransactionTimingList

type TransactionTimingList []TransactionTiming

func (*TransactionTimingList) SetData

type TransactionTotal

type TransactionTotal struct {
	global.IEStatistic
}

type TwoLevelTree

type TwoLevelTree struct {
	Tree []Father
}

type UserCurrentClientInfo

type UserCurrentClientInfo struct {
	CurrentAccount      AccountDetail
	CurrentShareAccount AccountDetail
	LoginTime           time.Time
}

func (*UserCurrentClientInfo) SetData

type UserFriendInvitation

type UserFriendInvitation struct {
	Id         uint
	Inviter    UserInfo
	Invitee    UserInfo
	CreateTime time.Time
}

type UserHome

type UserHome struct {
	HeaderCard           *UserHomeHeaderCard
	TimePeriodStatistics *UserHomeTimePeriodStatistics
}

type UserHomeHeaderCard

type UserHomeHeaderCard struct {
	*TransactionStatistic
}

type UserHomeTimePeriodStatistics

type UserHomeTimePeriodStatistics struct {
	TodayData     *TransactionStatistic
	YesterdayData *TransactionStatistic
	WeekData      *TransactionStatistic
	YearData      *TransactionStatistic
}

type UserInfo

type UserInfo struct {
	Id       uint
	Username string
	Email    string
}

func (*UserInfo) SetMaskData

func (u *UserInfo) SetMaskData(data userModel.UserInfo)

type UserOne

type UserOne struct {
	Id         uint
	Username   string
	Email      string
	CreateTime time.Time
}

func (*UserOne) SetData

func (u *UserOne) SetData(data userModel.User) error

type UserTransactionShareConfig

type UserTransactionShareConfig struct {
	Account    bool
	CreateTime bool
	UpdateTime bool
	Remark     bool
}

func (*UserTransactionShareConfig) SetData

Jump to

Keyboard shortcuts

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