Documentation
¶
Overview ¶
Package currency 提供定义货币支付的相关功能
Index ¶
- Variables
- func ErrBalanceNotEnough() error
- func TypeValidator(v Type) bool
- type Currency
- func (m *Currency) Add(tx *orm.Tx, uid int64, val uint, memo string, expire time.Time) error
- func (m *Currency) Del(tx *orm.Tx, uid int64, val uint, memo string) error
- func (m *Currency) Freeze(tx *orm.Tx, u *user.User, val uint, memo string) error
- func (m *Currency) GetLogs(u *user.User, q *LogQuery) (*query.Page[LogPO], error)
- func (m *Currency) GetOverview(uid int64, expire time.Time) (*OverviewVO, error)
- func (m *Currency) GetOverviews(q *query.Text) (*query.Page[OverviewsVO], error)
- func (m *Currency) Unfreeze(tx *orm.Tx, u *user.User, val int64, memo string) error
- type LogPO
- type LogQuery
- type OverviewExpireVO
- type OverviewVO
- type OverviewsVO
- type Type
- func (t Type) IsValid() bool
- func (t Type) MarshalCBOR() ([]byte, error)
- func (t Type) MarshalText() ([]byte, error)
- func (Type) OpenAPISchema(s *openapi.Schema)
- func (Type) PrimitiveType() core.PrimitiveType
- func (t *Type) Scan(src any) error
- func (t Type) String() string
- func (t *Type) UnmarshalCBOR(p []byte) error
- func (t *Type) UnmarshalText(p []byte) error
- func (t Type) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TypeRule = filter.V(TypeValidator, locales.InvalidValue) TypeSliceRule = filter.SV[[]Type](TypeValidator, locales.InvalidValue) TypeFilter = filter.NewBuilder(TypeRule) TypeSliceFilter = filter.NewBuilder(TypeSliceRule) )
Functions ¶
func TypeValidator ¶
Types ¶
type Currency ¶ added in v0.13.0
type Currency struct {
// contains filtered or unexported fields
}
func (*Currency) GetOverview ¶ added in v0.13.0
GetOverview 获取用户 u 的摘要信息
expire Expire 字段返回在此之前过期的积分,如果为空,则 Expire 不返回;
func (*Currency) GetOverviews ¶ added in v0.13.0
GetOverviews 获取所有用户的摘要信息
type LogPO ¶ added in v0.7.11
type LogPO struct {
ID int64 `orm:"name(id);ai" json:"-" yaml:"-" cbor:"-"`
UID int64 `orm:"name(uid)" json:"-" yaml:"-" cbor:"-"`
Created time.Time `orm:"name(created)" json:"created" yaml:"created" cbor:"created"`
Before int64 `orm:"name(before)" json:"before" yaml:"before" cbor:"before" comment:"currency value before action"`
After int64 `orm:"name(after)" json:"after" yaml:"after" cbor:"after" comment:"currency value after action"`
Value int64 `orm:"name(value)" json:"value" yaml:"value" cbor:"value" comment:"add currency value"`
Memo string `orm:"name(memo);len(1000)" json:"memo" yaml:"memo" cbor:"memo" comment:"memo of action"`
Type Type `orm:"name(type);len(10)" json:"type" yaml:"type" cbor:"type" comment:"type of action"`
}
LogPO 货币花费明细
func (*LogPO) BeforeInsert ¶ added in v0.7.11
type OverviewExpireVO ¶
type OverviewVO ¶
type OverviewVO struct {
Available int64 `json:"available" yaml:"available" cbor:"available"`
Freeze int64 `json:"freeze" yaml:"freeze" cbor:"freeze"`
Used int64 `json:"used" yaml:"used" cbor:"used"`
Expire []*OverviewExpireVO `json:"expire,omitempty" yaml:"expire,omitempty" cbor:"expire,omitempty"`
}
type OverviewsVO ¶ added in v0.7.11
type OverviewsVO struct {
UID int64 `json:"uid" yaml:"uid" cbor:"uid"`
NO string `json:"no" yaml:"no" cbor:"no"`
Username string `json:"username" yaml:"username" cbor:"username"`
Available int64 `json:"available" yaml:"available" cbor:"available"`
Freeze int64 `json:"freeze" yaml:"freeze" cbor:"freeze"`
Used int64 `json:"used" yaml:"used" cbor:"used"`
}
type Type ¶
type Type int8
Type 日志类型
func (Type) MarshalCBOR ¶ added in v0.8.14
func (Type) MarshalText ¶
func (Type) OpenAPISchema ¶
func (Type) PrimitiveType ¶
func (Type) PrimitiveType() core.PrimitiveType
func (*Type) UnmarshalCBOR ¶ added in v0.8.14
func (*Type) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.