github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/types/types.go (about) 1 package types 2 3 import ( 4 "fmt" 5 6 "github.com/ydb-platform/ydb-go-genproto/protos/Ydb" 7 8 "github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator" 9 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring" 10 ) 11 12 type Type interface { 13 Yql() string 14 String() string 15 16 ToYDB(a *allocator.Allocator) *Ydb.Type 17 equalsTo(rhs Type) bool 18 } 19 20 func TypeToYDB(t Type, a *allocator.Allocator) *Ydb.Type { 21 return t.ToYDB(a) 22 } 23 24 func TypeFromYDB(x *Ydb.Type) Type { 25 switch v := x.GetType().(type) { 26 case *Ydb.Type_TypeId: 27 return primitiveTypeFromYDB(v.TypeId) 28 29 case *Ydb.Type_OptionalType: 30 return NewOptional(TypeFromYDB(v.OptionalType.GetItem())) 31 32 case *Ydb.Type_ListType: 33 return NewList(TypeFromYDB(v.ListType.GetItem())) 34 35 case *Ydb.Type_DecimalType: 36 d := v.DecimalType 37 38 return NewDecimal(d.GetPrecision(), d.GetScale()) 39 40 case *Ydb.Type_TupleType: 41 t := v.TupleType 42 43 return NewTuple(FromYDB(t.GetElements())...) 44 45 case *Ydb.Type_StructType: 46 s := v.StructType 47 48 return NewStruct(StructFields(s.GetMembers())...) 49 50 case *Ydb.Type_DictType: 51 keyType, valueType := TypeFromYDB(v.DictType.GetKey()), TypeFromYDB(v.DictType.GetPayload()) 52 if valueType.equalsTo(NewVoid()) { 53 return NewSet(keyType) 54 } 55 56 return NewDict(keyType, valueType) 57 58 case *Ydb.Type_VariantType: 59 t := v.VariantType 60 switch x := t.GetType().(type) { 61 case *Ydb.VariantType_TupleItems: 62 return NewVariantTuple(FromYDB(x.TupleItems.GetElements())...) 63 case *Ydb.VariantType_StructItems: 64 return NewVariantStruct(StructFields(x.StructItems.GetMembers())...) 65 default: 66 panic("ydb: unknown variant type") 67 } 68 69 case *Ydb.Type_VoidType: 70 return NewVoid() 71 72 case *Ydb.Type_NullType: 73 return NewNull() 74 75 default: 76 panic("ydb: unknown type") 77 } 78 } 79 80 func primitiveTypeFromYDB(t Ydb.Type_PrimitiveTypeId) Type { 81 switch t { 82 case Ydb.Type_BOOL: 83 return Bool 84 case Ydb.Type_INT8: 85 return Int8 86 case Ydb.Type_UINT8: 87 return Uint8 88 case Ydb.Type_INT16: 89 return Int16 90 case Ydb.Type_UINT16: 91 return Uint16 92 case Ydb.Type_INT32: 93 return Int32 94 case Ydb.Type_UINT32: 95 return Uint32 96 case Ydb.Type_INT64: 97 return Int64 98 case Ydb.Type_UINT64: 99 return Uint64 100 case Ydb.Type_FLOAT: 101 return Float 102 case Ydb.Type_DOUBLE: 103 return Double 104 case Ydb.Type_DATE: 105 return Date 106 case Ydb.Type_DATETIME: 107 return Datetime 108 case Ydb.Type_TIMESTAMP: 109 return Timestamp 110 case Ydb.Type_INTERVAL: 111 return Interval 112 case Ydb.Type_TZ_DATE: 113 return TzDate 114 case Ydb.Type_TZ_DATETIME: 115 return TzDatetime 116 case Ydb.Type_TZ_TIMESTAMP: 117 return TzTimestamp 118 case Ydb.Type_STRING: 119 return Bytes 120 case Ydb.Type_UTF8: 121 return Text 122 case Ydb.Type_YSON: 123 return YSON 124 case Ydb.Type_JSON: 125 return JSON 126 case Ydb.Type_UUID: 127 return UUID 128 case Ydb.Type_JSON_DOCUMENT: 129 return JSONDocument 130 case Ydb.Type_DYNUMBER: 131 return DyNumber 132 default: 133 panic("ydb: unexpected type") 134 } 135 } 136 137 func FromYDB(es []*Ydb.Type) []Type { 138 ts := make([]Type, len(es)) 139 for i, el := range es { 140 ts[i] = TypeFromYDB(el) 141 } 142 143 return ts 144 } 145 146 func Equal(a, b Type) bool { 147 return a.equalsTo(b) 148 } 149 150 type Decimal struct { 151 precision uint32 152 scale uint32 153 } 154 155 func (v *Decimal) Precision() uint32 { 156 return v.precision 157 } 158 159 func (v *Decimal) Scale() uint32 { 160 return v.scale 161 } 162 163 func (v *Decimal) String() string { 164 return v.Yql() 165 } 166 167 func (v *Decimal) Name() string { 168 return "Decimal" 169 } 170 171 func (v *Decimal) Yql() string { 172 return fmt.Sprintf("%s(%d,%d)", v.Name(), v.precision, v.scale) 173 } 174 175 func (v *Decimal) equalsTo(rhs Type) bool { 176 vv, ok := rhs.(*Decimal) 177 178 return ok && *v == *vv 179 } 180 181 func (v *Decimal) ToYDB(a *allocator.Allocator) *Ydb.Type { 182 decimal := a.Decimal() 183 184 decimal.Scale = v.scale 185 decimal.Precision = v.precision 186 187 typeDecimal := a.TypeDecimal() 188 typeDecimal.DecimalType = decimal 189 190 t := a.Type() 191 t.Type = typeDecimal 192 193 return t 194 } 195 196 func NewDecimal(precision, scale uint32) *Decimal { 197 return &Decimal{ 198 precision: precision, 199 scale: scale, 200 } 201 } 202 203 type Dict struct { 204 keyType Type 205 valueType Type 206 } 207 208 func (v *Dict) KeyType() Type { 209 return v.keyType 210 } 211 212 func (v *Dict) ValueType() Type { 213 return v.valueType 214 } 215 216 func (v *Dict) String() string { 217 return v.Yql() 218 } 219 220 func (v *Dict) Yql() string { 221 buffer := xstring.Buffer() 222 defer buffer.Free() 223 buffer.WriteString("Dict<") 224 buffer.WriteString(v.keyType.Yql()) 225 buffer.WriteByte(',') 226 buffer.WriteString(v.valueType.Yql()) 227 buffer.WriteByte('>') 228 229 return buffer.String() 230 } 231 232 func (v *Dict) equalsTo(rhs Type) bool { 233 vv, ok := rhs.(*Dict) 234 if !ok { 235 return false 236 } 237 if !v.keyType.equalsTo(vv.keyType) { 238 return false 239 } 240 if !v.valueType.equalsTo(vv.valueType) { 241 return false 242 } 243 244 return true 245 } 246 247 func (v *Dict) ToYDB(a *allocator.Allocator) *Ydb.Type { 248 t := a.Type() 249 250 typeDict := a.TypeDict() 251 252 typeDict.DictType = a.Dict() 253 254 typeDict.DictType.Key = v.keyType.ToYDB(a) 255 typeDict.DictType.Payload = v.valueType.ToYDB(a) 256 257 t.Type = typeDict 258 259 return t 260 } 261 262 func NewDict(key, value Type) (v *Dict) { 263 return &Dict{ 264 keyType: key, 265 valueType: value, 266 } 267 } 268 269 type EmptyList struct{} 270 271 func (v EmptyList) Yql() string { 272 return "EmptyList" 273 } 274 275 func (v EmptyList) String() string { 276 return v.Yql() 277 } 278 279 func (EmptyList) equalsTo(rhs Type) bool { 280 _, ok := rhs.(EmptyList) 281 282 return ok 283 } 284 285 func (EmptyList) ToYDB(a *allocator.Allocator) *Ydb.Type { 286 t := a.Type() 287 288 t.Type = a.TypeEmptyList() 289 290 return t 291 } 292 293 func NewEmptyList() EmptyList { 294 return EmptyList{} 295 } 296 297 type EmptyDict struct{} 298 299 func (v EmptyDict) String() string { 300 return v.Yql() 301 } 302 303 func (v EmptyDict) Yql() string { 304 return "EmptyDict" 305 } 306 307 func (EmptyDict) equalsTo(rhs Type) bool { 308 _, ok := rhs.(EmptyDict) 309 310 return ok 311 } 312 313 func (EmptyDict) ToYDB(a *allocator.Allocator) *Ydb.Type { 314 t := a.Type() 315 316 t.Type = a.TypeEmptyDict() 317 318 return t 319 } 320 321 func EmptySet() EmptyDict { 322 return EmptyDict{} 323 } 324 325 func NewEmptyDict() EmptyDict { 326 return EmptyDict{} 327 } 328 329 type List struct { 330 itemType Type 331 } 332 333 func (v *List) ItemType() Type { 334 return v.itemType 335 } 336 337 func (v *List) String() string { 338 return v.Yql() 339 } 340 341 func (v *List) Yql() string { 342 return "List<" + v.itemType.Yql() + ">" 343 } 344 345 func (v *List) equalsTo(rhs Type) bool { 346 vv, ok := rhs.(*List) 347 if !ok { 348 return false 349 } 350 351 return v.itemType.equalsTo(vv.itemType) 352 } 353 354 func (v *List) ToYDB(a *allocator.Allocator) *Ydb.Type { 355 t := a.Type() 356 357 list := a.List() 358 359 list.Item = v.itemType.ToYDB(a) 360 361 typeList := a.TypeList() 362 typeList.ListType = list 363 364 t.Type = typeList 365 366 return t 367 } 368 369 func NewList(t Type) *List { 370 return &List{ 371 itemType: t, 372 } 373 } 374 375 type Set struct { 376 itemType Type 377 } 378 379 func (v *Set) ItemType() Type { 380 return v.itemType 381 } 382 383 func (v *Set) String() string { 384 return v.Yql() 385 } 386 387 func (v *Set) Yql() string { 388 return "Set<" + v.itemType.Yql() + ">" 389 } 390 391 func (v *Set) equalsTo(rhs Type) bool { 392 vv, ok := rhs.(*Set) 393 if !ok { 394 return false 395 } 396 397 return v.itemType.equalsTo(vv.itemType) 398 } 399 400 func (v *Set) ToYDB(a *allocator.Allocator) *Ydb.Type { 401 t := a.Type() 402 403 typeDict := a.TypeDict() 404 405 typeDict.DictType = a.Dict() 406 407 typeDict.DictType.Key = v.itemType.ToYDB(a) 408 typeDict.DictType.Payload = _voidType 409 410 t.Type = typeDict 411 412 return t 413 } 414 415 func NewSet(t Type) *Set { 416 return &Set{ 417 itemType: t, 418 } 419 } 420 421 type Optional struct { 422 innerType Type 423 } 424 425 func (v Optional) IsOptional() {} 426 427 func (v Optional) InnerType() Type { 428 return v.innerType 429 } 430 431 func (v Optional) String() string { 432 return v.Yql() 433 } 434 435 func (v Optional) Yql() string { 436 return "Optional<" + v.innerType.Yql() + ">" 437 } 438 439 func (v Optional) equalsTo(rhs Type) bool { 440 vv, ok := rhs.(Optional) 441 if !ok { 442 return false 443 } 444 445 return v.innerType.equalsTo(vv.innerType) 446 } 447 448 func (v Optional) ToYDB(a *allocator.Allocator) *Ydb.Type { 449 t := a.Type() 450 451 typeOptional := a.TypeOptional() 452 453 typeOptional.OptionalType = a.Optional() 454 455 typeOptional.OptionalType.Item = v.innerType.ToYDB(a) 456 457 t.Type = typeOptional 458 459 return t 460 } 461 462 func NewOptional(t Type) Optional { 463 return Optional{ 464 innerType: t, 465 } 466 } 467 468 type Primitive uint 469 470 func (v Primitive) String() string { 471 return v.Yql() 472 } 473 474 func (v Primitive) Yql() string { 475 return primitiveString[v] 476 } 477 478 const ( 479 Unknown Primitive = iota 480 Bool 481 Int8 482 Uint8 483 Int16 484 Uint16 485 Int32 486 Uint32 487 Int64 488 Uint64 489 Float 490 Double 491 Date 492 Datetime 493 Timestamp 494 Interval 495 TzDate 496 TzDatetime 497 TzTimestamp 498 Bytes 499 Text 500 YSON 501 JSON 502 UUID 503 JSONDocument 504 DyNumber 505 ) 506 507 var primitive = [...]*Ydb.Type{ 508 Bool: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_BOOL}}, 509 Int8: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_INT8}}, 510 Uint8: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UINT8}}, 511 Int16: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_INT16}}, 512 Uint16: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UINT16}}, 513 Int32: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_INT32}}, 514 Uint32: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UINT32}}, 515 Int64: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_INT64}}, 516 Uint64: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UINT64}}, 517 Float: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_FLOAT}}, 518 Double: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_DOUBLE}}, 519 Date: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_DATE}}, 520 Datetime: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_DATETIME}}, 521 Timestamp: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_TIMESTAMP}}, 522 Interval: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_INTERVAL}}, 523 TzDate: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_TZ_DATE}}, 524 TzDatetime: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_TZ_DATETIME}}, 525 TzTimestamp: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_TZ_TIMESTAMP}}, 526 Bytes: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_STRING}}, 527 Text: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UTF8}}, 528 YSON: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_YSON}}, 529 JSON: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_JSON}}, 530 UUID: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_UUID}}, 531 JSONDocument: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_JSON_DOCUMENT}}, 532 DyNumber: {Type: &Ydb.Type_TypeId{TypeId: Ydb.Type_DYNUMBER}}, 533 } 534 535 var primitiveString = [...]string{ 536 Unknown: "<unknown>", 537 Bool: "Bool", 538 Int8: "Int8", 539 Uint8: "Uint8", 540 Int16: "Int16", 541 Uint16: "Uint16", 542 Int32: "Int32", 543 Uint32: "Uint32", 544 Int64: "Int64", 545 Uint64: "Uint64", 546 Float: "Float", 547 Double: "Double", 548 Date: "Date", 549 Datetime: "Datetime", 550 Timestamp: "Timestamp", 551 Interval: "Interval", 552 TzDate: "TzDate", 553 TzDatetime: "TzDatetime", 554 TzTimestamp: "TzTimestamp", 555 Bytes: "String", 556 Text: "Utf8", 557 YSON: "Yson", 558 JSON: "Json", 559 UUID: "Uuid", 560 JSONDocument: "JsonDocument", 561 DyNumber: "DyNumber", 562 } 563 564 func (v Primitive) equalsTo(rhs Type) bool { 565 vv, ok := rhs.(Primitive) 566 if !ok { 567 return false 568 } 569 570 return v == vv 571 } 572 573 func (v Primitive) ToYDB(*allocator.Allocator) *Ydb.Type { 574 return primitive[v] 575 } 576 577 type ( 578 StructField struct { 579 Name string 580 T Type 581 } 582 Struct struct { 583 fields []StructField 584 } 585 ) 586 587 func (v *Struct) Field(i int) StructField { 588 return v.fields[i] 589 } 590 591 func (v *Struct) Fields() []StructField { 592 return v.fields 593 } 594 595 func (v *Struct) String() string { 596 return v.Yql() 597 } 598 599 func (v *Struct) Yql() string { 600 buffer := xstring.Buffer() 601 defer buffer.Free() 602 buffer.WriteString("Struct<") 603 for i := range v.fields { 604 if i > 0 { 605 buffer.WriteByte(',') 606 } 607 buffer.WriteString("'" + v.fields[i].Name + "'") 608 buffer.WriteByte(':') 609 buffer.WriteString(v.fields[i].T.Yql()) 610 } 611 buffer.WriteByte('>') 612 613 return buffer.String() 614 } 615 616 func (v *Struct) equalsTo(rhs Type) bool { 617 vv, ok := rhs.(*Struct) 618 if !ok { 619 return false 620 } 621 if len(v.fields) != len(vv.fields) { 622 return false 623 } 624 for i := range v.fields { 625 if v.fields[i].Name != vv.fields[i].Name { 626 return false 627 } 628 if !v.fields[i].T.equalsTo(vv.fields[i].T) { 629 return false 630 } 631 } 632 633 return true 634 } 635 636 func (v *Struct) ToYDB(a *allocator.Allocator) *Ydb.Type { 637 t := a.Type() 638 639 typeStruct := a.TypeStruct() 640 641 typeStruct.StructType = a.Struct() 642 643 for i := range v.fields { 644 structMember := a.StructMember() 645 structMember.Name = v.fields[i].Name 646 structMember.Type = v.fields[i].T.ToYDB(a) 647 typeStruct.StructType.Members = append( 648 typeStruct.StructType.GetMembers(), 649 structMember, 650 ) 651 } 652 653 t.Type = typeStruct 654 655 return t 656 } 657 658 func NewStruct(fields ...StructField) (v *Struct) { 659 return &Struct{ 660 fields: fields, 661 } 662 } 663 664 func StructFields(ms []*Ydb.StructMember) []StructField { 665 fs := make([]StructField, len(ms)) 666 for i, m := range ms { 667 fs[i] = StructField{ 668 Name: m.GetName(), 669 T: TypeFromYDB(m.GetType()), 670 } 671 } 672 673 return fs 674 } 675 676 type Tuple struct { 677 innerTypes []Type 678 } 679 680 func (v *Tuple) InnerTypes() []Type { 681 return v.innerTypes 682 } 683 684 func (v *Tuple) ItemType(i int) Type { 685 return v.innerTypes[i] 686 } 687 688 func (v *Tuple) String() string { 689 return v.Yql() 690 } 691 692 func (v *Tuple) Yql() string { 693 buffer := xstring.Buffer() 694 defer buffer.Free() 695 buffer.WriteString("Tuple<") 696 for i, t := range v.innerTypes { 697 if i > 0 { 698 buffer.WriteByte(',') 699 } 700 buffer.WriteString(t.Yql()) 701 } 702 buffer.WriteByte('>') 703 704 return buffer.String() 705 } 706 707 func (v *Tuple) equalsTo(rhs Type) bool { 708 vv, ok := rhs.(*Tuple) 709 if !ok { 710 return false 711 } 712 if len(v.innerTypes) != len(vv.innerTypes) { 713 return false 714 } 715 for i := range v.innerTypes { 716 if !v.innerTypes[i].equalsTo(vv.innerTypes[i]) { 717 return false 718 } 719 } 720 721 return true 722 } 723 724 func (v *Tuple) ToYDB(a *allocator.Allocator) *Ydb.Type { 725 var items []Type 726 if v != nil { 727 items = v.innerTypes 728 } 729 t := a.Type() 730 731 typeTuple := a.TypeTuple() 732 733 typeTuple.TupleType = a.Tuple() 734 735 for _, vv := range items { 736 typeTuple.TupleType.Elements = append(typeTuple.TupleType.GetElements(), vv.ToYDB(a)) 737 } 738 739 t.Type = typeTuple 740 741 return t 742 } 743 744 func NewTuple(items ...Type) (v *Tuple) { 745 return &Tuple{ 746 innerTypes: items, 747 } 748 } 749 750 type VariantStruct struct { 751 *Struct 752 } 753 754 func (v *VariantStruct) Yql() string { 755 buffer := xstring.Buffer() 756 defer buffer.Free() 757 buffer.WriteString("Variant<") 758 for i := range v.fields { 759 if i > 0 { 760 buffer.WriteByte(',') 761 } 762 buffer.WriteString("'" + v.fields[i].Name + "'") 763 buffer.WriteByte(':') 764 buffer.WriteString(v.fields[i].T.Yql()) 765 } 766 buffer.WriteByte('>') 767 768 return buffer.String() 769 } 770 771 func (v *VariantStruct) equalsTo(rhs Type) bool { 772 switch t := rhs.(type) { 773 case *VariantStruct: 774 return v.Struct.equalsTo(t.Struct) 775 case *Struct: 776 return v.Struct.equalsTo(t) 777 default: 778 return false 779 } 780 } 781 782 func (v *VariantStruct) ToYDB(a *allocator.Allocator) *Ydb.Type { 783 t := a.Type() 784 785 typeVariant := a.TypeVariant() 786 787 typeVariant.VariantType = a.Variant() 788 789 structItems := a.VariantStructItems() 790 structItems.StructItems = v.Struct.ToYDB(a).GetType().(*Ydb.Type_StructType).StructType 791 792 typeVariant.VariantType.Type = structItems 793 794 t.Type = typeVariant 795 796 return t 797 } 798 799 func NewVariantStruct(fields ...StructField) *VariantStruct { 800 return &VariantStruct{ 801 Struct: NewStruct(fields...), 802 } 803 } 804 805 type VariantTuple struct { 806 *Tuple 807 } 808 809 func (v *VariantTuple) Yql() string { 810 buffer := xstring.Buffer() 811 defer buffer.Free() 812 buffer.WriteString("Variant<") 813 for i, t := range v.innerTypes { 814 if i > 0 { 815 buffer.WriteByte(',') 816 } 817 buffer.WriteString(t.Yql()) 818 } 819 buffer.WriteByte('>') 820 821 return buffer.String() 822 } 823 824 func (v *VariantTuple) equalsTo(rhs Type) bool { 825 switch t := rhs.(type) { 826 case *VariantTuple: 827 return v.Tuple.equalsTo(t.Tuple) 828 case *Tuple: 829 return v.Tuple.equalsTo(t) 830 default: 831 return false 832 } 833 } 834 835 func (v *VariantTuple) ToYDB(a *allocator.Allocator) *Ydb.Type { 836 t := a.Type() 837 838 typeVariant := a.TypeVariant() 839 840 typeVariant.VariantType = a.Variant() 841 842 tupleItems := a.VariantTupleItems() 843 tupleItems.TupleItems = v.Tuple.ToYDB(a).GetType().(*Ydb.Type_TupleType).TupleType 844 845 typeVariant.VariantType.Type = tupleItems 846 847 t.Type = typeVariant 848 849 return t 850 } 851 852 func NewVariantTuple(items ...Type) *VariantTuple { 853 return &VariantTuple{ 854 Tuple: NewTuple(items...), 855 } 856 } 857 858 type Void struct{} 859 860 func (v Void) String() string { 861 return v.Yql() 862 } 863 864 func (v Void) Yql() string { 865 return "Void" 866 } 867 868 var _voidType = &Ydb.Type{ 869 Type: &Ydb.Type_VoidType{}, 870 } 871 872 func (v Void) equalsTo(rhs Type) bool { 873 _, ok := rhs.(Void) 874 875 return ok 876 } 877 878 func (Void) ToYDB(*allocator.Allocator) *Ydb.Type { 879 return _voidType 880 } 881 882 func NewVoid() Void { 883 return Void{} 884 } 885 886 type Null struct{} 887 888 func (v Null) String() string { 889 return v.Yql() 890 } 891 892 func (v Null) Yql() string { 893 return "Null" 894 } 895 896 var _nullType = &Ydb.Type{ 897 Type: &Ydb.Type_NullType{}, 898 } 899 900 func (v Null) equalsTo(rhs Type) bool { 901 _, ok := rhs.(Null) 902 903 return ok 904 } 905 906 func (Null) ToYDB(*allocator.Allocator) *Ydb.Type { 907 return _nullType 908 } 909 910 func NewNull() Null { 911 return Null{} 912 }