feat: complete charge
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
type UserOAuth struct {
|
||||
@@ -16,7 +18,7 @@ type UserOAuth struct {
|
||||
Unionid string `json:"unionid,omitempty"`
|
||||
}
|
||||
|
||||
func (x UserOAuth) Scan(value interface{}) (err error) {
|
||||
func (x *UserOAuth) Scan(value interface{}) (err error) {
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
return json.Unmarshal([]byte(v), &x)
|
||||
@@ -31,3 +33,36 @@ func (x UserOAuth) Scan(value interface{}) (err error) {
|
||||
func (x UserOAuth) Value() (driver.Value, error) {
|
||||
return json.Marshal(x)
|
||||
}
|
||||
|
||||
type BalanceTarget struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x BalanceTarget) MustValue() driver.Value {
|
||||
return lo.Must(json.Marshal(x))
|
||||
}
|
||||
|
||||
func (x *BalanceTarget) Scan(value interface{}) (err error) {
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
return json.Unmarshal([]byte(v), &x)
|
||||
case []byte:
|
||||
return json.Unmarshal(v, &x)
|
||||
case *string:
|
||||
return json.Unmarshal([]byte(*v), &x)
|
||||
}
|
||||
return errors.New("Unknown type for ")
|
||||
}
|
||||
|
||||
func (x BalanceTarget) Value() (driver.Value, error) {
|
||||
return json.Marshal(x)
|
||||
}
|
||||
|
||||
// swagger:enum BalanceType
|
||||
// ENUM(
|
||||
// Charge = "charge",
|
||||
// Consume = "consume",
|
||||
// Refund = "refund",
|
||||
// )
|
||||
type BalanceType string
|
||||
|
||||
Reference in New Issue
Block a user