github.com/confluentinc/confluent-kafka-go@v1.9.2/schemaregistry/test/bytes.go (about)

     1  // Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT.
     2  /*
     3   * SOURCE:
     4   *     example.avsc
     5   */
     6  package test
     7  
     8  import (
     9  	"encoding/json"
    10  
    11  	"github.com/actgardner/gogen-avro/v10/util"
    12  	"github.com/actgardner/gogen-avro/v10/vm/types"
    13  )
    14  
    15  type Bytes []byte
    16  
    17  func (b *Bytes) UnmarshalJSON(data []byte) error {
    18  	var s string
    19  	if err := json.Unmarshal(data, &s); err != nil {
    20  		return err
    21  	}
    22  	*b = util.DecodeByteString(s)
    23  	return nil
    24  }
    25  
    26  func (b Bytes) MarshalJSON() ([]byte, error) {
    27  	return []byte(util.EncodeByteString(b)), nil
    28  }
    29  
    30  type BytesWrapper struct {
    31  	Target *Bytes
    32  }
    33  
    34  func (b BytesWrapper) SetBoolean(v bool) {
    35  	panic("Unable to assign bytes to bytes field")
    36  }
    37  
    38  func (b BytesWrapper) SetInt(v int32) {
    39  	panic("Unable to assign int to bytes field")
    40  }
    41  
    42  func (b BytesWrapper) SetLong(v int64) {
    43  	panic("Unable to assign long to bytes field")
    44  }
    45  
    46  func (b BytesWrapper) SetFloat(v float32) {
    47  	panic("Unable to assign float to bytes field")
    48  }
    49  
    50  func (b BytesWrapper) SetDouble(v float64) {
    51  	panic("Unable to assign double to bytes field")
    52  }
    53  
    54  func (b BytesWrapper) SetUnionElem(v int64) {
    55  	panic("Unable to assign union elem to bytes field")
    56  }
    57  
    58  func (b BytesWrapper) SetBytes(v []byte) {
    59  	*(b.Target) = v
    60  }
    61  
    62  func (b BytesWrapper) SetString(v string) {
    63  	*(b.Target) = []byte(v)
    64  }
    65  
    66  func (b BytesWrapper) Get(i int) types.Field {
    67  	panic("Unable to get field from bytes field")
    68  }
    69  
    70  func (b BytesWrapper) SetDefault(i int) {
    71  	panic("Unable to set default on bytes field")
    72  }
    73  
    74  func (b BytesWrapper) AppendMap(key string) types.Field {
    75  	panic("Unable to append map key to from bytes field")
    76  }
    77  
    78  func (b BytesWrapper) AppendArray() types.Field {
    79  	panic("Unable to append array element to from bytes field")
    80  }
    81  
    82  func (b BytesWrapper) NullField(int) {
    83  	panic("Unable to null field in bytes field")
    84  }
    85  
    86  func (b BytesWrapper) HintSize(int) {
    87  	panic("Unable to hint size in bytes field")
    88  }
    89  
    90  func (b BytesWrapper) Finalize() {}