// Code generated by gotdgen, DO NOT EDIT.package tgimport ()// No-op definition for keeping imports.var ( _ = bin.Buffer{} _ = context.Background() _ = fmt.Stringer(nil) _ = strings.Builder{} _ = errors.Is _ = multierr.AppendInto _ = sort.Ints _ = tdp.Format _ = tgerr.Error{} _ = tdjson.Encoder{})// Birthday represents TL type `birthday#6c8e1e06`.// Birthday¹ information for a user.// Also used to invite users to gift Telegram Premium subscriptions »¹ to other users// with birthdays within a +1/-1 day time range, related to the current day.//// Links:// 1. https://core.telegram.org/api/profile#birthday// 2. https://core.telegram.org/api/premium#gifting-telegram-premium//// See https://core.telegram.org/constructor/birthday for reference.typeBirthdaystruct {// Flags, see TL conditional fields¹ // // Links: // 1) https://core.telegram.org/mtproto/TL-combinators#conditional-fieldsFlagsbin.Fields// Birth dayDayint// Birth monthMonthint// (Optional) birth year. // // Use SetYear and GetYear helpers.Yearint}// BirthdayTypeID is TL type id of Birthday.constBirthdayTypeID = 0x6c8e1e06// Ensuring interfaces in compile-time for Birthday.var ( _ bin.Encoder = &Birthday{} _ bin.Decoder = &Birthday{} _ bin.BareEncoder = &Birthday{} _ bin.BareDecoder = &Birthday{})func ( *Birthday) () bool {if == nil {returntrue }if !(.Flags.Zero()) {returnfalse }if !(.Day == 0) {returnfalse }if !(.Month == 0) {returnfalse }if !(.Year == 0) {returnfalse }returntrue}// String implements fmt.Stringer.func ( *Birthday) () string {if == nil {return"Birthday(nil)" }typeBirthdayreturnfmt.Sprintf("Birthday%+v", (*))}// FillFrom fills Birthday from given interface.func ( *Birthday) ( interface { () ( int) () ( int) () ( int, bool)}) { .Day = .() .Month = .()if , := .(); { .Year = }}// TypeID returns type id in TL schema.//// See https://core.telegram.org/mtproto/TL-tl#remarks.func (*Birthday) () uint32 {returnBirthdayTypeID}// TypeName returns name of type in TL schema.func (*Birthday) () string {return"birthday"}// TypeInfo returns info about TL type.func ( *Birthday) () tdp.Type { := tdp.Type{Name: "birthday",ID: BirthdayTypeID, }if == nil { .Null = truereturn } .Fields = []tdp.Field{ {Name: "Day",SchemaName: "day", }, {Name: "Month",SchemaName: "month", }, {Name: "Year",SchemaName: "year",Null: !.Flags.Has(0), }, }return}// SetFlags sets flags for non-zero fields.func ( *Birthday) () {if !(.Year == 0) { .Flags.Set(0) }}// Encode implements bin.Encoder.func ( *Birthday) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode birthday#6c8e1e06 as nil") } .PutID(BirthdayTypeID)return .EncodeBare()}// EncodeBare implements bin.BareEncoder.func ( *Birthday) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't encode birthday#6c8e1e06 as nil") } .SetFlags()if := .Flags.Encode(); != nil {returnfmt.Errorf("unable to encode birthday#6c8e1e06: field flags: %w", ) } .PutInt(.Day) .PutInt(.Month)if .Flags.Has(0) { .PutInt(.Year) }returnnil}// Decode implements bin.Decoder.func ( *Birthday) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode birthday#6c8e1e06 to nil") }if := .ConsumeID(BirthdayTypeID); != nil {returnfmt.Errorf("unable to decode birthday#6c8e1e06: %w", ) }return .DecodeBare()}// DecodeBare implements bin.BareDecoder.func ( *Birthday) ( *bin.Buffer) error {if == nil {returnfmt.Errorf("can't decode birthday#6c8e1e06 to nil") } {if := .Flags.Decode(); != nil {returnfmt.Errorf("unable to decode birthday#6c8e1e06: field flags: %w", ) } } { , := .Int()if != nil {returnfmt.Errorf("unable to decode birthday#6c8e1e06: field day: %w", ) } .Day = } { , := .Int()if != nil {returnfmt.Errorf("unable to decode birthday#6c8e1e06: field month: %w", ) } .Month = }if .Flags.Has(0) { , := .Int()if != nil {returnfmt.Errorf("unable to decode birthday#6c8e1e06: field year: %w", ) } .Year = }returnnil}// GetDay returns value of Day field.func ( *Birthday) () ( int) {if == nil {return }return .Day}// GetMonth returns value of Month field.func ( *Birthday) () ( int) {if == nil {return }return .Month}// SetYear sets value of Year conditional field.func ( *Birthday) ( int) { .Flags.Set(0) .Year = }// GetYear returns value of Year conditional field and// boolean which is true if field was set.func ( *Birthday) () ( int, bool) {if == nil {return }if !.Flags.Has(0) {return , false }return .Year, true}
The pages are generated with Goldsv0.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.