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 BusinessWeeklyOpen struct {
StartMinute int
EndMinute int
}
const BusinessWeeklyOpenTypeID = 0x120b1ab9
var (
_ bin .Encoder = &BusinessWeeklyOpen {}
_ bin .Decoder = &BusinessWeeklyOpen {}
_ bin .BareEncoder = &BusinessWeeklyOpen {}
_ bin .BareDecoder = &BusinessWeeklyOpen {}
)
func (b *BusinessWeeklyOpen ) Zero () bool {
if b == nil {
return true
}
if !(b .StartMinute == 0 ) {
return false
}
if !(b .EndMinute == 0 ) {
return false
}
return true
}
func (b *BusinessWeeklyOpen ) String () string {
if b == nil {
return "BusinessWeeklyOpen(nil)"
}
type Alias BusinessWeeklyOpen
return fmt .Sprintf ("BusinessWeeklyOpen%+v" , Alias (*b ))
}
func (b *BusinessWeeklyOpen ) FillFrom (from interface {
GetStartMinute () (value int )
GetEndMinute () (value int )
}) {
b .StartMinute = from .GetStartMinute ()
b .EndMinute = from .GetEndMinute ()
}
func (*BusinessWeeklyOpen ) TypeID () uint32 {
return BusinessWeeklyOpenTypeID
}
func (*BusinessWeeklyOpen ) TypeName () string {
return "businessWeeklyOpen"
}
func (b *BusinessWeeklyOpen ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "businessWeeklyOpen" ,
ID : BusinessWeeklyOpenTypeID ,
}
if b == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "StartMinute" ,
SchemaName : "start_minute" ,
},
{
Name : "EndMinute" ,
SchemaName : "end_minute" ,
},
}
return typ
}
func (b *BusinessWeeklyOpen ) Encode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode businessWeeklyOpen#120b1ab9 as nil" )
}
buf .PutID (BusinessWeeklyOpenTypeID )
return b .EncodeBare (buf )
}
func (b *BusinessWeeklyOpen ) EncodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't encode businessWeeklyOpen#120b1ab9 as nil" )
}
buf .PutInt (b .StartMinute )
buf .PutInt (b .EndMinute )
return nil
}
func (b *BusinessWeeklyOpen ) Decode (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode businessWeeklyOpen#120b1ab9 to nil" )
}
if err := buf .ConsumeID (BusinessWeeklyOpenTypeID ); err != nil {
return fmt .Errorf ("unable to decode businessWeeklyOpen#120b1ab9: %w" , err )
}
return b .DecodeBare (buf )
}
func (b *BusinessWeeklyOpen ) DecodeBare (buf *bin .Buffer ) error {
if b == nil {
return fmt .Errorf ("can't decode businessWeeklyOpen#120b1ab9 to nil" )
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode businessWeeklyOpen#120b1ab9: field start_minute: %w" , err )
}
b .StartMinute = value
}
{
value , err := buf .Int ()
if err != nil {
return fmt .Errorf ("unable to decode businessWeeklyOpen#120b1ab9: field end_minute: %w" , err )
}
b .EndMinute = value
}
return nil
}
func (b *BusinessWeeklyOpen ) GetStartMinute () (value int ) {
if b == nil {
return
}
return b .StartMinute
}
func (b *BusinessWeeklyOpen ) GetEndMinute () (value int ) {
if b == nil {
return
}
return b .EndMinute
}
The pages are generated with Golds v0.8.4 . (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 .