@@ -12,23 +12,23 @@ import (
1212 "github.com/goccy/go-json"
1313)
1414
15- type MacBuilder struct {
15+ type MACBuilder struct {
1616 * array.ExtensionBuilder
1717}
1818
19- func NewMacBuilder (builder * array.ExtensionBuilder ) * MacBuilder {
20- return & MacBuilder {ExtensionBuilder : builder }
19+ func NewMACBuilder (builder * array.ExtensionBuilder ) * MACBuilder {
20+ return & MACBuilder {ExtensionBuilder : builder }
2121}
2222
23- func (b * MacBuilder ) Append (v net.HardwareAddr ) {
23+ func (b * MACBuilder ) Append (v net.HardwareAddr ) {
2424 b .ExtensionBuilder .Builder .(* array.BinaryBuilder ).Append (v [:])
2525}
2626
27- func (b * MacBuilder ) UnsafeAppend (v net.HardwareAddr ) {
27+ func (b * MACBuilder ) UnsafeAppend (v net.HardwareAddr ) {
2828 b .ExtensionBuilder .Builder .(* array.BinaryBuilder ).UnsafeAppend (v [:])
2929}
3030
31- func (b * MacBuilder ) AppendValues (v []net.HardwareAddr , valid []bool ) {
31+ func (b * MACBuilder ) AppendValues (v []net.HardwareAddr , valid []bool ) {
3232 if len (v ) != len (valid ) && len (valid ) != 0 {
3333 panic ("len(v) != len(valid) && len(valid) != 0" )
3434 }
@@ -43,7 +43,7 @@ func (b *MacBuilder) AppendValues(v []net.HardwareAddr, valid []bool) {
4343 b .ExtensionBuilder .Builder .(* array.BinaryBuilder ).AppendValues (data , valid )
4444}
4545
46- func (b * MacBuilder ) AppendValueFromString (s string ) error {
46+ func (b * MACBuilder ) AppendValueFromString (s string ) error {
4747 if s == array .NullValueStr {
4848 b .AppendNull ()
4949 return nil
@@ -56,7 +56,7 @@ func (b *MacBuilder) AppendValueFromString(s string) error {
5656 return nil
5757}
5858
59- func (b * MacBuilder ) UnmarshalOne (dec * json.Decoder ) error {
59+ func (b * MACBuilder ) UnmarshalOne (dec * json.Decoder ) error {
6060 t , err := dec .Token ()
6161 if err != nil {
6262 return err
@@ -88,7 +88,7 @@ func (b *MacBuilder) UnmarshalOne(dec *json.Decoder) error {
8888 return nil
8989}
9090
91- func (b * MacBuilder ) Unmarshal (dec * json.Decoder ) error {
91+ func (b * MACBuilder ) Unmarshal (dec * json.Decoder ) error {
9292 for dec .More () {
9393 if err := b .UnmarshalOne (dec ); err != nil {
9494 return err
@@ -97,7 +97,7 @@ func (b *MacBuilder) Unmarshal(dec *json.Decoder) error {
9797 return nil
9898}
9999
100- func (b * MacBuilder ) UnmarshalJSON (data []byte ) error {
100+ func (b * MACBuilder ) UnmarshalJSON (data []byte ) error {
101101 dec := json .NewDecoder (bytes .NewReader (data ))
102102 t , err := dec .Token ()
103103 if err != nil {
@@ -111,16 +111,16 @@ func (b *MacBuilder) UnmarshalJSON(data []byte) error {
111111 return b .Unmarshal (dec )
112112}
113113
114- func (b * MacBuilder ) NewMacArray () * MacArray {
115- return b .NewExtensionArray ().(* MacArray )
114+ func (b * MACBuilder ) NewMACArray () * MACArray {
115+ return b .NewExtensionArray ().(* MACArray )
116116}
117117
118- // MacArray is a simple array which is a wrapper around a BinaryArray
119- type MacArray struct {
118+ // MACArray is a simple array which is a wrapper around a BinaryArray
119+ type MACArray struct {
120120 array.ExtensionArrayBase
121121}
122122
123- func (a * MacArray ) String () string {
123+ func (a * MACArray ) String () string {
124124 arr := a .Storage ().(* array.Binary )
125125 o := new (strings.Builder )
126126 o .WriteString ("[" )
@@ -139,14 +139,14 @@ func (a *MacArray) String() string {
139139 return o .String ()
140140}
141141
142- func (a * MacArray ) Value (i int ) net.HardwareAddr {
142+ func (a * MACArray ) Value (i int ) net.HardwareAddr {
143143 if a .IsNull (i ) {
144144 return nil
145145 }
146146 return net .HardwareAddr (a .Storage ().(* array.Binary ).Value (i ))
147147}
148148
149- func (a * MacArray ) ValueStr (i int ) string {
149+ func (a * MACArray ) ValueStr (i int ) string {
150150 switch {
151151 case a .IsNull (i ):
152152 return array .NullValueStr
@@ -155,7 +155,7 @@ func (a *MacArray) ValueStr(i int) string {
155155 }
156156}
157157
158- func (a * MacArray ) MarshalJSON () ([]byte , error ) {
158+ func (a * MACArray ) MarshalJSON () ([]byte , error ) {
159159 arr := a .Storage ().(* array.Binary )
160160 values := make ([]any , a .Len ())
161161 for i := 0 ; i < a .Len (); i ++ {
@@ -168,57 +168,57 @@ func (a *MacArray) MarshalJSON() ([]byte, error) {
168168 return json .Marshal (values )
169169}
170170
171- func (a * MacArray ) GetOneForMarshal (i int ) any {
171+ func (a * MACArray ) GetOneForMarshal (i int ) any {
172172 arr := a .Storage ().(* array.Binary )
173173 if a .IsValid (i ) {
174174 return net .HardwareAddr (arr .Value (i )).String ()
175175 }
176176 return nil
177177}
178178
179- // MacType is a simple extension type that represents a BinaryType
180- // to be used for representing mac addresses.
181- type MacType struct {
179+ // MACType is a simple extension type that represents a BinaryType
180+ // to be used for representing MAC addresses.
181+ type MACType struct {
182182 arrow.ExtensionBase
183183}
184184
185- // NewMacType is a convenience function to create an instance of MacType
185+ // NewMACType is a convenience function to create an instance of MACType
186186// with the correct storage type
187- func NewMacType () * MacType {
188- return & MacType {ExtensionBase : arrow.ExtensionBase {Storage : & arrow.BinaryType {}}}
187+ func NewMACType () * MACType {
188+ return & MACType {ExtensionBase : arrow.ExtensionBase {Storage : & arrow.BinaryType {}}}
189189}
190190
191- // ArrayType returns TypeOf(MacArray {}) for constructing MAC arrays
192- func (* MacType ) ArrayType () reflect.Type {
193- return reflect .TypeOf (MacArray {})
191+ // ArrayType returns TypeOf(MACArray {}) for constructing MAC arrays
192+ func (* MACType ) ArrayType () reflect.Type {
193+ return reflect .TypeOf (MACArray {})
194194}
195195
196- func (* MacType ) ExtensionName () string {
196+ func (* MACType ) ExtensionName () string {
197197 return "mac"
198198}
199199
200- // Serialize returns "mac -serialized" for testing proper metadata passing
201- func (* MacType ) Serialize () string {
200+ // Serialize returns "MAC -serialized" for testing proper metadata passing
201+ func (* MACType ) Serialize () string {
202202 return "mac-serialized"
203203}
204204
205205// Deserialize expects storageType to be FixedSizeBinaryType{ByteWidth: 16} and the data to be
206- // "mac -serialized" in order to correctly create a MacType for testing deserialize.
207- func (* MacType ) Deserialize (storageType arrow.DataType , data string ) (arrow.ExtensionType , error ) {
206+ // "MAC -serialized" in order to correctly create a MACType for testing deserialize.
207+ func (* MACType ) Deserialize (storageType arrow.DataType , data string ) (arrow.ExtensionType , error ) {
208208 if data != "mac-serialized" {
209209 return nil , fmt .Errorf ("type identifier did not match: '%s'" , data )
210210 }
211211 if ! arrow .TypeEqual (storageType , & arrow.BinaryType {}) {
212- return nil , fmt .Errorf ("invalid storage type for MacType : %s" , storageType .Name ())
212+ return nil , fmt .Errorf ("invalid storage type for MACType : %s" , storageType .Name ())
213213 }
214214 return NewInetType (), nil
215215}
216216
217217// ExtensionEquals returns true if both extensions have the same name
218- func (u * MacType ) ExtensionEquals (other arrow.ExtensionType ) bool {
218+ func (u * MACType ) ExtensionEquals (other arrow.ExtensionType ) bool {
219219 return u .ExtensionName () == other .ExtensionName ()
220220}
221221
222- func (* MacType ) NewBuilder (bldr * array.ExtensionBuilder ) array.Builder {
223- return NewMacBuilder (bldr )
222+ func (* MACType ) NewBuilder (bldr * array.ExtensionBuilder ) array.Builder {
223+ return NewMACBuilder (bldr )
224224}
0 commit comments