]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | // Licensed to the Apache Software Foundation (ASF) under one |
2 | // or more contributor license agreements. See the NOTICE file | |
3 | // distributed with this work for additional information | |
4 | // regarding copyright ownership. The ASF licenses this file | |
5 | // to you under the Apache License, Version 2.0 (the | |
6 | // "License"); you may not use this file except in compliance | |
7 | // with the License. You may obtain a copy of the License at | |
8 | // | |
9 | // http://www.apache.org/licenses/LICENSE-2.0 | |
10 | // | |
11 | // Unless required by applicable law or agreed to in writing, software | |
12 | // distributed under the License is distributed on an "AS IS" BASIS, | |
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | // See the License for the specific language governing permissions and | |
15 | // limitations under the License. | |
16 | ||
17 | // Code generated by the FlatBuffers compiler. DO NOT EDIT. | |
18 | ||
19 | package flatbuf | |
20 | ||
21 | import ( | |
22 | flatbuffers "github.com/google/flatbuffers/go" | |
23 | ) | |
24 | ||
25 | type DictionaryEncoding struct { | |
26 | _tab flatbuffers.Table | |
27 | } | |
28 | ||
29 | func GetRootAsDictionaryEncoding(buf []byte, offset flatbuffers.UOffsetT) *DictionaryEncoding { | |
30 | n := flatbuffers.GetUOffsetT(buf[offset:]) | |
31 | x := &DictionaryEncoding{} | |
32 | x.Init(buf, n+offset) | |
33 | return x | |
34 | } | |
35 | ||
36 | func (rcv *DictionaryEncoding) Init(buf []byte, i flatbuffers.UOffsetT) { | |
37 | rcv._tab.Bytes = buf | |
38 | rcv._tab.Pos = i | |
39 | } | |
40 | ||
41 | func (rcv *DictionaryEncoding) Table() flatbuffers.Table { | |
42 | return rcv._tab | |
43 | } | |
44 | ||
45 | /// The known dictionary id in the application where this data is used. In | |
46 | /// the file or streaming formats, the dictionary ids are found in the | |
47 | /// DictionaryBatch messages | |
48 | func (rcv *DictionaryEncoding) Id() int64 { | |
49 | o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) | |
50 | if o != 0 { | |
51 | return rcv._tab.GetInt64(o + rcv._tab.Pos) | |
52 | } | |
53 | return 0 | |
54 | } | |
55 | ||
56 | /// The known dictionary id in the application where this data is used. In | |
57 | /// the file or streaming formats, the dictionary ids are found in the | |
58 | /// DictionaryBatch messages | |
59 | func (rcv *DictionaryEncoding) MutateId(n int64) bool { | |
60 | return rcv._tab.MutateInt64Slot(4, n) | |
61 | } | |
62 | ||
63 | /// The dictionary indices are constrained to be non-negative integers. If | |
64 | /// this field is null, the indices must be signed int32. To maximize | |
65 | /// cross-language compatibility and performance, implementations are | |
66 | /// recommended to prefer signed integer types over unsigned integer types | |
67 | /// and to avoid uint64 indices unless they are required by an application. | |
68 | func (rcv *DictionaryEncoding) IndexType(obj *Int) *Int { | |
69 | o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) | |
70 | if o != 0 { | |
71 | x := rcv._tab.Indirect(o + rcv._tab.Pos) | |
72 | if obj == nil { | |
73 | obj = new(Int) | |
74 | } | |
75 | obj.Init(rcv._tab.Bytes, x) | |
76 | return obj | |
77 | } | |
78 | return nil | |
79 | } | |
80 | ||
81 | /// The dictionary indices are constrained to be non-negative integers. If | |
82 | /// this field is null, the indices must be signed int32. To maximize | |
83 | /// cross-language compatibility and performance, implementations are | |
84 | /// recommended to prefer signed integer types over unsigned integer types | |
85 | /// and to avoid uint64 indices unless they are required by an application. | |
86 | /// By default, dictionaries are not ordered, or the order does not have | |
87 | /// semantic meaning. In some statistical, applications, dictionary-encoding | |
88 | /// is used to represent ordered categorical data, and we provide a way to | |
89 | /// preserve that metadata here | |
90 | func (rcv *DictionaryEncoding) IsOrdered() bool { | |
91 | o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) | |
92 | if o != 0 { | |
93 | return rcv._tab.GetBool(o + rcv._tab.Pos) | |
94 | } | |
95 | return false | |
96 | } | |
97 | ||
98 | /// By default, dictionaries are not ordered, or the order does not have | |
99 | /// semantic meaning. In some statistical, applications, dictionary-encoding | |
100 | /// is used to represent ordered categorical data, and we provide a way to | |
101 | /// preserve that metadata here | |
102 | func (rcv *DictionaryEncoding) MutateIsOrdered(n bool) bool { | |
103 | return rcv._tab.MutateBoolSlot(8, n) | |
104 | } | |
105 | ||
106 | func (rcv *DictionaryEncoding) DictionaryKind() DictionaryKind { | |
107 | o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) | |
108 | if o != 0 { | |
109 | return DictionaryKind(rcv._tab.GetInt16(o + rcv._tab.Pos)) | |
110 | } | |
111 | return 0 | |
112 | } | |
113 | ||
114 | func (rcv *DictionaryEncoding) MutateDictionaryKind(n DictionaryKind) bool { | |
115 | return rcv._tab.MutateInt16Slot(10, int16(n)) | |
116 | } | |
117 | ||
118 | func DictionaryEncodingStart(builder *flatbuffers.Builder) { | |
119 | builder.StartObject(4) | |
120 | } | |
121 | func DictionaryEncodingAddId(builder *flatbuffers.Builder, id int64) { | |
122 | builder.PrependInt64Slot(0, id, 0) | |
123 | } | |
124 | func DictionaryEncodingAddIndexType(builder *flatbuffers.Builder, indexType flatbuffers.UOffsetT) { | |
125 | builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(indexType), 0) | |
126 | } | |
127 | func DictionaryEncodingAddIsOrdered(builder *flatbuffers.Builder, isOrdered bool) { | |
128 | builder.PrependBoolSlot(2, isOrdered, false) | |
129 | } | |
130 | func DictionaryEncodingAddDictionaryKind(builder *flatbuffers.Builder, dictionaryKind DictionaryKind) { | |
131 | builder.PrependInt16Slot(3, int16(dictionaryKind), 0) | |
132 | } | |
133 | func DictionaryEncodingEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { | |
134 | return builder.EndObject() | |
135 | } |