25 lines
561 B
Go
Raw 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-26 20:42:30 +08:00
Balance decimal.Decimal `json:"amount" sql:"type:decimal(30,2);"`
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),
}
}