25 lines
562 B
Go
Raw Permalink Normal View History

2025-01-25 18:33:11 +08:00
package models
import (
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
2025-01-26 19:51:35 +08:00
"git.solsynth.dev/hypernet/wallet/pkg/proto"
2025-01-25 18:33:11 +08:00
"github.com/shopspring/decimal"
)
type Wallet struct {
cruda.BaseModel
2025-01-29 02:25:45 +08:00
Balance decimal.Decimal `json:"balance" sql:"type:decimal(30,2);"`
2025-01-26 20:42:30 +08:00
Password string `json:"password"`
AccountID uint `json:"account_id"`
2025-01-25 18:33:11 +08:00
}
2025-01-26 19:51:35 +08:00
func (v *Wallet) ToWalletInfo() *proto.WalletInfo {
balance, _ := v.Balance.Float64()
return &proto.WalletInfo{
Id: uint64(v.ID),
Balance: balance,
AccountId: uint64(v.AccountID),
}
}