package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type WalletHolderDC struct {
DC int
PublicKey []byte
}
const WalletHolderDCTypeID = 0xf9d612ef
var (
_ bin .Encoder = &WalletHolderDC {}
_ bin .Decoder = &WalletHolderDC {}
_ bin .BareEncoder = &WalletHolderDC {}
_ bin .BareDecoder = &WalletHolderDC {}
)
func (h *WalletHolderDC ) Zero () bool {
if h == nil {
return true
}
if !(h .DC == 0 ) {
return false
}
if !(h .PublicKey == nil ) {
return false
}
return true
}
func (h *WalletHolderDC ) String () string {
if h == nil {
return "WalletHolderDC(nil)"
}
type Alias WalletHolderDC
return fmt .Sprintf ("WalletHolderDC%+v" , Alias (*h ))
}
func (h *WalletHolderDC ) FillFrom (from interface {
GetDC () (value int )
GetPublicKey () (value []byte )
}) {
h .DC = from .GetDC ()
h .PublicKey = from .GetPublicKey ()
}
func (*WalletHolderDC ) TypeID () uint32 {
return WalletHolderDCTypeID
}
func (*WalletHolderDC ) TypeName () string {
return "wallet.holderDc"
}
func (h *WalletHolderDC ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "wallet.holderDc" ,
ID : WalletHolderDCTypeID ,
}
if h == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "DC" ,
SchemaName : "dc" ,
},
{
Name : "PublicKey" ,
SchemaName : "public_key" ,
},
}
return typ
}
func (h *WalletHolderDC ) Encode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode wallet.holderDc#f9d612ef as nil" )
}
b .PutID (WalletHolderDCTypeID )
return h .EncodeBare (b )
}
func (h *WalletHolderDC ) EncodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't encode wallet.holderDc#f9d612ef as nil" )
}
b .PutInt (h .DC )
b .PutBytes (h .PublicKey )
return nil
}
func (h *WalletHolderDC ) Decode (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode wallet.holderDc#f9d612ef to nil" )
}
if err := b .ConsumeID (WalletHolderDCTypeID ); err != nil {
return fmt .Errorf ("unable to decode wallet.holderDc#f9d612ef: %w" , err )
}
return h .DecodeBare (b )
}
func (h *WalletHolderDC ) DecodeBare (b *bin .Buffer ) error {
if h == nil {
return fmt .Errorf ("can't decode wallet.holderDc#f9d612ef to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.holderDc#f9d612ef: field dc: %w" , err )
}
h .DC = value
}
{
value , err := b .Bytes ()
if err != nil {
return fmt .Errorf ("unable to decode wallet.holderDc#f9d612ef: field public_key: %w" , err )
}
h .PublicKey = value
}
return nil
}
func (h *WalletHolderDC ) GetDC () (value int ) {
if h == nil {
return
}
return h .DC
}
func (h *WalletHolderDC ) GetPublicKey () (value []byte ) {
if h == nil {
return
}
return h .PublicKey
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .