From 8ed4de4081c62b9a317e2a3c858d58e4d7bb95b6 Mon Sep 17 00:00:00 2001 From: ugol Date: Thu, 15 Feb 2024 16:44:21 +0100 Subject: [PATCH] added back the generated go files --- .gitignore | 2 +- pkg/types/address.go | 248 ++++++++ pkg/types/array_orderline.go | 102 ++++ pkg/types/array_string.go | 101 ++++ pkg/types/bytes.go | 132 +++++ pkg/types/csv_product.go | 277 +++++++++ pkg/types/csv_user.go | 335 +++++++++++ pkg/types/destination.go | 219 ++++++++ pkg/types/finance_stock_trade.go | 337 +++++++++++ pkg/types/fleetmgmt_description.go | 248 ++++++++ pkg/types/fleetmgmt_location.go | 252 +++++++++ pkg/types/fleetmgmt_sensor.go | 248 ++++++++ pkg/types/gaming_game.go | 248 ++++++++ pkg/types/gaming_player.go | 248 ++++++++ pkg/types/gaming_player_activity.go | 277 +++++++++ pkg/types/insurance_customer.go | 393 +++++++++++++ pkg/types/insurance_customer_activity.go | 306 ++++++++++ pkg/types/insurance_offer.go | 248 ++++++++ pkg/types/inventorymgmt_inventory.go | 248 ++++++++ pkg/types/inventorymgmt_product.go | 277 +++++++++ pkg/types/iot_device_information.go | 248 ++++++++ pkg/types/location.go | 219 ++++++++ pkg/types/map_bool.go | 115 ++++ pkg/types/map_bytes.go | 115 ++++ pkg/types/map_float.go | 115 ++++ pkg/types/map_int.go | 115 ++++ pkg/types/map_long.go | 115 ++++ pkg/types/map_string.go | 115 ++++ pkg/types/marketing_campaign_finance.go | 277 +++++++++ pkg/types/my_map_test_record.go | 413 ++++++++++++++ pkg/types/net_device.go | 625 +++++++++++++++++++++ pkg/types/orderline.go | 306 ++++++++++ pkg/types/payment_credit_card.go | 277 +++++++++ pkg/types/payment_transaction.go | 306 ++++++++++ pkg/types/payroll_bonus.go | 248 ++++++++ pkg/types/payroll_employee.go | 393 +++++++++++++ pkg/types/payroll_employee_location.go | 277 +++++++++ pkg/types/pizzastore_order.go | 339 +++++++++++ pkg/types/pizzastore_order_cancelled.go | 277 +++++++++ pkg/types/pizzastore_order_completed.go | 335 +++++++++++ pkg/types/purchase.go | 277 +++++++++ pkg/types/registry.go | 295 ++++++++++ pkg/types/shoestore_clickstream.go | 335 +++++++++++ pkg/types/shoestore_customer.go | 451 +++++++++++++++ pkg/types/shoestore_order.go | 277 +++++++++ pkg/types/shoestore_shoe.go | 306 ++++++++++ pkg/types/shopping_order.go | 310 ++++++++++ pkg/types/shopping_rating.go | 364 ++++++++++++ pkg/types/siem_log.go | 343 ++++++++++++ pkg/types/source.go | 219 ++++++++ pkg/types/store.go | 248 ++++++++ pkg/types/syslog_log.go | 683 +++++++++++++++++++++++ pkg/types/user.go | 509 +++++++++++++++++ pkg/types/users.go | 277 +++++++++ pkg/types/users_array_map.go | 343 ++++++++++++ pkg/types/webanalytics_clickstream.go | 451 +++++++++++++++ pkg/types/webanalytics_code.go | 219 ++++++++ pkg/types/webanalytics_page_view.go | 248 ++++++++ pkg/types/webanalytics_user.go | 364 ++++++++++++ 59 files changed, 16494 insertions(+), 1 deletion(-) create mode 100644 pkg/types/address.go create mode 100644 pkg/types/array_orderline.go create mode 100644 pkg/types/array_string.go create mode 100644 pkg/types/bytes.go create mode 100644 pkg/types/csv_product.go create mode 100644 pkg/types/csv_user.go create mode 100644 pkg/types/destination.go create mode 100644 pkg/types/finance_stock_trade.go create mode 100644 pkg/types/fleetmgmt_description.go create mode 100644 pkg/types/fleetmgmt_location.go create mode 100644 pkg/types/fleetmgmt_sensor.go create mode 100644 pkg/types/gaming_game.go create mode 100644 pkg/types/gaming_player.go create mode 100644 pkg/types/gaming_player_activity.go create mode 100644 pkg/types/insurance_customer.go create mode 100644 pkg/types/insurance_customer_activity.go create mode 100644 pkg/types/insurance_offer.go create mode 100644 pkg/types/inventorymgmt_inventory.go create mode 100644 pkg/types/inventorymgmt_product.go create mode 100644 pkg/types/iot_device_information.go create mode 100644 pkg/types/location.go create mode 100644 pkg/types/map_bool.go create mode 100644 pkg/types/map_bytes.go create mode 100644 pkg/types/map_float.go create mode 100644 pkg/types/map_int.go create mode 100644 pkg/types/map_long.go create mode 100644 pkg/types/map_string.go create mode 100644 pkg/types/marketing_campaign_finance.go create mode 100644 pkg/types/my_map_test_record.go create mode 100644 pkg/types/net_device.go create mode 100644 pkg/types/orderline.go create mode 100644 pkg/types/payment_credit_card.go create mode 100644 pkg/types/payment_transaction.go create mode 100644 pkg/types/payroll_bonus.go create mode 100644 pkg/types/payroll_employee.go create mode 100644 pkg/types/payroll_employee_location.go create mode 100644 pkg/types/pizzastore_order.go create mode 100644 pkg/types/pizzastore_order_cancelled.go create mode 100644 pkg/types/pizzastore_order_completed.go create mode 100644 pkg/types/purchase.go create mode 100755 pkg/types/registry.go create mode 100644 pkg/types/shoestore_clickstream.go create mode 100644 pkg/types/shoestore_customer.go create mode 100644 pkg/types/shoestore_order.go create mode 100644 pkg/types/shoestore_shoe.go create mode 100644 pkg/types/shopping_order.go create mode 100644 pkg/types/shopping_rating.go create mode 100644 pkg/types/siem_log.go create mode 100644 pkg/types/source.go create mode 100644 pkg/types/store.go create mode 100644 pkg/types/syslog_log.go create mode 100644 pkg/types/user.go create mode 100644 pkg/types/users.go create mode 100644 pkg/types/users_array_map.go create mode 100644 pkg/types/webanalytics_clickstream.go create mode 100644 pkg/types/webanalytics_code.go create mode 100644 pkg/types/webanalytics_page_view.go create mode 100644 pkg/types/webanalytics_user.go diff --git a/.gitignore b/.gitignore index c6a71b27..ba17e18d 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,7 @@ _testmain.go # Specific project files releases build -pkg/types/*.go +#pkg/types/*.go pkg/producers/kafka/*.properties pkg/producers/redis/config.json pkg/producers/elastic/*.json diff --git a/pkg/types/address.go b/pkg/types/address.go new file mode 100644 index 00000000..f4e6cda2 --- /dev/null +++ b/pkg/types/address.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Address struct { + City string `json:"city"` + + State string `json:"state"` + + Zipcode int64 `json:"zipcode"` +} + +const AddressAvroCRC64Fingerprint = "dĒ\xe6seu\x1e" + +func NewAddress() Address { + r := Address{} + return r +} + +func DeserializeAddress(r io.Reader) (Address, error) { + t := NewAddress() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeAddressFromSchema(r io.Reader, schema string) (Address, error) { + t := NewAddress() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeAddress(r Address, w io.Writer) error { + var err error + err = vm.WriteString(r.City, w) + if err != nil { + return err + } + err = vm.WriteString(r.State, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Zipcode, w) + if err != nil { + return err + } + return err +} + +func (r Address) Serialize(w io.Writer) error { + return writeAddress(r, w) +} + +func (r Address) Schema() string { + return "{\"fields\":[{\"name\":\"city\",\"type\":{\"arg.properties\":{\"regex\":\"City_[1-9]{0,2}\"},\"type\":\"string\"}},{\"name\":\"state\",\"type\":{\"arg.properties\":{\"regex\":\"State_[1-9]{0,2}\"},\"type\":\"string\"}},{\"name\":\"zipcode\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"long\"}}],\"name\":\"shopping.address\",\"type\":\"record\"}" +} + +func (r Address) SchemaName() string { + return "shopping.address" +} + +func (_ Address) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Address) SetInt(v int32) { panic("Unsupported operation") } +func (_ Address) SetLong(v int64) { panic("Unsupported operation") } +func (_ Address) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Address) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Address) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Address) SetString(v string) { panic("Unsupported operation") } +func (_ Address) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Address) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.City} + + return w + + case 1: + w := types.String{Target: &r.State} + + return w + + case 2: + w := types.Long{Target: &r.Zipcode} + + return w + + } + panic("Unknown field index") +} + +func (r *Address) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Address) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Address) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Address) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Address) HintSize(int) { panic("Unsupported operation") } +func (_ Address) Finalize() {} + +func (_ Address) AvroCRC64Fingerprint() []byte { + return []byte(AddressAvroCRC64Fingerprint) +} + +func (r Address) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["city"], err = json.Marshal(r.City) + if err != nil { + return nil, err + } + output["state"], err = json.Marshal(r.State) + if err != nil { + return nil, err + } + output["zipcode"], err = json.Marshal(r.Zipcode) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Address) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["city"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.City); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for city") + } + val = func() json.RawMessage { + if v, ok := fields["state"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.State); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for state") + } + val = func() json.RawMessage { + if v, ok := fields["zipcode"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Zipcode); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for zipcode") + } + return nil +} diff --git a/pkg/types/array_orderline.go b/pkg/types/array_orderline.go new file mode 100644 index 00000000..8e754378 --- /dev/null +++ b/pkg/types/array_orderline.go @@ -0,0 +1,102 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "io" + + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +func writeArrayOrderline(r []Orderline, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for _, e := range r { + err = writeOrderline(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type ArrayOrderlineWrapper struct { + Target *[]Orderline +} + +func (_ ArrayOrderlineWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ArrayOrderlineWrapper) Finalize() {} +func (_ ArrayOrderlineWrapper) SetDefault(i int) { panic("Unsupported operation") } +func (r ArrayOrderlineWrapper) HintSize(s int) { + if len(*r.Target) == 0 { + *r.Target = make([]Orderline, 0, s) + } +} +func (r ArrayOrderlineWrapper) NullField(i int) { + panic("Unsupported operation") +} + +func (r ArrayOrderlineWrapper) AppendArray() types.Field { + var v Orderline + v = NewOrderline() + + *r.Target = append(*r.Target, v) + return &types.Record{Target: &(*r.Target)[len(*r.Target)-1]} +} diff --git a/pkg/types/array_string.go b/pkg/types/array_string.go new file mode 100644 index 00000000..116c6071 --- /dev/null +++ b/pkg/types/array_string.go @@ -0,0 +1,101 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "io" + + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +func writeArrayString(r []string, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for _, e := range r { + err = vm.WriteString(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type ArrayStringWrapper struct { + Target *[]string +} + +func (_ ArrayStringWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ ArrayStringWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ ArrayStringWrapper) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ArrayStringWrapper) Finalize() {} +func (_ ArrayStringWrapper) SetDefault(i int) { panic("Unsupported operation") } +func (r ArrayStringWrapper) HintSize(s int) { + if len(*r.Target) == 0 { + *r.Target = make([]string, 0, s) + } +} +func (r ArrayStringWrapper) NullField(i int) { + panic("Unsupported operation") +} + +func (r ArrayStringWrapper) AppendArray() types.Field { + var v string + + *r.Target = append(*r.Target, v) + return &types.String{Target: &(*r.Target)[len(*r.Target)-1]} +} diff --git a/pkg/types/bytes.go b/pkg/types/bytes.go new file mode 100644 index 00000000..1ff6c218 --- /dev/null +++ b/pkg/types/bytes.go @@ -0,0 +1,132 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + + "github.com/actgardner/gogen-avro/v10/util" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +type Bytes []byte + +func (b *Bytes) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + *b = util.DecodeByteString(s) + return nil +} + +func (b Bytes) MarshalJSON() ([]byte, error) { + return []byte(util.EncodeByteString(b)), nil +} + +type BytesWrapper struct { + Target *Bytes +} + +func (b BytesWrapper) SetBoolean(v bool) { + panic("Unable to assign bytes to bytes field") +} + +func (b BytesWrapper) SetInt(v int32) { + panic("Unable to assign int to bytes field") +} + +func (b BytesWrapper) SetLong(v int64) { + panic("Unable to assign long to bytes field") +} + +func (b BytesWrapper) SetFloat(v float32) { + panic("Unable to assign float to bytes field") +} + +func (b BytesWrapper) SetDouble(v float64) { + panic("Unable to assign double to bytes field") +} + +func (b BytesWrapper) SetUnionElem(v int64) { + panic("Unable to assign union elem to bytes field") +} + +func (b BytesWrapper) SetBytes(v []byte) { + *(b.Target) = v +} + +func (b BytesWrapper) SetString(v string) { + *(b.Target) = []byte(v) +} + +func (b BytesWrapper) Get(i int) types.Field { + panic("Unable to get field from bytes field") +} + +func (b BytesWrapper) SetDefault(i int) { + panic("Unable to set default on bytes field") +} + +func (b BytesWrapper) AppendMap(key string) types.Field { + panic("Unable to append map key to from bytes field") +} + +func (b BytesWrapper) AppendArray() types.Field { + panic("Unable to append array element to from bytes field") +} + +func (b BytesWrapper) NullField(int) { + panic("Unable to null field in bytes field") +} + +func (b BytesWrapper) HintSize(int) { + panic("Unable to hint size in bytes field") +} + +func (b BytesWrapper) Finalize() {} diff --git a/pkg/types/csv_product.go b/pkg/types/csv_product.go new file mode 100644 index 00000000..176f48b3 --- /dev/null +++ b/pkg/types/csv_product.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type CsvProduct struct { + Product_id string `json:"product_id"` + + Name string `json:"name"` + + Brand string `json:"brand"` + + Page_url string `json:"page_url"` +} + +const CsvProductAvroCRC64Fingerprint = "\xea\xbee\xc5:;\r-" + +func NewCsvProduct() CsvProduct { + r := CsvProduct{} + return r +} + +func DeserializeCsvProduct(r io.Reader) (CsvProduct, error) { + t := NewCsvProduct() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeCsvProductFromSchema(r io.Reader, schema string) (CsvProduct, error) { + t := NewCsvProduct() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeCsvProduct(r CsvProduct, w io.Writer) error { + var err error + err = vm.WriteString(r.Product_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Brand, w) + if err != nil { + return err + } + err = vm.WriteString(r.Page_url, w) + if err != nil { + return err + } + return err +} + +func (r CsvProduct) Serialize(w io.Writer) error { + return writeCsvProduct(r, w) +} + +func (r CsvProduct) Schema() string { + return "{\"fields\":[{\"name\":\"product_id\",\"type\":{\"type\":\"string\"}},{\"name\":\"name\",\"type\":{\"type\":\"string\"}},{\"name\":\"brand\",\"type\":{\"type\":\"string\"}},{\"name\":\"page_url\",\"type\":{\"type\":\"string\"}}],\"name\":\"csv.CsvProduct\",\"type\":\"record\"}" +} + +func (r CsvProduct) SchemaName() string { + return "csv.CsvProduct" +} + +func (_ CsvProduct) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ CsvProduct) SetInt(v int32) { panic("Unsupported operation") } +func (_ CsvProduct) SetLong(v int64) { panic("Unsupported operation") } +func (_ CsvProduct) SetFloat(v float32) { panic("Unsupported operation") } +func (_ CsvProduct) SetDouble(v float64) { panic("Unsupported operation") } +func (_ CsvProduct) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ CsvProduct) SetString(v string) { panic("Unsupported operation") } +func (_ CsvProduct) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *CsvProduct) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Product_id} + + return w + + case 1: + w := types.String{Target: &r.Name} + + return w + + case 2: + w := types.String{Target: &r.Brand} + + return w + + case 3: + w := types.String{Target: &r.Page_url} + + return w + + } + panic("Unknown field index") +} + +func (r *CsvProduct) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *CsvProduct) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ CsvProduct) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ CsvProduct) AppendArray() types.Field { panic("Unsupported operation") } +func (_ CsvProduct) HintSize(int) { panic("Unsupported operation") } +func (_ CsvProduct) Finalize() {} + +func (_ CsvProduct) AvroCRC64Fingerprint() []byte { + return []byte(CsvProductAvroCRC64Fingerprint) +} + +func (r CsvProduct) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["product_id"], err = json.Marshal(r.Product_id) + if err != nil { + return nil, err + } + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["brand"], err = json.Marshal(r.Brand) + if err != nil { + return nil, err + } + output["page_url"], err = json.Marshal(r.Page_url) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *CsvProduct) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["product_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Product_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for product_id") + } + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["brand"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Brand); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for brand") + } + val = func() json.RawMessage { + if v, ok := fields["page_url"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Page_url); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for page_url") + } + return nil +} diff --git a/pkg/types/csv_user.go b/pkg/types/csv_user.go new file mode 100644 index 00000000..38b6f826 --- /dev/null +++ b/pkg/types/csv_user.go @@ -0,0 +1,335 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type CsvUser struct { + Age int32 `json:"age"` + + EyeColor string `json:"eyeColor"` + + Name string `json:"name"` + + Surname string `json:"surname"` + + Company string `json:"company"` + + Email string `json:"email"` +} + +const CsvUserAvroCRC64Fingerprint = "'\x83\x91\xe9dg{\xaa" + +func NewCsvUser() CsvUser { + r := CsvUser{} + return r +} + +func DeserializeCsvUser(r io.Reader) (CsvUser, error) { + t := NewCsvUser() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeCsvUserFromSchema(r io.Reader, schema string) (CsvUser, error) { + t := NewCsvUser() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeCsvUser(r CsvUser, w io.Writer) error { + var err error + err = vm.WriteInt(r.Age, w) + if err != nil { + return err + } + err = vm.WriteString(r.EyeColor, w) + if err != nil { + return err + } + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Surname, w) + if err != nil { + return err + } + err = vm.WriteString(r.Company, w) + if err != nil { + return err + } + err = vm.WriteString(r.Email, w) + if err != nil { + return err + } + return err +} + +func (r CsvUser) Serialize(w io.Writer) error { + return writeCsvUser(r, w) +} + +func (r CsvUser) Schema() string { + return "{\"fields\":[{\"name\":\"age\",\"type\":{\"type\":\"int\"}},{\"name\":\"eyeColor\",\"type\":{\"type\":\"string\"}},{\"name\":\"name\",\"type\":{\"type\":\"string\"}},{\"name\":\"surname\",\"type\":{\"type\":\"string\"}},{\"name\":\"company\",\"type\":{\"type\":\"string\"}},{\"name\":\"email\",\"type\":{\"type\":\"string\"}}],\"name\":\"csv.CsvUser\",\"type\":\"record\"}" +} + +func (r CsvUser) SchemaName() string { + return "csv.CsvUser" +} + +func (_ CsvUser) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ CsvUser) SetInt(v int32) { panic("Unsupported operation") } +func (_ CsvUser) SetLong(v int64) { panic("Unsupported operation") } +func (_ CsvUser) SetFloat(v float32) { panic("Unsupported operation") } +func (_ CsvUser) SetDouble(v float64) { panic("Unsupported operation") } +func (_ CsvUser) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ CsvUser) SetString(v string) { panic("Unsupported operation") } +func (_ CsvUser) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *CsvUser) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Age} + + return w + + case 1: + w := types.String{Target: &r.EyeColor} + + return w + + case 2: + w := types.String{Target: &r.Name} + + return w + + case 3: + w := types.String{Target: &r.Surname} + + return w + + case 4: + w := types.String{Target: &r.Company} + + return w + + case 5: + w := types.String{Target: &r.Email} + + return w + + } + panic("Unknown field index") +} + +func (r *CsvUser) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *CsvUser) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ CsvUser) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ CsvUser) AppendArray() types.Field { panic("Unsupported operation") } +func (_ CsvUser) HintSize(int) { panic("Unsupported operation") } +func (_ CsvUser) Finalize() {} + +func (_ CsvUser) AvroCRC64Fingerprint() []byte { + return []byte(CsvUserAvroCRC64Fingerprint) +} + +func (r CsvUser) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["age"], err = json.Marshal(r.Age) + if err != nil { + return nil, err + } + output["eyeColor"], err = json.Marshal(r.EyeColor) + if err != nil { + return nil, err + } + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["surname"], err = json.Marshal(r.Surname) + if err != nil { + return nil, err + } + output["company"], err = json.Marshal(r.Company) + if err != nil { + return nil, err + } + output["email"], err = json.Marshal(r.Email) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *CsvUser) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["age"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Age); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for age") + } + val = func() json.RawMessage { + if v, ok := fields["eyeColor"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.EyeColor); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for eyeColor") + } + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["surname"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Surname); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for surname") + } + val = func() json.RawMessage { + if v, ok := fields["company"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Company); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for company") + } + val = func() json.RawMessage { + if v, ok := fields["email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for email") + } + return nil +} diff --git a/pkg/types/destination.go b/pkg/types/destination.go new file mode 100644 index 00000000..2ebceed4 --- /dev/null +++ b/pkg/types/destination.go @@ -0,0 +1,219 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Destination struct { + Ip string `json:"ip"` + + Port int32 `json:"port"` +} + +const DestinationAvroCRC64Fingerprint = "\x95Hژ՛\xb1v" + +func NewDestination() Destination { + r := Destination{} + return r +} + +func DeserializeDestination(r io.Reader) (Destination, error) { + t := NewDestination() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeDestinationFromSchema(r io.Reader, schema string) (Destination, error) { + t := NewDestination() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeDestination(r Destination, w io.Writer) error { + var err error + err = vm.WriteString(r.Ip, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Port, w) + if err != nil { + return err + } + return err +} + +func (r Destination) Serialize(w io.Writer) error { + return writeDestination(r, w) +} + +func (r Destination) Schema() string { + return "{\"fields\":[{\"name\":\"ip\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"port\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"int\"}}],\"name\":\"siem.destination\",\"type\":\"record\"}" +} + +func (r Destination) SchemaName() string { + return "siem.destination" +} + +func (_ Destination) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Destination) SetInt(v int32) { panic("Unsupported operation") } +func (_ Destination) SetLong(v int64) { panic("Unsupported operation") } +func (_ Destination) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Destination) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Destination) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Destination) SetString(v string) { panic("Unsupported operation") } +func (_ Destination) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Destination) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Ip} + + return w + + case 1: + w := types.Int{Target: &r.Port} + + return w + + } + panic("Unknown field index") +} + +func (r *Destination) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Destination) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Destination) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Destination) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Destination) HintSize(int) { panic("Unsupported operation") } +func (_ Destination) Finalize() {} + +func (_ Destination) AvroCRC64Fingerprint() []byte { + return []byte(DestinationAvroCRC64Fingerprint) +} + +func (r Destination) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["ip"], err = json.Marshal(r.Ip) + if err != nil { + return nil, err + } + output["port"], err = json.Marshal(r.Port) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Destination) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip") + } + val = func() json.RawMessage { + if v, ok := fields["port"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Port); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for port") + } + return nil +} diff --git a/pkg/types/finance_stock_trade.go b/pkg/types/finance_stock_trade.go new file mode 100644 index 00000000..4ed68a68 --- /dev/null +++ b/pkg/types/finance_stock_trade.go @@ -0,0 +1,337 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +// Defines a hypothetical stock trade using some known test stock symbols. +type FinanceStockTrade struct { + // A simulated trade side (buy or sell or short) + Side string `json:"side"` + // A simulated random quantity of the trade + Quantity int32 `json:"quantity"` + // Simulated stock symbols + Symbol string `json:"symbol"` + // A simulated random trade price in pennies + Price int32 `json:"price"` + // Simulated accounts assigned to the trade + Account string `json:"account"` + // The simulated user who executed the trade + Userid string `json:"userid"` +} + +const FinanceStockTradeAvroCRC64Fingerprint = "'\x99\xff\x1f\xc9\xd0w\xc0" + +func NewFinanceStockTrade() FinanceStockTrade { + r := FinanceStockTrade{} + return r +} + +func DeserializeFinanceStockTrade(r io.Reader) (FinanceStockTrade, error) { + t := NewFinanceStockTrade() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeFinanceStockTradeFromSchema(r io.Reader, schema string) (FinanceStockTrade, error) { + t := NewFinanceStockTrade() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeFinanceStockTrade(r FinanceStockTrade, w io.Writer) error { + var err error + err = vm.WriteString(r.Side, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Quantity, w) + if err != nil { + return err + } + err = vm.WriteString(r.Symbol, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Price, w) + if err != nil { + return err + } + err = vm.WriteString(r.Account, w) + if err != nil { + return err + } + err = vm.WriteString(r.Userid, w) + if err != nil { + return err + } + return err +} + +func (r FinanceStockTrade) Serialize(w io.Writer) error { + return writeFinanceStockTrade(r, w) +} + +func (r FinanceStockTrade) Schema() string { + return "{\"doc\":\"Defines a hypothetical stock trade using some known test stock symbols.\",\"fields\":[{\"doc\":\"A simulated trade side (buy or sell or short)\",\"name\":\"side\",\"type\":{\"arg.properties\":{\"options\":[\"BUY\",\"SELL\"]},\"type\":\"string\"}},{\"doc\":\"A simulated random quantity of the trade\",\"name\":\"quantity\",\"type\":{\"arg.properties\":{\"range\":{\"max\":5000,\"min\":1}},\"type\":\"int\"}},{\"doc\":\"Simulated stock symbols\",\"name\":\"symbol\",\"type\":{\"arg.properties\":{\"options\":[\"ZBZX\",\"ZJZZT\",\"ZTEST\",\"ZVV\",\"ZVZZT\",\"ZWZZT\",\"ZXZZT\"]},\"type\":\"string\"}},{\"doc\":\"A simulated random trade price in pennies\",\"name\":\"price\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1000,\"min\":5}},\"type\":\"int\"}},{\"doc\":\"Simulated accounts assigned to the trade\",\"name\":\"account\",\"type\":{\"arg.properties\":{\"options\":[\"ABC123\",\"LMN456\",\"XYZ789\"]},\"type\":\"string\"}},{\"doc\":\"The simulated user who executed the trade\",\"name\":\"userid\",\"type\":{\"arg.properties\":{\"regex\":\"User_[1-9]\"},\"type\":\"string\"}}],\"name\":\"finance.FinanceStockTrade\",\"type\":\"record\"}" +} + +func (r FinanceStockTrade) SchemaName() string { + return "finance.FinanceStockTrade" +} + +func (_ FinanceStockTrade) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetInt(v int32) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetLong(v int64) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetFloat(v float32) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetDouble(v float64) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetString(v string) { panic("Unsupported operation") } +func (_ FinanceStockTrade) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *FinanceStockTrade) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Side} + + return w + + case 1: + w := types.Int{Target: &r.Quantity} + + return w + + case 2: + w := types.String{Target: &r.Symbol} + + return w + + case 3: + w := types.Int{Target: &r.Price} + + return w + + case 4: + w := types.String{Target: &r.Account} + + return w + + case 5: + w := types.String{Target: &r.Userid} + + return w + + } + panic("Unknown field index") +} + +func (r *FinanceStockTrade) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *FinanceStockTrade) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ FinanceStockTrade) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ FinanceStockTrade) AppendArray() types.Field { panic("Unsupported operation") } +func (_ FinanceStockTrade) HintSize(int) { panic("Unsupported operation") } +func (_ FinanceStockTrade) Finalize() {} + +func (_ FinanceStockTrade) AvroCRC64Fingerprint() []byte { + return []byte(FinanceStockTradeAvroCRC64Fingerprint) +} + +func (r FinanceStockTrade) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["side"], err = json.Marshal(r.Side) + if err != nil { + return nil, err + } + output["quantity"], err = json.Marshal(r.Quantity) + if err != nil { + return nil, err + } + output["symbol"], err = json.Marshal(r.Symbol) + if err != nil { + return nil, err + } + output["price"], err = json.Marshal(r.Price) + if err != nil { + return nil, err + } + output["account"], err = json.Marshal(r.Account) + if err != nil { + return nil, err + } + output["userid"], err = json.Marshal(r.Userid) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *FinanceStockTrade) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["side"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Side); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for side") + } + val = func() json.RawMessage { + if v, ok := fields["quantity"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Quantity); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for quantity") + } + val = func() json.RawMessage { + if v, ok := fields["symbol"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Symbol); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for symbol") + } + val = func() json.RawMessage { + if v, ok := fields["price"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Price); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for price") + } + val = func() json.RawMessage { + if v, ok := fields["account"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Account); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for account") + } + val = func() json.RawMessage { + if v, ok := fields["userid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Userid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for userid") + } + return nil +} diff --git a/pkg/types/fleetmgmt_description.go b/pkg/types/fleetmgmt_description.go new file mode 100644 index 00000000..4f4d0c33 --- /dev/null +++ b/pkg/types/fleetmgmt_description.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type FleetmgmtDescription struct { + Vehicle_id int32 `json:"vehicle_id"` + + Driver_name string `json:"driver_name"` + + License_plate string `json:"license_plate"` +} + +const FleetmgmtDescriptionAvroCRC64Fingerprint = "\xf8\xbc\xda<\xa0\xd1}:" + +func NewFleetmgmtDescription() FleetmgmtDescription { + r := FleetmgmtDescription{} + return r +} + +func DeserializeFleetmgmtDescription(r io.Reader) (FleetmgmtDescription, error) { + t := NewFleetmgmtDescription() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeFleetmgmtDescriptionFromSchema(r io.Reader, schema string) (FleetmgmtDescription, error) { + t := NewFleetmgmtDescription() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeFleetmgmtDescription(r FleetmgmtDescription, w io.Writer) error { + var err error + err = vm.WriteInt(r.Vehicle_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Driver_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.License_plate, w) + if err != nil { + return err + } + return err +} + +func (r FleetmgmtDescription) Serialize(w io.Writer) error { + return writeFleetmgmtDescription(r, w) +} + +func (r FleetmgmtDescription) Schema() string { + return "{\"fields\":[{\"name\":\"vehicle_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":9999,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"driver_name\",\"type\":{\"arg.properties\":{\"options\":[\"Frieda Baldi\",\"Cherrita Gallaccio\",\"Matt Cleugh\",\"Dulciana Murfill\",\"Germayne Streetley\",\"Brenna Woolfall\",\"Gerhardt Tenbrug\",\"Hayley Tuma\",\"Winny Cadigan\",\"Bonnibelle Macek\",\"Lionel Byneth\",\"Trev Roper\",\"Lena MacFadzean\",\"Benton Allcorn\",\"Avis Moyler\",\"Marchall Rochewell\",\"Adele Bohl\",\"Barnett Mcall\",\"Frieda Pirrone\",\"Pattin Eringey\",\"Kalila Fewings\",\"Giacobo Beuscher\",\"Rozalin Hair\",\"Egon Beagan\",\"Owen Strotton\",\"Fernando Rosensaft\",\"Carleton Gwyther\",\"Kata Coll\",\"Rossie Hobben\",\"Stephanie Gookey\",\"Robyn Milazzo\",\"Tilda O'Lunney\",\"Nolan Kidney\",\"Jori Ottiwill\",\"Benito Graveson\",\"Zechariah Wrate\",\"Chelsae Napton\",\"Jeremy Heffernon\",\"Derk McAviy\",\"Constantin Mears\",\"Fitz Ballin\",\"Essy Bettles\",\"Gene Klemt\",\"Nikolai Arnopp\",\"Gustave Westhofer\",\"Simona Mayhow\",\"Cort Bainbridge\",\"Sibyl Vockins\",\"Andriette Gaze\",\"Shaughn De Simoni\",\"Nathaniel Hallowell\",\"Charley Dudill\",\"Cirstoforo Joblin\",\"Hyacinthia Kinastan\",\"Dur Lasselle\",\"Gay Chadburn\",\"Livvie Hawyes\",\"Aldrich MacVay\",\"Riva Rossant\",\"Johanna Reichartz\",\"Trent Gantlett\",\"Aryn Haskell\",\"Byrann Barock\",\"Gerda Cleugher\",\"Sonnie Guildford\",\"Vergil Borge\",\"Lurline Rocco\",\"Geoff Eddy\",\"Zea Leighton\",\"Leif Baden\",\"Quint Bidgod\",\"Talbot Cashell\",\"Sheridan Foulsham\",\"Camile Shrimplin\",\"Marcel Nayshe\",\"Lea Murrish\",\"Lucais Midson\",\"Zeb Rylatt\",\"Nertie Zuker\",\"Babara Henderson\",\"Electra Ridgley\",\"Jere Standingford\",\"Cyril Yellowlea\",\"Isadora Peegrem\",\"Caria Smewings\",\"Karena Kauffman\",\"Haywood Snowball\",\"Winslow Starcks\",\"Alis Ponton\",\"Marietta Lezemere\",\"Emilee Broadbridge\",\"Faye Beaument\",\"Shannah Beatson\",\"West Doy\",\"Chryste Wren\",\"Trumann Labba\",\"Anatollo Beckwith\",\"Konstanze Dunsford\",\"Raychel Roset\",\"Heindrick Ravenscroft\"]},\"type\":\"string\"}},{\"name\":\"license_plate\",\"type\":{\"arg.properties\":{\"regex\":\"[A-Z]{2}\\\\d{6}[A-Z]\"},\"type\":\"string\"}}],\"name\":\"fleetmgmt.FleetmgmtDescription\",\"type\":\"record\"}" +} + +func (r FleetmgmtDescription) SchemaName() string { + return "fleetmgmt.FleetmgmtDescription" +} + +func (_ FleetmgmtDescription) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetInt(v int32) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetLong(v int64) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetFloat(v float32) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetDouble(v float64) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetString(v string) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *FleetmgmtDescription) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Vehicle_id} + + return w + + case 1: + w := types.String{Target: &r.Driver_name} + + return w + + case 2: + w := types.String{Target: &r.License_plate} + + return w + + } + panic("Unknown field index") +} + +func (r *FleetmgmtDescription) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *FleetmgmtDescription) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ FleetmgmtDescription) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ FleetmgmtDescription) AppendArray() types.Field { panic("Unsupported operation") } +func (_ FleetmgmtDescription) HintSize(int) { panic("Unsupported operation") } +func (_ FleetmgmtDescription) Finalize() {} + +func (_ FleetmgmtDescription) AvroCRC64Fingerprint() []byte { + return []byte(FleetmgmtDescriptionAvroCRC64Fingerprint) +} + +func (r FleetmgmtDescription) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["vehicle_id"], err = json.Marshal(r.Vehicle_id) + if err != nil { + return nil, err + } + output["driver_name"], err = json.Marshal(r.Driver_name) + if err != nil { + return nil, err + } + output["license_plate"], err = json.Marshal(r.License_plate) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *FleetmgmtDescription) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["vehicle_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Vehicle_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for vehicle_id") + } + val = func() json.RawMessage { + if v, ok := fields["driver_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Driver_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for driver_name") + } + val = func() json.RawMessage { + if v, ok := fields["license_plate"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.License_plate); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for license_plate") + } + return nil +} diff --git a/pkg/types/fleetmgmt_location.go b/pkg/types/fleetmgmt_location.go new file mode 100644 index 00000000..ff76b605 --- /dev/null +++ b/pkg/types/fleetmgmt_location.go @@ -0,0 +1,252 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type FleetmgmtLocation struct { + Vehicle_id int32 `json:"vehicle_id"` + + Location Location `json:"location"` + + Ts int64 `json:"ts"` +} + +const FleetmgmtLocationAvroCRC64Fingerprint = "T=\f\x96\x8c\xf5q\xca" + +func NewFleetmgmtLocation() FleetmgmtLocation { + r := FleetmgmtLocation{} + r.Location = NewLocation() + + return r +} + +func DeserializeFleetmgmtLocation(r io.Reader) (FleetmgmtLocation, error) { + t := NewFleetmgmtLocation() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeFleetmgmtLocationFromSchema(r io.Reader, schema string) (FleetmgmtLocation, error) { + t := NewFleetmgmtLocation() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeFleetmgmtLocation(r FleetmgmtLocation, w io.Writer) error { + var err error + err = vm.WriteInt(r.Vehicle_id, w) + if err != nil { + return err + } + err = writeLocation(r.Location, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Ts, w) + if err != nil { + return err + } + return err +} + +func (r FleetmgmtLocation) Serialize(w io.Writer) error { + return writeFleetmgmtLocation(r, w) +} + +func (r FleetmgmtLocation) Schema() string { + return "{\"fields\":[{\"name\":\"vehicle_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":9999,\"min\":1000}},\"type\":\"int\"}},{\"arg.properties\":{\"options\":[{\"latitude\":37.416834,\"longitude\":-121.975002},{\"latitude\":37.664725,\"longitude\":-121.79737},{\"latitude\":38.124221,\"longitude\":-121.182135},{\"latitude\":38.623772,\"longitude\":-120.176886},{\"latitude\":39.544752,\"longitude\":-119.589118},{\"latitude\":37.725577,\"longitude\":-121.709479},{\"latitude\":38.658096,\"longitude\":-120.138434},{\"latitude\":39.752002,\"longitude\":-119.050787},{\"latitude\":39.680169,\"longitude\":-119.111212},{\"latitude\":40.445308,\"longitude\":-118.30921},{\"latitude\":40.122644,\"longitude\":-118.517951},{\"latitude\":40.907734,\"longitude\":-117.831305},{\"latitude\":39.718207,\"longitude\":-119.105719},{\"latitude\":40.853569,\"longitude\":-117.226383},{\"latitude\":40.683171,\"longitude\":-116.622809},{\"latitude\":40.82604,\"longitude\":-117.169294},{\"latitude\":37.699504,\"longitude\":-121.731452},{\"latitude\":39.912298,\"longitude\":-118.825568},{\"latitude\":39.895442,\"longitude\":-118.880499},{\"latitude\":39.827978,\"longitude\":-118.979376},{\"latitude\":38.167421,\"longitude\":-121.116217},{\"latitude\":40.628996,\"longitude\":-116.436041},{\"latitude\":38.537888,\"longitude\":-120.413092},{\"latitude\":39.756225,\"longitude\":-119.056281},{\"latitude\":39.92915,\"longitude\":-118.748663},{\"latitude\":40.924338,\"longitude\":-117.847785},{\"latitude\":40.828808,\"longitude\":-117.166632},{\"latitude\":38.499207,\"longitude\":-120.49549},{\"latitude\":39.760448,\"longitude\":-119.061774},{\"latitude\":37.391868,\"longitude\":-122.071206}]},\"name\":\"location\",\"type\":{\"fields\":[{\"name\":\"latitude\",\"type\":\"double\"},{\"name\":\"longitude\",\"type\":\"double\"}],\"name\":\"location\",\"type\":\"record\"}},{\"name\":\"ts\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1609459200000,\"step\":100000}},\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}}],\"name\":\"fleetmgmt.FleetmgmtLocation\",\"type\":\"record\"}" +} + +func (r FleetmgmtLocation) SchemaName() string { + return "fleetmgmt.FleetmgmtLocation" +} + +func (_ FleetmgmtLocation) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetInt(v int32) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetLong(v int64) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetFloat(v float32) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetDouble(v float64) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetString(v string) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *FleetmgmtLocation) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Vehicle_id} + + return w + + case 1: + r.Location = NewLocation() + + w := types.Record{Target: &r.Location} + + return w + + case 2: + w := types.Long{Target: &r.Ts} + + return w + + } + panic("Unknown field index") +} + +func (r *FleetmgmtLocation) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *FleetmgmtLocation) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ FleetmgmtLocation) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ FleetmgmtLocation) AppendArray() types.Field { panic("Unsupported operation") } +func (_ FleetmgmtLocation) HintSize(int) { panic("Unsupported operation") } +func (_ FleetmgmtLocation) Finalize() {} + +func (_ FleetmgmtLocation) AvroCRC64Fingerprint() []byte { + return []byte(FleetmgmtLocationAvroCRC64Fingerprint) +} + +func (r FleetmgmtLocation) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["vehicle_id"], err = json.Marshal(r.Vehicle_id) + if err != nil { + return nil, err + } + output["location"], err = json.Marshal(r.Location) + if err != nil { + return nil, err + } + output["ts"], err = json.Marshal(r.Ts) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *FleetmgmtLocation) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["vehicle_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Vehicle_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for vehicle_id") + } + val = func() json.RawMessage { + if v, ok := fields["location"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Location); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for location") + } + val = func() json.RawMessage { + if v, ok := fields["ts"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ts); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ts") + } + return nil +} diff --git a/pkg/types/fleetmgmt_sensor.go b/pkg/types/fleetmgmt_sensor.go new file mode 100644 index 00000000..5b2caa66 --- /dev/null +++ b/pkg/types/fleetmgmt_sensor.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type FleetmgmtSensor struct { + Vehicle_id int32 `json:"vehicle_id"` + + Engine_temperature int32 `json:"engine_temperature"` + + Average_rpm int32 `json:"average_rpm"` +} + +const FleetmgmtSensorAvroCRC64Fingerprint = "ī\x98\xf3\xe7n\xc9x" + +func NewFleetmgmtSensor() FleetmgmtSensor { + r := FleetmgmtSensor{} + return r +} + +func DeserializeFleetmgmtSensor(r io.Reader) (FleetmgmtSensor, error) { + t := NewFleetmgmtSensor() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeFleetmgmtSensorFromSchema(r io.Reader, schema string) (FleetmgmtSensor, error) { + t := NewFleetmgmtSensor() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeFleetmgmtSensor(r FleetmgmtSensor, w io.Writer) error { + var err error + err = vm.WriteInt(r.Vehicle_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Engine_temperature, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Average_rpm, w) + if err != nil { + return err + } + return err +} + +func (r FleetmgmtSensor) Serialize(w io.Writer) error { + return writeFleetmgmtSensor(r, w) +} + +func (r FleetmgmtSensor) Schema() string { + return "{\"fields\":[{\"name\":\"vehicle_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":9999,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"engine_temperature\",\"type\":{\"arg.properties\":{\"range\":{\"max\":250,\"min\":150}},\"type\":\"int\"}},{\"name\":\"average_rpm\",\"type\":{\"arg.properties\":{\"range\":{\"max\":5000,\"min\":1800}},\"type\":\"int\"}}],\"name\":\"fleetmgmt.FleetmgmtSensor\",\"type\":\"record\"}" +} + +func (r FleetmgmtSensor) SchemaName() string { + return "fleetmgmt.FleetmgmtSensor" +} + +func (_ FleetmgmtSensor) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetInt(v int32) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetLong(v int64) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetFloat(v float32) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetDouble(v float64) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetString(v string) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *FleetmgmtSensor) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Vehicle_id} + + return w + + case 1: + w := types.Int{Target: &r.Engine_temperature} + + return w + + case 2: + w := types.Int{Target: &r.Average_rpm} + + return w + + } + panic("Unknown field index") +} + +func (r *FleetmgmtSensor) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *FleetmgmtSensor) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ FleetmgmtSensor) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ FleetmgmtSensor) AppendArray() types.Field { panic("Unsupported operation") } +func (_ FleetmgmtSensor) HintSize(int) { panic("Unsupported operation") } +func (_ FleetmgmtSensor) Finalize() {} + +func (_ FleetmgmtSensor) AvroCRC64Fingerprint() []byte { + return []byte(FleetmgmtSensorAvroCRC64Fingerprint) +} + +func (r FleetmgmtSensor) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["vehicle_id"], err = json.Marshal(r.Vehicle_id) + if err != nil { + return nil, err + } + output["engine_temperature"], err = json.Marshal(r.Engine_temperature) + if err != nil { + return nil, err + } + output["average_rpm"], err = json.Marshal(r.Average_rpm) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *FleetmgmtSensor) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["vehicle_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Vehicle_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for vehicle_id") + } + val = func() json.RawMessage { + if v, ok := fields["engine_temperature"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Engine_temperature); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for engine_temperature") + } + val = func() json.RawMessage { + if v, ok := fields["average_rpm"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Average_rpm); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for average_rpm") + } + return nil +} diff --git a/pkg/types/gaming_game.go b/pkg/types/gaming_game.go new file mode 100644 index 00000000..06a368a1 --- /dev/null +++ b/pkg/types/gaming_game.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type GamingGame struct { + Id int32 `json:"id"` + + Room_name string `json:"room_name"` + + Created_date int64 `json:"created_date"` +} + +const GamingGameAvroCRC64Fingerprint = "\xd7\xe57]\x1f\x8bTB" + +func NewGamingGame() GamingGame { + r := GamingGame{} + return r +} + +func DeserializeGamingGame(r io.Reader) (GamingGame, error) { + t := NewGamingGame() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeGamingGameFromSchema(r io.Reader, schema string) (GamingGame, error) { + t := NewGamingGame() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeGamingGame(r GamingGame, w io.Writer) error { + var err error + err = vm.WriteInt(r.Id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Room_name, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Created_date, w) + if err != nil { + return err + } + return err +} + +func (r GamingGame) Serialize(w io.Writer) error { + return writeGamingGame(r, w) +} + +func (r GamingGame) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":5000,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"room_name\",\"type\":{\"arg.properties\":{\"options\":[\"Arcade -- Rookie\",\"Arcade -- Skilled\",\"Arcade -- Expert\",\"Survival -- Rookie\",\"Survival -- Skilled\",\"Survival -- Expert\",\"Classic -- Rookie\",\"Classic -- Skilled\",\"Classic -- Expert\"]},\"type\":\"string\"}},{\"name\":\"created_date\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1609459200000,\"step\":100000}},\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}}],\"name\":\"gaming.GamingGame\",\"type\":\"record\"}" +} + +func (r GamingGame) SchemaName() string { + return "gaming.GamingGame" +} + +func (_ GamingGame) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ GamingGame) SetInt(v int32) { panic("Unsupported operation") } +func (_ GamingGame) SetLong(v int64) { panic("Unsupported operation") } +func (_ GamingGame) SetFloat(v float32) { panic("Unsupported operation") } +func (_ GamingGame) SetDouble(v float64) { panic("Unsupported operation") } +func (_ GamingGame) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ GamingGame) SetString(v string) { panic("Unsupported operation") } +func (_ GamingGame) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *GamingGame) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Id} + + return w + + case 1: + w := types.String{Target: &r.Room_name} + + return w + + case 2: + w := types.Long{Target: &r.Created_date} + + return w + + } + panic("Unknown field index") +} + +func (r *GamingGame) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *GamingGame) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ GamingGame) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ GamingGame) AppendArray() types.Field { panic("Unsupported operation") } +func (_ GamingGame) HintSize(int) { panic("Unsupported operation") } +func (_ GamingGame) Finalize() {} + +func (_ GamingGame) AvroCRC64Fingerprint() []byte { + return []byte(GamingGameAvroCRC64Fingerprint) +} + +func (r GamingGame) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["room_name"], err = json.Marshal(r.Room_name) + if err != nil { + return nil, err + } + output["created_date"], err = json.Marshal(r.Created_date) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *GamingGame) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["room_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Room_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for room_name") + } + val = func() json.RawMessage { + if v, ok := fields["created_date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Created_date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for created_date") + } + return nil +} diff --git a/pkg/types/gaming_player.go b/pkg/types/gaming_player.go new file mode 100644 index 00000000..1b07a2bc --- /dev/null +++ b/pkg/types/gaming_player.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type GamingPlayer struct { + Player_id int32 `json:"player_id"` + + Player_name string `json:"player_name"` + + Ip string `json:"ip"` +} + +const GamingPlayerAvroCRC64Fingerprint = "n\x90\x9b\x9c|\x0306" + +func NewGamingPlayer() GamingPlayer { + r := GamingPlayer{} + return r +} + +func DeserializeGamingPlayer(r io.Reader) (GamingPlayer, error) { + t := NewGamingPlayer() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeGamingPlayerFromSchema(r io.Reader, schema string) (GamingPlayer, error) { + t := NewGamingPlayer() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeGamingPlayer(r GamingPlayer, w io.Writer) error { + var err error + err = vm.WriteInt(r.Player_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Player_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Ip, w) + if err != nil { + return err + } + return err +} + +func (r GamingPlayer) Serialize(w io.Writer) error { + return writeGamingPlayer(r, w) +} + +func (r GamingPlayer) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"ip\":\"117.119.34.13\",\"player_id\":1001,\"player_name\":\"Frieda Baldi\"},{\"ip\":\"253.165.97.77\",\"player_id\":1002,\"player_name\":\"Cherrita Gallaccio\"},{\"ip\":\"98.173.165.60\",\"player_id\":1003,\"player_name\":\"Matt Cleugh\"},{\"ip\":\"213.77.228.11\",\"player_id\":1004,\"player_name\":\"Dulciana Murfill\"},{\"ip\":\"40.62.99.184\",\"player_id\":1005,\"player_name\":\"Germayne Streetley\"},{\"ip\":\"46.152.206.98\",\"player_id\":1006,\"player_name\":\"Brenna Woolfall\"},{\"ip\":\"241.18.67.160\",\"player_id\":1007,\"player_name\":\"Gerhardt Tenbrug\"},{\"ip\":\"60.105.214.197\",\"player_id\":1008,\"player_name\":\"Hayley Tuma\"},{\"ip\":\"68.145.84.22\",\"player_id\":1009,\"player_name\":\"Winny Cadigan\"},{\"ip\":\"189.253.70.170\",\"player_id\":1010,\"player_name\":\"Bonnibelle Macek\"},{\"ip\":\"183.153.131.220\",\"player_id\":1011,\"player_name\":\"Lionel Byneth\"},{\"ip\":\"190.205.93.27\",\"player_id\":1012,\"player_name\":\"Trev Roper\"},{\"ip\":\"122.144.88.117\",\"player_id\":1013,\"player_name\":\"Lena MacFadzean\"},{\"ip\":\"233.122.238.221\",\"player_id\":1014,\"player_name\":\"Benton Allcorn\"},{\"ip\":\"119.248.57.152\",\"player_id\":1015,\"player_name\":\"Avis Moyler\"},{\"ip\":\"221.76.79.166\",\"player_id\":1016,\"player_name\":\"Marchall Rochewell\"},{\"ip\":\"214.194.20.254\",\"player_id\":1017,\"player_name\":\"Adele Bohl\"},{\"ip\":\"48.183.248.225\",\"player_id\":1018,\"player_name\":\"Barnett Mcall\"},{\"ip\":\"109.187.240.70\",\"player_id\":1019,\"player_name\":\"Frieda Pirrone\"},{\"ip\":\"66.106.114.58\",\"player_id\":1020,\"player_name\":\"Pattin Eringey\"},{\"ip\":\"200.181.48.97\",\"player_id\":1021,\"player_name\":\"Kalila Fewings\"},{\"ip\":\"105.180.133.32\",\"player_id\":1022,\"player_name\":\"Giacobo Beuscher\"},{\"ip\":\"195.82.242.168\",\"player_id\":1023,\"player_name\":\"Rozalin Hair\"},{\"ip\":\"193.33.103.229\",\"player_id\":1024,\"player_name\":\"Egon Beagan\"},{\"ip\":\"151.58.194.8\",\"player_id\":1025,\"player_name\":\"Owen Strotton\"},{\"ip\":\"151.18.78.73\",\"player_id\":1026,\"player_name\":\"Fernando Rosensaft\"},{\"ip\":\"245.93.20.235\",\"player_id\":1027,\"player_name\":\"Carleton Gwyther\"},{\"ip\":\"71.191.233.253\",\"player_id\":1028,\"player_name\":\"Kata Coll\"},{\"ip\":\"151.228.5.139\",\"player_id\":1029,\"player_name\":\"Rossie Hobben\"},{\"ip\":\"195.209.115.240\",\"player_id\":1030,\"player_name\":\"Stephanie Gookey\"},{\"ip\":\"137.210.104.16\",\"player_id\":1031,\"player_name\":\"Robyn Milazzo\"},{\"ip\":\"59.26.115.135\",\"player_id\":1032,\"player_name\":\"Tilda O'Lunney\"},{\"ip\":\"242.91.60.243\",\"player_id\":1033,\"player_name\":\"Nolan Kidney\"},{\"ip\":\"44.125.117.30\",\"player_id\":1034,\"player_name\":\"Jori Ottiwill\"},{\"ip\":\"58.22.186.13\",\"player_id\":1035,\"player_name\":\"Benito Graveson\"},{\"ip\":\"11.107.127.127\",\"player_id\":1036,\"player_name\":\"Zechariah Wrate\"},{\"ip\":\"145.156.130.86\",\"player_id\":1037,\"player_name\":\"Chelsae Napton\"},{\"ip\":\"128.91.240.205\",\"player_id\":1038,\"player_name\":\"Jeremy Heffernon\"},{\"ip\":\"175.36.181.120\",\"player_id\":1039,\"player_name\":\"Derk McAviy\"},{\"ip\":\"71.176.200.104\",\"player_id\":1040,\"player_name\":\"Constantin Mears\"},{\"ip\":\"61.160.45.31\",\"player_id\":1041,\"player_name\":\"Fitz Ballin\"},{\"ip\":\"174.111.209.131\",\"player_id\":1042,\"player_name\":\"Essy Bettles\"},{\"ip\":\"28.50.5.234\",\"player_id\":1043,\"player_name\":\"Gene Klemt\"},{\"ip\":\"56.180.162.177\",\"player_id\":1044,\"player_name\":\"Nikolai Arnopp\"},{\"ip\":\"206.250.61.47\",\"player_id\":1045,\"player_name\":\"Gustave Westhofer\"},{\"ip\":\"29.250.237.107\",\"player_id\":1046,\"player_name\":\"Simona Mayhow\"},{\"ip\":\"26.45.199.135\",\"player_id\":1047,\"player_name\":\"Cort Bainbridge\"},{\"ip\":\"31.46.35.158\",\"player_id\":1048,\"player_name\":\"Sibyl Vockins\"},{\"ip\":\"199.22.148.96\",\"player_id\":1049,\"player_name\":\"Andriette Gaze\"},{\"ip\":\"9.130.149.231\",\"player_id\":1050,\"player_name\":\"Shaughn De Simoni\"},{\"ip\":\"206.228.92.173\",\"player_id\":1051,\"player_name\":\"Nathaniel Hallowell\"},{\"ip\":\"236.38.31.50\",\"player_id\":1052,\"player_name\":\"Charley Dudill\"},{\"ip\":\"37.136.192.70\",\"player_id\":1053,\"player_name\":\"Cirstoforo Joblin\"},{\"ip\":\"107.27.178.139\",\"player_id\":1054,\"player_name\":\"Hyacinthia Kinastan\"},{\"ip\":\"29.183.6.183\",\"player_id\":1055,\"player_name\":\"Dur Lasselle\"},{\"ip\":\"118.222.29.232\",\"player_id\":1056,\"player_name\":\"Gay Chadburn\"},{\"ip\":\"232.200.180.97\",\"player_id\":1057,\"player_name\":\"Livvie Hawyes\"},{\"ip\":\"198.1.226.227\",\"player_id\":1058,\"player_name\":\"Aldrich MacVay\"},{\"ip\":\"64.39.185.31\",\"player_id\":1059,\"player_name\":\"Riva Rossant\"},{\"ip\":\"243.28.102.230\",\"player_id\":1060,\"player_name\":\"Johanna Reichartz\"},{\"ip\":\"252.49.141.204\",\"player_id\":1061,\"player_name\":\"Trent Gantlett\"},{\"ip\":\"215.235.104.14\",\"player_id\":1062,\"player_name\":\"Aryn Haskell\"},{\"ip\":\"61.59.180.203\",\"player_id\":1063,\"player_name\":\"Byrann Barock\"},{\"ip\":\"159.45.141.92\",\"player_id\":1064,\"player_name\":\"Gerda Cleugher\"},{\"ip\":\"212.156.139.166\",\"player_id\":1065,\"player_name\":\"Sonnie Guildford\"},{\"ip\":\"72.176.106.166\",\"player_id\":1066,\"player_name\":\"Vergil Borge\"},{\"ip\":\"199.23.37.30\",\"player_id\":1067,\"player_name\":\"Lurline Rocco\"},{\"ip\":\"204.124.16.39\",\"player_id\":1068,\"player_name\":\"Geoff Eddy\"},{\"ip\":\"144.103.183.21\",\"player_id\":1069,\"player_name\":\"Zea Leighton\"},{\"ip\":\"46.192.83.190\",\"player_id\":1070,\"player_name\":\"Leif Baden\"},{\"ip\":\"107.164.34.84\",\"player_id\":1071,\"player_name\":\"Quint Bidgod\"},{\"ip\":\"104.16.237.57\",\"player_id\":1072,\"player_name\":\"Talbot Cashell\"},{\"ip\":\"106.79.164.228\",\"player_id\":1073,\"player_name\":\"Sheridan Foulsham\"},{\"ip\":\"243.10.150.38\",\"player_id\":1074,\"player_name\":\"Camile Shrimplin\"},{\"ip\":\"194.5.112.254\",\"player_id\":1075,\"player_name\":\"Marcel Nayshe\"},{\"ip\":\"34.10.81.209\",\"player_id\":1076,\"player_name\":\"Lea Murrish\"},{\"ip\":\"136.17.217.222\",\"player_id\":1077,\"player_name\":\"Lucais Midson\"},{\"ip\":\"174.7.59.85\",\"player_id\":1078,\"player_name\":\"Zeb Rylatt\"},{\"ip\":\"219.151.0.93\",\"player_id\":1079,\"player_name\":\"Nertie Zuker\"},{\"ip\":\"183.255.62.100\",\"player_id\":1080,\"player_name\":\"Babara Henderson\"},{\"ip\":\"131.82.63.116\",\"player_id\":1081,\"player_name\":\"Electra Ridgley\"},{\"ip\":\"88.103.168.162\",\"player_id\":1082,\"player_name\":\"Jere Standingford\"},{\"ip\":\"255.154.216.143\",\"player_id\":1083,\"player_name\":\"Cyril Yellowlea\"},{\"ip\":\"25.97.116.94\",\"player_id\":1084,\"player_name\":\"Isadora Peegrem\"},{\"ip\":\"160.99.254.200\",\"player_id\":1085,\"player_name\":\"Caria Smewings\"},{\"ip\":\"113.47.135.39\",\"player_id\":1086,\"player_name\":\"Karena Kauffman\"},{\"ip\":\"187.131.135.163\",\"player_id\":1087,\"player_name\":\"Haywood Snowball\"},{\"ip\":\"143.25.215.3\",\"player_id\":1088,\"player_name\":\"Winslow Starcks\"},{\"ip\":\"78.107.115.65\",\"player_id\":1089,\"player_name\":\"Alis Ponton\"},{\"ip\":\"101.231.38.202\",\"player_id\":1090,\"player_name\":\"Marietta Lezemere\"},{\"ip\":\"22.30.43.226\",\"player_id\":1091,\"player_name\":\"Emilee Broadbridge\"},{\"ip\":\"77.208.184.143\",\"player_id\":1092,\"player_name\":\"Faye Beaument\"},{\"ip\":\"72.88.181.74\",\"player_id\":1093,\"player_name\":\"Shannah Beatson\"},{\"ip\":\"232.20.218.30\",\"player_id\":1094,\"player_name\":\"West Doy\"},{\"ip\":\"141.46.127.99\",\"player_id\":1095,\"player_name\":\"Chryste Wren\"},{\"ip\":\"120.63.46.231\",\"player_id\":1096,\"player_name\":\"Trumann Labba\"},{\"ip\":\"82.97.69.85\",\"player_id\":1097,\"player_name\":\"Anatollo Beckwith\"},{\"ip\":\"213.241.29.166\",\"player_id\":1098,\"player_name\":\"Konstanze Dunsford\"},{\"ip\":\"183.237.217.217\",\"player_id\":1099,\"player_name\":\"Raychel Roset\"},{\"ip\":\"165.19.12.241\",\"player_id\":1100,\"player_name\":\"Heindrick Ravenscroft\"}]},\"fields\":[{\"name\":\"player_id\",\"type\":\"int\"},{\"name\":\"player_name\",\"type\":\"string\"},{\"name\":\"ip\",\"type\":\"string\"}],\"name\":\"gaming.GamingPlayer\",\"type\":\"record\"}" +} + +func (r GamingPlayer) SchemaName() string { + return "gaming.GamingPlayer" +} + +func (_ GamingPlayer) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ GamingPlayer) SetInt(v int32) { panic("Unsupported operation") } +func (_ GamingPlayer) SetLong(v int64) { panic("Unsupported operation") } +func (_ GamingPlayer) SetFloat(v float32) { panic("Unsupported operation") } +func (_ GamingPlayer) SetDouble(v float64) { panic("Unsupported operation") } +func (_ GamingPlayer) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ GamingPlayer) SetString(v string) { panic("Unsupported operation") } +func (_ GamingPlayer) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *GamingPlayer) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Player_id} + + return w + + case 1: + w := types.String{Target: &r.Player_name} + + return w + + case 2: + w := types.String{Target: &r.Ip} + + return w + + } + panic("Unknown field index") +} + +func (r *GamingPlayer) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *GamingPlayer) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ GamingPlayer) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ GamingPlayer) AppendArray() types.Field { panic("Unsupported operation") } +func (_ GamingPlayer) HintSize(int) { panic("Unsupported operation") } +func (_ GamingPlayer) Finalize() {} + +func (_ GamingPlayer) AvroCRC64Fingerprint() []byte { + return []byte(GamingPlayerAvroCRC64Fingerprint) +} + +func (r GamingPlayer) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["player_id"], err = json.Marshal(r.Player_id) + if err != nil { + return nil, err + } + output["player_name"], err = json.Marshal(r.Player_name) + if err != nil { + return nil, err + } + output["ip"], err = json.Marshal(r.Ip) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *GamingPlayer) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["player_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Player_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for player_id") + } + val = func() json.RawMessage { + if v, ok := fields["player_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Player_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for player_name") + } + val = func() json.RawMessage { + if v, ok := fields["ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip") + } + return nil +} diff --git a/pkg/types/gaming_player_activity.go b/pkg/types/gaming_player_activity.go new file mode 100644 index 00000000..71b61002 --- /dev/null +++ b/pkg/types/gaming_player_activity.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type GamingPlayerActivity struct { + Player_id int32 `json:"player_id"` + + Game_room_id int32 `json:"game_room_id"` + + Points int32 `json:"points"` + + Coordinates string `json:"coordinates"` +} + +const GamingPlayerActivityAvroCRC64Fingerprint = " \xfdC\x90\x81\fJ\xb5" + +func NewGamingPlayerActivity() GamingPlayerActivity { + r := GamingPlayerActivity{} + return r +} + +func DeserializeGamingPlayerActivity(r io.Reader) (GamingPlayerActivity, error) { + t := NewGamingPlayerActivity() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeGamingPlayerActivityFromSchema(r io.Reader, schema string) (GamingPlayerActivity, error) { + t := NewGamingPlayerActivity() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeGamingPlayerActivity(r GamingPlayerActivity, w io.Writer) error { + var err error + err = vm.WriteInt(r.Player_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Game_room_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Points, w) + if err != nil { + return err + } + err = vm.WriteString(r.Coordinates, w) + if err != nil { + return err + } + return err +} + +func (r GamingPlayerActivity) Serialize(w io.Writer) error { + return writeGamingPlayerActivity(r, w) +} + +func (r GamingPlayerActivity) Schema() string { + return "{\"fields\":[{\"name\":\"player_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1101,\"min\":1001}},\"type\":\"int\"}},{\"name\":\"game_room_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":5000,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"points\",\"type\":{\"arg.properties\":{\"range\":{\"max\":500,\"min\":10}},\"type\":\"int\"}},{\"name\":\"coordinates\",\"type\":{\"arg.properties\":{\"regex\":\"\\\\[[0-9][0-9],[0-9][0-9]\\\\]\"},\"type\":\"string\"}}],\"name\":\"gaming.GamingPlayerActivity\",\"type\":\"record\"}" +} + +func (r GamingPlayerActivity) SchemaName() string { + return "gaming.GamingPlayerActivity" +} + +func (_ GamingPlayerActivity) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetInt(v int32) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetLong(v int64) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetFloat(v float32) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetDouble(v float64) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetString(v string) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *GamingPlayerActivity) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Player_id} + + return w + + case 1: + w := types.Int{Target: &r.Game_room_id} + + return w + + case 2: + w := types.Int{Target: &r.Points} + + return w + + case 3: + w := types.String{Target: &r.Coordinates} + + return w + + } + panic("Unknown field index") +} + +func (r *GamingPlayerActivity) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *GamingPlayerActivity) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ GamingPlayerActivity) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ GamingPlayerActivity) AppendArray() types.Field { panic("Unsupported operation") } +func (_ GamingPlayerActivity) HintSize(int) { panic("Unsupported operation") } +func (_ GamingPlayerActivity) Finalize() {} + +func (_ GamingPlayerActivity) AvroCRC64Fingerprint() []byte { + return []byte(GamingPlayerActivityAvroCRC64Fingerprint) +} + +func (r GamingPlayerActivity) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["player_id"], err = json.Marshal(r.Player_id) + if err != nil { + return nil, err + } + output["game_room_id"], err = json.Marshal(r.Game_room_id) + if err != nil { + return nil, err + } + output["points"], err = json.Marshal(r.Points) + if err != nil { + return nil, err + } + output["coordinates"], err = json.Marshal(r.Coordinates) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *GamingPlayerActivity) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["player_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Player_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for player_id") + } + val = func() json.RawMessage { + if v, ok := fields["game_room_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Game_room_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for game_room_id") + } + val = func() json.RawMessage { + if v, ok := fields["points"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Points); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for points") + } + val = func() json.RawMessage { + if v, ok := fields["coordinates"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Coordinates); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for coordinates") + } + return nil +} diff --git a/pkg/types/insurance_customer.go b/pkg/types/insurance_customer.go new file mode 100644 index 00000000..2b0d14b5 --- /dev/null +++ b/pkg/types/insurance_customer.go @@ -0,0 +1,393 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type InsuranceCustomer struct { + Customer_id int32 `json:"customer_id"` + + First_name string `json:"first_name"` + + Last_name string `json:"last_name"` + + Email string `json:"email"` + + Gender string `json:"gender"` + + Income int32 `json:"income"` + + Fico int32 `json:"fico"` + + Years_active int32 `json:"years_active"` +} + +const InsuranceCustomerAvroCRC64Fingerprint = "?*G\\\xf7\x1b\xafU" + +func NewInsuranceCustomer() InsuranceCustomer { + r := InsuranceCustomer{} + return r +} + +func DeserializeInsuranceCustomer(r io.Reader) (InsuranceCustomer, error) { + t := NewInsuranceCustomer() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeInsuranceCustomerFromSchema(r io.Reader, schema string) (InsuranceCustomer, error) { + t := NewInsuranceCustomer() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeInsuranceCustomer(r InsuranceCustomer, w io.Writer) error { + var err error + err = vm.WriteInt(r.Customer_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.First_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Last_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Email, w) + if err != nil { + return err + } + err = vm.WriteString(r.Gender, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Income, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Fico, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Years_active, w) + if err != nil { + return err + } + return err +} + +func (r InsuranceCustomer) Serialize(w io.Writer) error { + return writeInsuranceCustomer(r, w) +} + +func (r InsuranceCustomer) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"customer_id\":415,\"email\":\"hagdahlbi@last.fm\",\"fico\":423,\"first_name\":\"Herold\",\"gender\":\"Male\",\"income\":444152,\"last_name\":\"Agdahl\",\"years_active\":1},{\"customer_id\":871,\"email\":\"npenningtono6@hao123.com\",\"fico\":767,\"first_name\":\"Nikkie\",\"gender\":\"Female\",\"income\":452642,\"last_name\":\"Pennington\",\"years_active\":36},{\"customer_id\":597,\"email\":\"jcolefordgk@unesco.org\",\"fico\":730,\"first_name\":\"Josi\",\"gender\":\"Female\",\"income\":430798,\"last_name\":\"Coleford\",\"years_active\":1},{\"customer_id\":210,\"email\":\"abrockway5t@wiley.com\",\"fico\":661,\"first_name\":\"Alis\",\"gender\":\"Female\",\"income\":210965,\"last_name\":\"Brockway\",\"years_active\":30},{\"customer_id\":833,\"email\":\"etzarn4@umich.edu\",\"fico\":771,\"first_name\":\"Eugine\",\"gender\":\"Female\",\"income\":390882,\"last_name\":\"Tzar\",\"years_active\":43},{\"customer_id\":371,\"email\":\"lskidmoreaa@moonfruit.com\",\"fico\":482,\"first_name\":\"Larina\",\"gender\":\"Female\",\"income\":261165,\"last_name\":\"Skidmore\",\"years_active\":41},{\"customer_id\":387,\"email\":\"rbecclesaq@cpanel.net\",\"fico\":821,\"first_name\":\"Raffarty\",\"gender\":\"Male\",\"income\":348862,\"last_name\":\"Beccles\",\"years_active\":43},{\"customer_id\":313,\"email\":\"wbreadon8o@altervista.org\",\"fico\":880,\"first_name\":\"Winn\",\"gender\":\"Male\",\"income\":489764,\"last_name\":\"Breadon\",\"years_active\":10},{\"customer_id\":882,\"email\":\"higooh@nhs.uk\",\"fico\":893,\"first_name\":\"Harold\",\"gender\":\"Male\",\"income\":55800,\"last_name\":\"Igo\",\"years_active\":31},{\"customer_id\":854,\"email\":\"bhenrichsennp@hp.com\",\"fico\":839,\"first_name\":\"Barbara\",\"gender\":\"Female\",\"income\":111818,\"last_name\":\"Henrichsen\",\"years_active\":2},{\"customer_id\":895,\"email\":\"nminciniou@blinklist.com\",\"fico\":811,\"first_name\":\"Nani\",\"gender\":\"Female\",\"income\":212199,\"last_name\":\"Mincini\",\"years_active\":36},{\"customer_id\":198,\"email\":\"rfowgies5h@meetup.com\",\"fico\":469,\"first_name\":\"Rudd\",\"gender\":\"Male\",\"income\":337648,\"last_name\":\"Fowgies\",\"years_active\":19},{\"customer_id\":468,\"email\":\"ckarolyicz@paginegialle.it\",\"fico\":686,\"first_name\":\"Cecily\",\"gender\":\"Female\",\"income\":287668,\"last_name\":\"Karolyi\",\"years_active\":39},{\"customer_id\":860,\"email\":\"jkendernv@ucsd.edu\",\"fico\":753,\"first_name\":\"Jessalin\",\"gender\":\"Female\",\"income\":91516,\"last_name\":\"Kender\",\"years_active\":44},{\"customer_id\":383,\"email\":\"hramageam@alibaba.com\",\"fico\":414,\"first_name\":\"Hollis\",\"gender\":\"Male\",\"income\":367829,\"last_name\":\"Ramage\",\"years_active\":43},{\"customer_id\":226,\"email\":\"ekerrod69@sciencedaily.com\",\"fico\":793,\"first_name\":\"Eleonore\",\"gender\":\"Female\",\"income\":260176,\"last_name\":\"Kerrod\",\"years_active\":41},{\"customer_id\":630,\"email\":\"samayahh@phpbb.com\",\"fico\":536,\"first_name\":\"Shaylynn\",\"gender\":\"Female\",\"income\":454307,\"last_name\":\"Amaya\",\"years_active\":25},{\"customer_id\":546,\"email\":\"hidiensf5@shop-pro.jp\",\"fico\":645,\"first_name\":\"Had\",\"gender\":\"Male\",\"income\":223522,\"last_name\":\"Idiens\",\"years_active\":44},{\"customer_id\":949,\"email\":\"fdumphriesqc@clickbank.net\",\"fico\":756,\"first_name\":\"Farrand\",\"gender\":\"Female\",\"income\":410888,\"last_name\":\"Dumphries\",\"years_active\":41},{\"customer_id\":276,\"email\":\"ccloughton7n@phoca.cz\",\"fico\":416,\"first_name\":\"Carena\",\"gender\":\"Female\",\"income\":495407,\"last_name\":\"Cloughton\",\"years_active\":20},{\"customer_id\":595,\"email\":\"gsteingi@imgur.com\",\"fico\":597,\"first_name\":\"Graham\",\"gender\":\"Male\",\"income\":346149,\"last_name\":\"Stein\",\"years_active\":24},{\"customer_id\":406,\"email\":\"cfarrinb9@yellowpages.com\",\"fico\":826,\"first_name\":\"Consolata\",\"gender\":\"Female\",\"income\":126493,\"last_name\":\"Farrin\",\"years_active\":11},{\"customer_id\":565,\"email\":\"tmollenefo@stanford.edu\",\"fico\":730,\"first_name\":\"Trev\",\"gender\":\"Male\",\"income\":76961,\"last_name\":\"Mollene\",\"years_active\":34},{\"customer_id\":129,\"email\":\"nsidary3k@netscape.com\",\"fico\":821,\"first_name\":\"Nicholle\",\"gender\":\"Female\",\"income\":82035,\"last_name\":\"Sidary\",\"years_active\":23},{\"customer_id\":973,\"email\":\"resposir0@histats.com\",\"fico\":409,\"first_name\":\"Robby\",\"gender\":\"Male\",\"income\":315754,\"last_name\":\"Esposi\",\"years_active\":5},{\"customer_id\":10,\"email\":\"ahardstaff9@ask.com\",\"fico\":842,\"first_name\":\"Antonietta\",\"gender\":\"Female\",\"income\":417732,\"last_name\":\"Hardstaff\",\"years_active\":9},{\"customer_id\":579,\"email\":\"esteereg2@domainmarket.com\",\"fico\":722,\"first_name\":\"Emyle\",\"gender\":\"Female\",\"income\":380771,\"last_name\":\"Steere\",\"years_active\":38},{\"customer_id\":167,\"email\":\"srenfield4m@mayoclinic.com\",\"fico\":453,\"first_name\":\"Storm\",\"gender\":\"Female\",\"income\":386862,\"last_name\":\"Renfield\",\"years_active\":37},{\"customer_id\":273,\"email\":\"phyder7k@cnn.com\",\"fico\":808,\"first_name\":\"Phillipp\",\"gender\":\"Male\",\"income\":223150,\"last_name\":\"Hyder\",\"years_active\":15},{\"customer_id\":548,\"email\":\"nklassf7@usgs.gov\",\"fico\":672,\"first_name\":\"Noelle\",\"gender\":\"Female\",\"income\":50831,\"last_name\":\"Klass\",\"years_active\":39},{\"customer_id\":175,\"email\":\"gjannasch4u@umich.edu\",\"fico\":791,\"first_name\":\"Garek\",\"gender\":\"Male\",\"income\":58157,\"last_name\":\"Jannasch\",\"years_active\":44},{\"customer_id\":957,\"email\":\"rreapeqk@g.co\",\"fico\":835,\"first_name\":\"Rena\",\"gender\":\"Female\",\"income\":372940,\"last_name\":\"Reape\",\"years_active\":35},{\"customer_id\":45,\"email\":\"kfydoe18@npr.org\",\"fico\":465,\"first_name\":\"Kelcey\",\"gender\":\"Female\",\"income\":245023,\"last_name\":\"Fydoe\",\"years_active\":44},{\"customer_id\":582,\"email\":\"wmerigeaug5@friendfeed.com\",\"fico\":660,\"first_name\":\"Wolfy\",\"gender\":\"Male\",\"income\":366902,\"last_name\":\"Merigeau\",\"years_active\":18},{\"customer_id\":66,\"email\":\"chughes1t@google.it\",\"fico\":709,\"first_name\":\"Charita\",\"gender\":\"Female\",\"income\":455085,\"last_name\":\"Hughes\",\"years_active\":41},{\"customer_id\":472,\"email\":\"dmarcoolynd3@toplist.cz\",\"fico\":485,\"first_name\":\"Davie\",\"gender\":\"Male\",\"income\":369945,\"last_name\":\"Marcoolyn\",\"years_active\":30},{\"customer_id\":578,\"email\":\"ssallansg1@gnu.org\",\"fico\":435,\"first_name\":\"Suzann\",\"gender\":\"Female\",\"income\":137396,\"last_name\":\"Sallans\",\"years_active\":35},{\"customer_id\":825,\"email\":\"bshopcottmw@edublogs.org\",\"fico\":876,\"first_name\":\"Brooks\",\"gender\":\"Male\",\"income\":362624,\"last_name\":\"Shopcott\",\"years_active\":33},{\"customer_id\":572,\"email\":\"gblethinfv@reddit.com\",\"fico\":798,\"first_name\":\"Grant\",\"gender\":\"Male\",\"income\":154295,\"last_name\":\"Blethin\",\"years_active\":43},{\"customer_id\":322,\"email\":\"imallen8x@networksolutions.com\",\"fico\":714,\"first_name\":\"Idaline\",\"gender\":\"Female\",\"income\":74954,\"last_name\":\"Mallen\",\"years_active\":35},{\"customer_id\":864,\"email\":\"gcaddynz@pcworld.com\",\"fico\":633,\"first_name\":\"Gill\",\"gender\":\"Male\",\"income\":298967,\"last_name\":\"Caddy\",\"years_active\":42},{\"customer_id\":272,\"email\":\"mepton7j@oaic.gov.au\",\"fico\":551,\"first_name\":\"Mariele\",\"gender\":\"Female\",\"income\":482891,\"last_name\":\"Epton\",\"years_active\":45},{\"customer_id\":910,\"email\":\"gfarmanp9@seesaa.net\",\"fico\":599,\"first_name\":\"Gerry\",\"gender\":\"Male\",\"income\":350830,\"last_name\":\"Farman\",\"years_active\":19},{\"customer_id\":507,\"email\":\"cwillavizee2@networksolutions.com\",\"fico\":518,\"first_name\":\"Cirillo\",\"gender\":\"Male\",\"income\":87378,\"last_name\":\"Willavize\",\"years_active\":30},{\"customer_id\":942,\"email\":\"wakredq5@twitter.com\",\"fico\":808,\"first_name\":\"Wendye\",\"gender\":\"Female\",\"income\":311450,\"last_name\":\"Akred\",\"years_active\":17},{\"customer_id\":368,\"email\":\"dedensora7@wired.com\",\"fico\":440,\"first_name\":\"Delmor\",\"gender\":\"Male\",\"income\":225683,\"last_name\":\"Edensor\",\"years_active\":11},{\"customer_id\":643,\"email\":\"rbiggenhu@yellowpages.com\",\"fico\":722,\"first_name\":\"Rori\",\"gender\":\"Female\",\"income\":119504,\"last_name\":\"Biggen\",\"years_active\":32},{\"customer_id\":421,\"email\":\"rdronbo@hibu.com\",\"fico\":596,\"first_name\":\"Reiko\",\"gender\":\"Female\",\"income\":339053,\"last_name\":\"Dron\",\"years_active\":39},{\"customer_id\":92,\"email\":\"wtollett2j@amazon.de\",\"fico\":803,\"first_name\":\"Willey\",\"gender\":\"Male\",\"income\":278712,\"last_name\":\"Tollett\",\"years_active\":19},{\"customer_id\":433,\"email\":\"tlittleyc0@t-online.de\",\"fico\":759,\"first_name\":\"Tadio\",\"gender\":\"Male\",\"income\":294165,\"last_name\":\"Littley\",\"years_active\":6},{\"customer_id\":75,\"email\":\"csherewood22@loc.gov\",\"fico\":815,\"first_name\":\"Claiborn\",\"gender\":\"Male\",\"income\":128802,\"last_name\":\"Sherewood\",\"years_active\":32},{\"customer_id\":305,\"email\":\"tkrikorian8g@wordpress.com\",\"fico\":719,\"first_name\":\"Tierney\",\"gender\":\"Female\",\"income\":175243,\"last_name\":\"Krikorian\",\"years_active\":3},{\"customer_id\":173,\"email\":\"gmallya4s@mozilla.com\",\"fico\":552,\"first_name\":\"Gwendolin\",\"gender\":\"Female\",\"income\":435535,\"last_name\":\"Mallya\",\"years_active\":16},{\"customer_id\":863,\"email\":\"hbrunkerny@go.com\",\"fico\":799,\"first_name\":\"Hali\",\"gender\":\"Female\",\"income\":450239,\"last_name\":\"Brunker\",\"years_active\":37},{\"customer_id\":315,\"email\":\"elitherland8q@icq.com\",\"fico\":786,\"first_name\":\"Eba\",\"gender\":\"Female\",\"income\":369614,\"last_name\":\"Litherland\",\"years_active\":9},{\"customer_id\":344,\"email\":\"drheam9j@ustream.tv\",\"fico\":884,\"first_name\":\"Darby\",\"gender\":\"Female\",\"income\":105164,\"last_name\":\"Rheam\",\"years_active\":45},{\"customer_id\":526,\"email\":\"hocleryel@plala.or.jp\",\"fico\":759,\"first_name\":\"Hadria\",\"gender\":\"Female\",\"income\":404047,\"last_name\":\"O'Clery\",\"years_active\":12},{\"customer_id\":264,\"email\":\"gandri7b@stumbleupon.com\",\"fico\":615,\"first_name\":\"Gwenni\",\"gender\":\"Female\",\"income\":164274,\"last_name\":\"Andri\",\"years_active\":28},{\"customer_id\":225,\"email\":\"carmell68@tinyurl.com\",\"fico\":621,\"first_name\":\"Carmelita\",\"gender\":\"Female\",\"income\":355234,\"last_name\":\"Armell\",\"years_active\":28},{\"customer_id\":40,\"email\":\"fludl13@chron.com\",\"fico\":451,\"first_name\":\"Flemming\",\"gender\":\"Male\",\"income\":50188,\"last_name\":\"Ludl\",\"years_active\":4},{\"customer_id\":866,\"email\":\"cikringillo1@newsvine.com\",\"fico\":500,\"first_name\":\"Concettina\",\"gender\":\"Female\",\"income\":380505,\"last_name\":\"Ikringill\",\"years_active\":31},{\"customer_id\":473,\"email\":\"lmapplesd4@icq.com\",\"fico\":850,\"first_name\":\"Legra\",\"gender\":\"Female\",\"income\":109376,\"last_name\":\"Mapples\",\"years_active\":13},{\"customer_id\":662,\"email\":\"vthoresbyid@wordpress.org\",\"fico\":418,\"first_name\":\"Viviana\",\"gender\":\"Female\",\"income\":253060,\"last_name\":\"Thoresby\",\"years_active\":41},{\"customer_id\":611,\"email\":\"dgerrietzgy@pcworld.com\",\"fico\":769,\"first_name\":\"Dita\",\"gender\":\"Female\",\"income\":323327,\"last_name\":\"Gerrietz\",\"years_active\":24},{\"customer_id\":401,\"email\":\"slatheeb4@foxnews.com\",\"fico\":848,\"first_name\":\"Sapphire\",\"gender\":\"Female\",\"income\":477165,\"last_name\":\"Lathee\",\"years_active\":9},{\"customer_id\":993,\"email\":\"bcornessrk@craigslist.org\",\"fico\":474,\"first_name\":\"Bengt\",\"gender\":\"Male\",\"income\":394992,\"last_name\":\"Corness\",\"years_active\":14},{\"customer_id\":158,\"email\":\"mteffrey4d@amazon.com\",\"fico\":826,\"first_name\":\"Morton\",\"gender\":\"Male\",\"income\":185934,\"last_name\":\"Teffrey\",\"years_active\":19},{\"customer_id\":997,\"email\":\"lcrocroftro@marriott.com\",\"fico\":833,\"first_name\":\"Levi\",\"gender\":\"Male\",\"income\":364541,\"last_name\":\"Crocroft\",\"years_active\":15},{\"customer_id\":43,\"email\":\"kflancinbaum16@w3.org\",\"fico\":713,\"first_name\":\"Kele\",\"gender\":\"Male\",\"income\":468948,\"last_name\":\"Flancinbaum\",\"years_active\":42},{\"customer_id\":36,\"email\":\"skitleez@goo.gl\",\"fico\":569,\"first_name\":\"Shaylynn\",\"gender\":\"Female\",\"income\":128959,\"last_name\":\"Kitlee\",\"years_active\":21},{\"customer_id\":843,\"email\":\"mspringtorpene@netlog.com\",\"fico\":545,\"first_name\":\"Maia\",\"gender\":\"Female\",\"income\":204079,\"last_name\":\"Springtorpe\",\"years_active\":1},{\"customer_id\":814,\"email\":\"ncosterml@newyorker.com\",\"fico\":404,\"first_name\":\"Nolie\",\"gender\":\"Female\",\"income\":260330,\"last_name\":\"Coster\",\"years_active\":31},{\"customer_id\":965,\"email\":\"mmorgonqs@blogspot.com\",\"fico\":433,\"first_name\":\"Marty\",\"gender\":\"Male\",\"income\":424541,\"last_name\":\"Morgon\",\"years_active\":8},{\"customer_id\":967,\"email\":\"ctinniswoodqu@macromedia.com\",\"fico\":606,\"first_name\":\"Ceciley\",\"gender\":\"Female\",\"income\":368036,\"last_name\":\"Tinniswood\",\"years_active\":39},{\"customer_id\":470,\"email\":\"ddeportd1@xrea.com\",\"fico\":699,\"first_name\":\"Davie\",\"gender\":\"Male\",\"income\":57483,\"last_name\":\"Deport\",\"years_active\":22},{\"customer_id\":55,\"email\":\"jborgars1i@wp.com\",\"fico\":837,\"first_name\":\"Jae\",\"gender\":\"Male\",\"income\":388179,\"last_name\":\"Borgars\",\"years_active\":15},{\"customer_id\":615,\"email\":\"mbrewoodh2@acquirethisname.com\",\"fico\":890,\"first_name\":\"Melvin\",\"gender\":\"Male\",\"income\":456571,\"last_name\":\"Brewood\",\"years_active\":26},{\"customer_id\":30,\"email\":\"sbent@spiegel.de\",\"fico\":603,\"first_name\":\"Staford\",\"gender\":\"Male\",\"income\":362731,\"last_name\":\"Ben\",\"years_active\":4},{\"customer_id\":894,\"email\":\"gfallowfieldot@51.la\",\"fico\":422,\"first_name\":\"Garreth\",\"gender\":\"Male\",\"income\":310827,\"last_name\":\"Fallowfield\",\"years_active\":40},{\"customer_id\":333,\"email\":\"kdarnbrough98@parallels.com\",\"fico\":580,\"first_name\":\"Krystalle\",\"gender\":\"Female\",\"income\":276156,\"last_name\":\"Darnbrough\",\"years_active\":36},{\"customer_id\":763,\"email\":\"mmealel6@omniture.com\",\"fico\":723,\"first_name\":\"Major\",\"gender\":\"Male\",\"income\":309416,\"last_name\":\"Meale\",\"years_active\":38},{\"customer_id\":929,\"email\":\"blaingps@scientificamerican.com\",\"fico\":769,\"first_name\":\"Bennie\",\"gender\":\"Female\",\"income\":450578,\"last_name\":\"Laing\",\"years_active\":8},{\"customer_id\":994,\"email\":\"rlinebargerrl@si.edu\",\"fico\":890,\"first_name\":\"Raeann\",\"gender\":\"Female\",\"income\":484790,\"last_name\":\"Linebarger\",\"years_active\":33},{\"customer_id\":771,\"email\":\"esouthgatele@g.co\",\"fico\":761,\"first_name\":\"Emory\",\"gender\":\"Male\",\"income\":161393,\"last_name\":\"Southgate\",\"years_active\":14},{\"customer_id\":601,\"email\":\"mchethamgo@google.it\",\"fico\":598,\"first_name\":\"Madella\",\"gender\":\"Female\",\"income\":191473,\"last_name\":\"Chetham\",\"years_active\":29},{\"customer_id\":634,\"email\":\"ekrollhl@sun.com\",\"fico\":672,\"first_name\":\"Elita\",\"gender\":\"Female\",\"income\":318111,\"last_name\":\"Kroll\",\"years_active\":10},{\"customer_id\":955,\"email\":\"hewbankeqi@globo.com\",\"fico\":563,\"first_name\":\"Hazel\",\"gender\":\"Female\",\"income\":392441,\"last_name\":\"Ewbanke\",\"years_active\":11},{\"customer_id\":310,\"email\":\"lcrafts8l@about.me\",\"fico\":445,\"first_name\":\"Lodovico\",\"gender\":\"Male\",\"income\":125866,\"last_name\":\"Crafts\",\"years_active\":21},{\"customer_id\":463,\"email\":\"cpiggfordcu@google.com.au\",\"fico\":835,\"first_name\":\"Corilla\",\"gender\":\"Female\",\"income\":194180,\"last_name\":\"Piggford\",\"years_active\":25},{\"customer_id\":887,\"email\":\"bbutteryom@soundcloud.com\",\"fico\":536,\"first_name\":\"Brennan\",\"gender\":\"Male\",\"income\":67549,\"last_name\":\"Buttery\",\"years_active\":40},{\"customer_id\":770,\"email\":\"nhallgathld@ehow.com\",\"fico\":659,\"first_name\":\"Nicol\",\"gender\":\"Female\",\"income\":77799,\"last_name\":\"Hallgath\",\"years_active\":24},{\"customer_id\":386,\"email\":\"rdemschkeap@webnode.com\",\"fico\":641,\"first_name\":\"Rhianna\",\"gender\":\"Female\",\"income\":434414,\"last_name\":\"Demschke\",\"years_active\":11},{\"customer_id\":188,\"email\":\"bwhitley57@cbsnews.com\",\"fico\":683,\"first_name\":\"Bellina\",\"gender\":\"Female\",\"income\":427043,\"last_name\":\"Whitley\",\"years_active\":3},{\"customer_id\":62,\"email\":\"jchadd1p@adobe.com\",\"fico\":684,\"first_name\":\"Joleen\",\"gender\":\"Female\",\"income\":161541,\"last_name\":\"Chadd\",\"years_active\":17},{\"customer_id\":41,\"email\":\"wbleddon14@yellowpages.com\",\"fico\":842,\"first_name\":\"Willie\",\"gender\":\"Female\",\"income\":401028,\"last_name\":\"Bleddon\",\"years_active\":5},{\"customer_id\":465,\"email\":\"gthomlinsoncw@about.com\",\"fico\":650,\"first_name\":\"Griffith\",\"gender\":\"Male\",\"income\":240613,\"last_name\":\"Thomlinson\",\"years_active\":34},{\"customer_id\":932,\"email\":\"kgrabbampv@ft.com\",\"fico\":793,\"first_name\":\"Kev\",\"gender\":\"Male\",\"income\":442943,\"last_name\":\"Grabbam\",\"years_active\":43},{\"customer_id\":832,\"email\":\"lskucen3@about.me\",\"fico\":450,\"first_name\":\"Libbie\",\"gender\":\"Female\",\"income\":414333,\"last_name\":\"Skuce\",\"years_active\":37},{\"customer_id\":819,\"email\":\"dstallworthmq@qq.com\",\"fico\":705,\"first_name\":\"Derward\",\"gender\":\"Male\",\"income\":150254,\"last_name\":\"Stallworth\",\"years_active\":41},{\"customer_id\":103,\"email\":\"rhellmer2u@cbsnews.com\",\"fico\":513,\"first_name\":\"Russ\",\"gender\":\"Male\",\"income\":437338,\"last_name\":\"Hellmer\",\"years_active\":28},{\"customer_id\":377,\"email\":\"nmccartag@domainmarket.com\",\"fico\":680,\"first_name\":\"Nicholle\",\"gender\":\"Female\",\"income\":106811,\"last_name\":\"McCart\",\"years_active\":29},{\"customer_id\":216,\"email\":\"gdawson5z@ted.com\",\"fico\":885,\"first_name\":\"Gwen\",\"gender\":\"Female\",\"income\":235140,\"last_name\":\"Dawson\",\"years_active\":1},{\"customer_id\":958,\"email\":\"amacdermottql@github.io\",\"fico\":715,\"first_name\":\"Anthea\",\"gender\":\"Female\",\"income\":248104,\"last_name\":\"MacDermott\",\"years_active\":3},{\"customer_id\":39,\"email\":\"gmendes12@spotify.com\",\"fico\":501,\"first_name\":\"Gates\",\"gender\":\"Female\",\"income\":94187,\"last_name\":\"Mendes\",\"years_active\":32},{\"customer_id\":699,\"email\":\"placerje@discovery.com\",\"fico\":630,\"first_name\":\"Parsifal\",\"gender\":\"Male\",\"income\":168013,\"last_name\":\"Lacer\",\"years_active\":18},{\"customer_id\":557,\"email\":\"abrumhamfg@huffingtonpost.com\",\"fico\":450,\"first_name\":\"Alan\",\"gender\":\"Male\",\"income\":165570,\"last_name\":\"Brumham\",\"years_active\":25},{\"customer_id\":195,\"email\":\"chobell5e@mapquest.com\",\"fico\":656,\"first_name\":\"Celle\",\"gender\":\"Female\",\"income\":158933,\"last_name\":\"Hobell\",\"years_active\":3},{\"customer_id\":966,\"email\":\"acarbettqt@list-manage.com\",\"fico\":694,\"first_name\":\"Anabella\",\"gender\":\"Female\",\"income\":179331,\"last_name\":\"Carbett\",\"years_active\":9},{\"customer_id\":382,\"email\":\"tdeaconsonal@wordpress.org\",\"fico\":446,\"first_name\":\"Tracee\",\"gender\":\"Female\",\"income\":358295,\"last_name\":\"Deaconson\",\"years_active\":35},{\"customer_id\":796,\"email\":\"cvanesm3@clickbank.net\",\"fico\":802,\"first_name\":\"Conn\",\"gender\":\"Male\",\"income\":322834,\"last_name\":\"Vanes\",\"years_active\":13},{\"customer_id\":223,\"email\":\"lnorcutt66@theglobeandmail.com\",\"fico\":505,\"first_name\":\"Livia\",\"gender\":\"Female\",\"income\":312518,\"last_name\":\"Norcutt\",\"years_active\":34},{\"customer_id\":58,\"email\":\"ahornung1l@census.gov\",\"fico\":482,\"first_name\":\"Aurilia\",\"gender\":\"Female\",\"income\":137743,\"last_name\":\"Hornung\",\"years_active\":3},{\"customer_id\":232,\"email\":\"gkornes6f@skyrock.com\",\"fico\":853,\"first_name\":\"Gorden\",\"gender\":\"Male\",\"income\":205095,\"last_name\":\"Kornes\",\"years_active\":14},{\"customer_id\":486,\"email\":\"dchitteydh@globo.com\",\"fico\":501,\"first_name\":\"Delinda\",\"gender\":\"Female\",\"income\":76898,\"last_name\":\"Chittey\",\"years_active\":18},{\"customer_id\":462,\"email\":\"dchurchillct@zdnet.com\",\"fico\":506,\"first_name\":\"Dalton\",\"gender\":\"Male\",\"income\":190931,\"last_name\":\"Churchill\",\"years_active\":15},{\"customer_id\":441,\"email\":\"ecourtinc8@parallels.com\",\"fico\":706,\"first_name\":\"Em\",\"gender\":\"Female\",\"income\":383650,\"last_name\":\"Courtin\",\"years_active\":37},{\"customer_id\":731,\"email\":\"afieldska@imdb.com\",\"fico\":708,\"first_name\":\"Annetta\",\"gender\":\"Female\",\"income\":72063,\"last_name\":\"Fields\",\"years_active\":8},{\"customer_id\":388,\"email\":\"gsteddallar@google.com.au\",\"fico\":794,\"first_name\":\"Gates\",\"gender\":\"Female\",\"income\":212122,\"last_name\":\"Steddall\",\"years_active\":29},{\"customer_id\":395,\"email\":\"egaltoneay@fastcompany.com\",\"fico\":744,\"first_name\":\"Ellerey\",\"gender\":\"Male\",\"income\":302819,\"last_name\":\"Galtone\",\"years_active\":40},{\"customer_id\":606,\"email\":\"bburletongt@washington.edu\",\"fico\":523,\"first_name\":\"Bastien\",\"gender\":\"Male\",\"income\":306724,\"last_name\":\"Burleton\",\"years_active\":36},{\"customer_id\":307,\"email\":\"afish8i@stumbleupon.com\",\"fico\":742,\"first_name\":\"Alfi\",\"gender\":\"Female\",\"income\":115555,\"last_name\":\"Fish\",\"years_active\":31},{\"customer_id\":137,\"email\":\"aneilands3s@wordpress.com\",\"fico\":755,\"first_name\":\"Amaleta\",\"gender\":\"Female\",\"income\":417631,\"last_name\":\"Neilands\",\"years_active\":11},{\"customer_id\":56,\"email\":\"mskyram1j@sciencedaily.com\",\"fico\":871,\"first_name\":\"Maiga\",\"gender\":\"Female\",\"income\":451031,\"last_name\":\"Skyram\",\"years_active\":33},{\"customer_id\":719,\"email\":\"bcrasswelljy@php.net\",\"fico\":615,\"first_name\":\"Barbra\",\"gender\":\"Female\",\"income\":208742,\"last_name\":\"Crasswell\",\"years_active\":20},{\"customer_id\":104,\"email\":\"ahinchshaw2v@state.tx.us\",\"fico\":476,\"first_name\":\"Anestassia\",\"gender\":\"Female\",\"income\":204589,\"last_name\":\"Hinchshaw\",\"years_active\":16},{\"customer_id\":493,\"email\":\"jforlongedo@usatoday.com\",\"fico\":827,\"first_name\":\"Joan\",\"gender\":\"Female\",\"income\":365601,\"last_name\":\"Forlonge\",\"years_active\":42},{\"customer_id\":114,\"email\":\"jpelchat35@exblog.jp\",\"fico\":447,\"first_name\":\"Jeddy\",\"gender\":\"Male\",\"income\":97390,\"last_name\":\"Pelchat\",\"years_active\":26},{\"customer_id\":392,\"email\":\"jfilippyevav@pinterest.com\",\"fico\":741,\"first_name\":\"Jermayne\",\"gender\":\"Male\",\"income\":211833,\"last_name\":\"Filippyev\",\"years_active\":25},{\"customer_id\":343,\"email\":\"pkadwallider9i@toplist.cz\",\"fico\":889,\"first_name\":\"Pepillo\",\"gender\":\"Male\",\"income\":323547,\"last_name\":\"Kadwallider\",\"years_active\":27},{\"customer_id\":640,\"email\":\"sjolleyhr@netvibes.com\",\"fico\":789,\"first_name\":\"Smith\",\"gender\":\"Male\",\"income\":442136,\"last_name\":\"Jolley\",\"years_active\":24},{\"customer_id\":102,\"email\":\"dpeckitt2t@symantec.com\",\"fico\":505,\"first_name\":\"David\",\"gender\":\"Male\",\"income\":267979,\"last_name\":\"Peckitt\",\"years_active\":22},{\"customer_id\":268,\"email\":\"elusted7f@paginegialle.it\",\"fico\":828,\"first_name\":\"Emmott\",\"gender\":\"Male\",\"income\":109105,\"last_name\":\"Lusted\",\"years_active\":34},{\"customer_id\":294,\"email\":\"ksteers85@yahoo.com\",\"fico\":839,\"first_name\":\"Kellsie\",\"gender\":\"Female\",\"income\":432978,\"last_name\":\"Steers\",\"years_active\":24},{\"customer_id\":169,\"email\":\"rmiall4o@wikipedia.org\",\"fico\":526,\"first_name\":\"Ricoriki\",\"gender\":\"Male\",\"income\":240458,\"last_name\":\"Miall\",\"years_active\":43},{\"customer_id\":57,\"email\":\"ktuminelli1k@wufoo.com\",\"fico\":578,\"first_name\":\"Karalee\",\"gender\":\"Female\",\"income\":102314,\"last_name\":\"Tuminelli\",\"years_active\":25},{\"customer_id\":35,\"email\":\"wrigdeny@simplemachines.org\",\"fico\":609,\"first_name\":\"Willie\",\"gender\":\"Male\",\"income\":348820,\"last_name\":\"Rigden\",\"years_active\":12},{\"customer_id\":956,\"email\":\"cdenormanvilleqj@jimdo.com\",\"fico\":619,\"first_name\":\"Chico\",\"gender\":\"Male\",\"income\":108575,\"last_name\":\"De Normanville\",\"years_active\":36},{\"customer_id\":49,\"email\":\"wshawcross1c@miitbeian.gov.cn\",\"fico\":468,\"first_name\":\"Winifred\",\"gender\":\"Female\",\"income\":219323,\"last_name\":\"Shawcross\",\"years_active\":2},{\"customer_id\":752,\"email\":\"kchungkv@europa.eu\",\"fico\":755,\"first_name\":\"Konstantin\",\"gender\":\"Male\",\"income\":154355,\"last_name\":\"Chung\",\"years_active\":39},{\"customer_id\":522,\"email\":\"doldmeadoweh@tamu.edu\",\"fico\":868,\"first_name\":\"Didi\",\"gender\":\"Female\",\"income\":83238,\"last_name\":\"Oldmeadow\",\"years_active\":10},{\"customer_id\":845,\"email\":\"eranscombng@ucla.edu\",\"fico\":814,\"first_name\":\"Elisabet\",\"gender\":\"Female\",\"income\":305152,\"last_name\":\"Ranscomb\",\"years_active\":30},{\"customer_id\":980,\"email\":\"kchasemorer7@accuweather.com\",\"fico\":859,\"first_name\":\"Kali\",\"gender\":\"Female\",\"income\":274697,\"last_name\":\"Chasemore\",\"years_active\":1},{\"customer_id\":204,\"email\":\"lgainforth5n@qq.com\",\"fico\":544,\"first_name\":\"Lily\",\"gender\":\"Female\",\"income\":268598,\"last_name\":\"Gainforth\",\"years_active\":44},{\"customer_id\":581,\"email\":\"rmcanenyg4@msu.edu\",\"fico\":813,\"first_name\":\"Rea\",\"gender\":\"Female\",\"income\":369682,\"last_name\":\"McAneny\",\"years_active\":34},{\"customer_id\":886,\"email\":\"hfullickol@nps.gov\",\"fico\":846,\"first_name\":\"Hadleigh\",\"gender\":\"Male\",\"income\":219324,\"last_name\":\"Fullick\",\"years_active\":43},{\"customer_id\":694,\"email\":\"lfreckinghamj9@nydailynews.com\",\"fico\":472,\"first_name\":\"Lindsay\",\"gender\":\"Male\",\"income\":121780,\"last_name\":\"Freckingham\",\"years_active\":20},{\"customer_id\":229,\"email\":\"hsygroves6c@chicagotribune.com\",\"fico\":702,\"first_name\":\"Hattie\",\"gender\":\"Female\",\"income\":254510,\"last_name\":\"Sygroves\",\"years_active\":14},{\"customer_id\":753,\"email\":\"wbeatsonkw@europa.eu\",\"fico\":660,\"first_name\":\"Werner\",\"gender\":\"Male\",\"income\":249245,\"last_name\":\"Beatson\",\"years_active\":2},{\"customer_id\":190,\"email\":\"fivons59@symantec.com\",\"fico\":554,\"first_name\":\"Frederica\",\"gender\":\"Female\",\"income\":436162,\"last_name\":\"Ivons\",\"years_active\":10},{\"customer_id\":206,\"email\":\"bmcneely5p@huffingtonpost.com\",\"fico\":675,\"first_name\":\"Brandtr\",\"gender\":\"Male\",\"income\":414909,\"last_name\":\"McNeely\",\"years_active\":29}]},\"fields\":[{\"name\":\"customer_id\",\"type\":\"int\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"},{\"name\":\"email\",\"type\":\"string\"},{\"name\":\"gender\",\"type\":\"string\"},{\"name\":\"income\",\"type\":\"int\"},{\"name\":\"fico\",\"type\":\"int\"},{\"name\":\"years_active\",\"type\":\"int\"}],\"name\":\"insurance.InsuranceCustomer\",\"type\":\"record\"}" +} + +func (r InsuranceCustomer) SchemaName() string { + return "insurance.InsuranceCustomer" +} + +func (_ InsuranceCustomer) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetInt(v int32) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetLong(v int64) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetFloat(v float32) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetDouble(v float64) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetString(v string) { panic("Unsupported operation") } +func (_ InsuranceCustomer) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *InsuranceCustomer) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Customer_id} + + return w + + case 1: + w := types.String{Target: &r.First_name} + + return w + + case 2: + w := types.String{Target: &r.Last_name} + + return w + + case 3: + w := types.String{Target: &r.Email} + + return w + + case 4: + w := types.String{Target: &r.Gender} + + return w + + case 5: + w := types.Int{Target: &r.Income} + + return w + + case 6: + w := types.Int{Target: &r.Fico} + + return w + + case 7: + w := types.Int{Target: &r.Years_active} + + return w + + } + panic("Unknown field index") +} + +func (r *InsuranceCustomer) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *InsuranceCustomer) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ InsuranceCustomer) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ InsuranceCustomer) AppendArray() types.Field { panic("Unsupported operation") } +func (_ InsuranceCustomer) HintSize(int) { panic("Unsupported operation") } +func (_ InsuranceCustomer) Finalize() {} + +func (_ InsuranceCustomer) AvroCRC64Fingerprint() []byte { + return []byte(InsuranceCustomerAvroCRC64Fingerprint) +} + +func (r InsuranceCustomer) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["customer_id"], err = json.Marshal(r.Customer_id) + if err != nil { + return nil, err + } + output["first_name"], err = json.Marshal(r.First_name) + if err != nil { + return nil, err + } + output["last_name"], err = json.Marshal(r.Last_name) + if err != nil { + return nil, err + } + output["email"], err = json.Marshal(r.Email) + if err != nil { + return nil, err + } + output["gender"], err = json.Marshal(r.Gender) + if err != nil { + return nil, err + } + output["income"], err = json.Marshal(r.Income) + if err != nil { + return nil, err + } + output["fico"], err = json.Marshal(r.Fico) + if err != nil { + return nil, err + } + output["years_active"], err = json.Marshal(r.Years_active) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *InsuranceCustomer) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["customer_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Customer_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for customer_id") + } + val = func() json.RawMessage { + if v, ok := fields["first_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.First_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for first_name") + } + val = func() json.RawMessage { + if v, ok := fields["last_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Last_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for last_name") + } + val = func() json.RawMessage { + if v, ok := fields["email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for email") + } + val = func() json.RawMessage { + if v, ok := fields["gender"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Gender); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for gender") + } + val = func() json.RawMessage { + if v, ok := fields["income"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Income); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for income") + } + val = func() json.RawMessage { + if v, ok := fields["fico"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Fico); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for fico") + } + val = func() json.RawMessage { + if v, ok := fields["years_active"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Years_active); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for years_active") + } + return nil +} diff --git a/pkg/types/insurance_customer_activity.go b/pkg/types/insurance_customer_activity.go new file mode 100644 index 00000000..fb8d3ed9 --- /dev/null +++ b/pkg/types/insurance_customer_activity.go @@ -0,0 +1,306 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type InsuranceCustomerActivity struct { + Activity_id int32 `json:"activity_id"` + + Customer_id int32 `json:"customer_id"` + + Activity_type string `json:"activity_type"` + + Propensity_to_churn float64 `json:"propensity_to_churn"` + + Ip_address string `json:"ip_address"` +} + +const InsuranceCustomerActivityAvroCRC64Fingerprint = "\xd2\xe8Vu\x9a\xbe{\xe9" + +func NewInsuranceCustomerActivity() InsuranceCustomerActivity { + r := InsuranceCustomerActivity{} + return r +} + +func DeserializeInsuranceCustomerActivity(r io.Reader) (InsuranceCustomerActivity, error) { + t := NewInsuranceCustomerActivity() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeInsuranceCustomerActivityFromSchema(r io.Reader, schema string) (InsuranceCustomerActivity, error) { + t := NewInsuranceCustomerActivity() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeInsuranceCustomerActivity(r InsuranceCustomerActivity, w io.Writer) error { + var err error + err = vm.WriteInt(r.Activity_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Customer_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Activity_type, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Propensity_to_churn, w) + if err != nil { + return err + } + err = vm.WriteString(r.Ip_address, w) + if err != nil { + return err + } + return err +} + +func (r InsuranceCustomerActivity) Serialize(w io.Writer) error { + return writeInsuranceCustomerActivity(r, w) +} + +func (r InsuranceCustomerActivity) Schema() string { + return "{\"fields\":[{\"name\":\"activity_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1,\"step\":1}},\"type\":\"int\"}},{\"name\":\"customer_id\",\"type\":{\"arg.properties\":{\"options\":[415,871,597,210,833,371,387,313,882,854,895,198,468,860,383,226,630,546,949,276,595,406,565,129,973,10,579,167,273,548,175,957,45,582,66,472,578,825,572,322,864,272,910,507,942,368,643,421,92,433,75,305,173,863,315,344,526,264,225,40,866,473,662,611,401,993,158,997,43,36,843,814,965,967,470,55,615,30,894,333,763,929,994,771,601,634,955,310,463,887,770,386,188,62,41,465,932,832,819,103,377,216,958,39,699,557,195,966,382,796,223,58,232,486,462,441,731,388,395,606,307,137,56,719,104,493,114,392,343,640,102,268,294,169,57,35,956,49,752,522,845,980,204,581,886,694,229,753,190,206]},\"type\":\"int\"}},{\"name\":\"activity_type\",\"type\":{\"arg.properties\":{\"options\":[\"web_open\",\"mobile_open\",\"new_account\"]},\"type\":\"string\"}},{\"name\":\"propensity_to_churn\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1,\"min\":0.01}},\"type\":\"double\"}},{\"name\":\"ip_address\",\"type\":{\"arg.properties\":{\"options\":[\"223.135.0.204\",\"36.149.179.191\",\"60.194.249.18\",\"136.186.114.150\",\"74.124.70.237\",\"69.212.203.214\",\"70.1.63.102\",\"37.130.125.130\",\"193.33.103.229\",\"32.61.200.245\",\"51.196.238.21\",\"111.187.166.26\",\"217.237.199.242\",\"202.194.220.196\",\"205.196.213.241\",\"137.209.182.50\",\"198.43.175.27\",\"124.166.107.190\",\"192.61.188.203\",\"57.125.102.149\",\"74.163.164.66\",\"67.66.179.220\",\"201.63.8.144\",\"50.57.65.143\",\"135.146.254.138\",\"225.103.12.27\",\"147.187.228.215\",\"94.87.184.82\",\"88.145.28.140\",\"208.216.1.101\",\"175.36.181.120\",\"194.7.156.81\",\"30.209.200.179\",\"72.112.128.155\",\"77.82.56.87\",\"76.241.80.115\",\"177.13.65.63\",\"92.160.162.102\",\"216.212.0.222\",\"76.119.252.185\",\"134.186.192.26\",\"85.228.219.76\",\"195.82.242.168\",\"109.187.240.70\",\"125.191.141.103\",\"176.58.219.253\",\"98.53.186.67\",\"21.127.2.182\",\"58.73.132.227\",\"251.119.237.69\"]},\"type\":\"string\"}}],\"name\":\"insurance.InsuranceCustomerActivity\",\"type\":\"record\"}" +} + +func (r InsuranceCustomerActivity) SchemaName() string { + return "insurance.InsuranceCustomerActivity" +} + +func (_ InsuranceCustomerActivity) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetInt(v int32) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetLong(v int64) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetFloat(v float32) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetDouble(v float64) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetString(v string) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *InsuranceCustomerActivity) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Activity_id} + + return w + + case 1: + w := types.Int{Target: &r.Customer_id} + + return w + + case 2: + w := types.String{Target: &r.Activity_type} + + return w + + case 3: + w := types.Double{Target: &r.Propensity_to_churn} + + return w + + case 4: + w := types.String{Target: &r.Ip_address} + + return w + + } + panic("Unknown field index") +} + +func (r *InsuranceCustomerActivity) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *InsuranceCustomerActivity) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ InsuranceCustomerActivity) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) AppendArray() types.Field { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) HintSize(int) { panic("Unsupported operation") } +func (_ InsuranceCustomerActivity) Finalize() {} + +func (_ InsuranceCustomerActivity) AvroCRC64Fingerprint() []byte { + return []byte(InsuranceCustomerActivityAvroCRC64Fingerprint) +} + +func (r InsuranceCustomerActivity) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["activity_id"], err = json.Marshal(r.Activity_id) + if err != nil { + return nil, err + } + output["customer_id"], err = json.Marshal(r.Customer_id) + if err != nil { + return nil, err + } + output["activity_type"], err = json.Marshal(r.Activity_type) + if err != nil { + return nil, err + } + output["propensity_to_churn"], err = json.Marshal(r.Propensity_to_churn) + if err != nil { + return nil, err + } + output["ip_address"], err = json.Marshal(r.Ip_address) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *InsuranceCustomerActivity) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["activity_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Activity_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for activity_id") + } + val = func() json.RawMessage { + if v, ok := fields["customer_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Customer_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for customer_id") + } + val = func() json.RawMessage { + if v, ok := fields["activity_type"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Activity_type); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for activity_type") + } + val = func() json.RawMessage { + if v, ok := fields["propensity_to_churn"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Propensity_to_churn); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for propensity_to_churn") + } + val = func() json.RawMessage { + if v, ok := fields["ip_address"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip_address); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip_address") + } + return nil +} diff --git a/pkg/types/insurance_offer.go b/pkg/types/insurance_offer.go new file mode 100644 index 00000000..a3aaaeb8 --- /dev/null +++ b/pkg/types/insurance_offer.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type InsuranceOffer struct { + Offer_id int32 `json:"offer_id"` + + Offer_name string `json:"offer_name"` + + Offer_url string `json:"offer_url"` +} + +const InsuranceOfferAvroCRC64Fingerprint = "\x8d\"\x06%Sq\xda\xc4" + +func NewInsuranceOffer() InsuranceOffer { + r := InsuranceOffer{} + return r +} + +func DeserializeInsuranceOffer(r io.Reader) (InsuranceOffer, error) { + t := NewInsuranceOffer() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeInsuranceOfferFromSchema(r io.Reader, schema string) (InsuranceOffer, error) { + t := NewInsuranceOffer() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeInsuranceOffer(r InsuranceOffer, w io.Writer) error { + var err error + err = vm.WriteInt(r.Offer_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Offer_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Offer_url, w) + if err != nil { + return err + } + return err +} + +func (r InsuranceOffer) Serialize(w io.Writer) error { + return writeInsuranceOffer(r, w) +} + +func (r InsuranceOffer) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"offer_id\":1,\"offer_name\":\"new_home_policy\",\"offer_url\":\"http://privacy.gov.au/in/faucibus/orci/luctus.js\"},{\"offer_id\":2,\"offer_name\":\"new_auto_policy\",\"offer_url\":\"https://reddit.com/id.html\"},{\"offer_id\":3,\"offer_name\":\"discount_existing\",\"offer_url\":\"https://cbc.ca/dui/proin/leo/odio/porttitor/id.aspx\"},{\"offer_id\":4,\"offer_name\":\"safe_driver_program\",\"offer_url\":\"http://seattletimes.com/ante/vel/ipsum/praesent.json\"},{\"offer_id\":5,\"offer_name\":\"no_offer\",\"offer_url\":\"https://sciencedaily.com/ante.aspx\"}]},\"fields\":[{\"name\":\"offer_id\",\"type\":\"int\"},{\"name\":\"offer_name\",\"type\":\"string\"},{\"name\":\"offer_url\",\"type\":\"string\"}],\"name\":\"insurance.InsuranceOffer\",\"type\":\"record\"}" +} + +func (r InsuranceOffer) SchemaName() string { + return "insurance.InsuranceOffer" +} + +func (_ InsuranceOffer) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetInt(v int32) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetLong(v int64) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetFloat(v float32) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetDouble(v float64) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetString(v string) { panic("Unsupported operation") } +func (_ InsuranceOffer) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *InsuranceOffer) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Offer_id} + + return w + + case 1: + w := types.String{Target: &r.Offer_name} + + return w + + case 2: + w := types.String{Target: &r.Offer_url} + + return w + + } + panic("Unknown field index") +} + +func (r *InsuranceOffer) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *InsuranceOffer) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ InsuranceOffer) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ InsuranceOffer) AppendArray() types.Field { panic("Unsupported operation") } +func (_ InsuranceOffer) HintSize(int) { panic("Unsupported operation") } +func (_ InsuranceOffer) Finalize() {} + +func (_ InsuranceOffer) AvroCRC64Fingerprint() []byte { + return []byte(InsuranceOfferAvroCRC64Fingerprint) +} + +func (r InsuranceOffer) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["offer_id"], err = json.Marshal(r.Offer_id) + if err != nil { + return nil, err + } + output["offer_name"], err = json.Marshal(r.Offer_name) + if err != nil { + return nil, err + } + output["offer_url"], err = json.Marshal(r.Offer_url) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *InsuranceOffer) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["offer_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Offer_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for offer_id") + } + val = func() json.RawMessage { + if v, ok := fields["offer_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Offer_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for offer_name") + } + val = func() json.RawMessage { + if v, ok := fields["offer_url"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Offer_url); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for offer_url") + } + return nil +} diff --git a/pkg/types/inventorymgmt_inventory.go b/pkg/types/inventorymgmt_inventory.go new file mode 100644 index 00000000..858847b0 --- /dev/null +++ b/pkg/types/inventorymgmt_inventory.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type InventorymgmtInventory struct { + Id int64 `json:"id"` + + Quantity int64 `json:"quantity"` + + Productid int64 `json:"productid"` +} + +const InventorymgmtInventoryAvroCRC64Fingerprint = "\xec:1\xff\x80\xa7̜" + +func NewInventorymgmtInventory() InventorymgmtInventory { + r := InventorymgmtInventory{} + return r +} + +func DeserializeInventorymgmtInventory(r io.Reader) (InventorymgmtInventory, error) { + t := NewInventorymgmtInventory() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeInventorymgmtInventoryFromSchema(r io.Reader, schema string) (InventorymgmtInventory, error) { + t := NewInventorymgmtInventory() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeInventorymgmtInventory(r InventorymgmtInventory, w io.Writer) error { + var err error + err = vm.WriteLong(r.Id, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Quantity, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Productid, w) + if err != nil { + return err + } + return err +} + +func (r InventorymgmtInventory) Serialize(w io.Writer) error { + return writeInventorymgmtInventory(r, w) +} + +func (r InventorymgmtInventory) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}},{\"name\":\"quantity\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}},{\"name\":\"productid\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}}],\"name\":\"inventorymgmt.InventorymgmtInventory\",\"type\":\"record\"}" +} + +func (r InventorymgmtInventory) SchemaName() string { + return "inventorymgmt.InventorymgmtInventory" +} + +func (_ InventorymgmtInventory) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetInt(v int32) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetLong(v int64) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetFloat(v float32) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetDouble(v float64) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetString(v string) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *InventorymgmtInventory) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Id} + + return w + + case 1: + w := types.Long{Target: &r.Quantity} + + return w + + case 2: + w := types.Long{Target: &r.Productid} + + return w + + } + panic("Unknown field index") +} + +func (r *InventorymgmtInventory) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *InventorymgmtInventory) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ InventorymgmtInventory) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ InventorymgmtInventory) AppendArray() types.Field { panic("Unsupported operation") } +func (_ InventorymgmtInventory) HintSize(int) { panic("Unsupported operation") } +func (_ InventorymgmtInventory) Finalize() {} + +func (_ InventorymgmtInventory) AvroCRC64Fingerprint() []byte { + return []byte(InventorymgmtInventoryAvroCRC64Fingerprint) +} + +func (r InventorymgmtInventory) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["quantity"], err = json.Marshal(r.Quantity) + if err != nil { + return nil, err + } + output["productid"], err = json.Marshal(r.Productid) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *InventorymgmtInventory) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["quantity"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Quantity); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for quantity") + } + val = func() json.RawMessage { + if v, ok := fields["productid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Productid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for productid") + } + return nil +} diff --git a/pkg/types/inventorymgmt_product.go b/pkg/types/inventorymgmt_product.go new file mode 100644 index 00000000..6f7190bd --- /dev/null +++ b/pkg/types/inventorymgmt_product.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type InventorymgmtProduct struct { + Id int64 `json:"id"` + + Name string `json:"name"` + + Description string `json:"description"` + + Price float64 `json:"price"` +} + +const InventorymgmtProductAvroCRC64Fingerprint = "\x1a@Ə+۸i" + +func NewInventorymgmtProduct() InventorymgmtProduct { + r := InventorymgmtProduct{} + return r +} + +func DeserializeInventorymgmtProduct(r io.Reader) (InventorymgmtProduct, error) { + t := NewInventorymgmtProduct() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeInventorymgmtProductFromSchema(r io.Reader, schema string) (InventorymgmtProduct, error) { + t := NewInventorymgmtProduct() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeInventorymgmtProduct(r InventorymgmtProduct, w io.Writer) error { + var err error + err = vm.WriteLong(r.Id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Description, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Price, w) + if err != nil { + return err + } + return err +} + +func (r InventorymgmtProduct) Serialize(w io.Writer) error { + return writeInventorymgmtProduct(r, w) +} + +func (r InventorymgmtProduct) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}},{\"name\":\"name\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"string\"}},{\"name\":\"description\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"string\"}},{\"name\":\"price\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"double\"}}],\"name\":\"product.InventorymgmtProduct\",\"type\":\"record\"}" +} + +func (r InventorymgmtProduct) SchemaName() string { + return "product.InventorymgmtProduct" +} + +func (_ InventorymgmtProduct) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetInt(v int32) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetLong(v int64) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetFloat(v float32) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetDouble(v float64) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetString(v string) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *InventorymgmtProduct) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Id} + + return w + + case 1: + w := types.String{Target: &r.Name} + + return w + + case 2: + w := types.String{Target: &r.Description} + + return w + + case 3: + w := types.Double{Target: &r.Price} + + return w + + } + panic("Unknown field index") +} + +func (r *InventorymgmtProduct) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *InventorymgmtProduct) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ InventorymgmtProduct) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ InventorymgmtProduct) AppendArray() types.Field { panic("Unsupported operation") } +func (_ InventorymgmtProduct) HintSize(int) { panic("Unsupported operation") } +func (_ InventorymgmtProduct) Finalize() {} + +func (_ InventorymgmtProduct) AvroCRC64Fingerprint() []byte { + return []byte(InventorymgmtProductAvroCRC64Fingerprint) +} + +func (r InventorymgmtProduct) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["description"], err = json.Marshal(r.Description) + if err != nil { + return nil, err + } + output["price"], err = json.Marshal(r.Price) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *InventorymgmtProduct) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["description"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Description); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for description") + } + val = func() json.RawMessage { + if v, ok := fields["price"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Price); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for price") + } + return nil +} diff --git a/pkg/types/iot_device_information.go b/pkg/types/iot_device_information.go new file mode 100644 index 00000000..caa421e1 --- /dev/null +++ b/pkg/types/iot_device_information.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type IotDeviceInformation struct { + Device_ip string `json:"device_ip"` + + Mac_address string `json:"mac_address"` + + Owner string `json:"owner"` +} + +const IotDeviceInformationAvroCRC64Fingerprint = "(w\xdc\x10`\x85]\xaf" + +func NewIotDeviceInformation() IotDeviceInformation { + r := IotDeviceInformation{} + return r +} + +func DeserializeIotDeviceInformation(r io.Reader) (IotDeviceInformation, error) { + t := NewIotDeviceInformation() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeIotDeviceInformationFromSchema(r io.Reader, schema string) (IotDeviceInformation, error) { + t := NewIotDeviceInformation() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeIotDeviceInformation(r IotDeviceInformation, w io.Writer) error { + var err error + err = vm.WriteString(r.Device_ip, w) + if err != nil { + return err + } + err = vm.WriteString(r.Mac_address, w) + if err != nil { + return err + } + err = vm.WriteString(r.Owner, w) + if err != nil { + return err + } + return err +} + +func (r IotDeviceInformation) Serialize(w io.Writer) error { + return writeIotDeviceInformation(r, w) +} + +func (r IotDeviceInformation) Schema() string { + return "{\"fields\":[{\"name\":\"device_ip\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"mac_address\",\"type\":{\"arg.properties\":{\"options\":[\"20-FC-45-56-D4-11\",\"DA-C5-32-E2-C1-8F\",\"52-FF-47-B2-4E-40\",\"10-7A-3D-D0-55-5E\",\"E1-36-4F-CC-07-D1\",\"B9-4B-F7-9A-BC-FB\",\"E4-26-F7-10-AF-55\",\"8A-C1-65-E1-96-26\",\"F8-E2-9D-20-DA-2B\",\"4F-B2-2D-63-35-D0\",\"0D-21-E6-36-2A-48\",\"2F-CE-2C-ED-A9-79\",\"2D-D0-DC-2D-68-E2\",\"6A-76-E5-12-BF-6F\",\"02-B6-B9-02-EF-1B\",\"16-61-3F-30-95-06\",\"08-FC-5B-DC-D7-EC\",\"0E-F9-E7-CD-23-E9\",\"41-E2-09-EE-07-85\",\"20-65-79-65-EA-E7\",\"8D-64-BD-87-DF-CF\",\"36-29-79-FD-02-34\",\"10-4A-A2-70-D3-9A\",\"71-66-76-88-10-E4\",\"38-FF-33-73-5B-11\",\"C6-E7-CA-9B-69-5C\",\"97-E3-BA-B2-47-77\",\"C0-1B-23-A1-96-24\",\"89-76-CC-72-C8-55\",\"78-26-55-A7-66-87\",\"D8-AA-BE-B3-B6-CC\",\"AF-3C-AA-F8-EF-E7\",\"2E-50-8F-9A-F0-B5\",\"D2-0B-7F-EC-A6-03\",\"7A-2E-17-17-D3-D1\",\"AD-9F-95-8C-D7-DB\",\"53-BE-22-01-C7-A6\",\"95-E4-54-28-7B-F9\",\"6F-5E-64-19-86-86\",\"50-10-5B-90-B1-95\",\"DD-BB-53-78-7F-A7\",\"6D-F7-05-28-48-8E\",\"84-50-36-FC-40-0F\",\"11-B4-74-C3-22-08\",\"24-BF-FE-8B-F9-D3\",\"3A-5C-C1-1A-03-0B\",\"44-CA-1C-94-1D-2A\",\"2E-7B-53-47-76-25\",\"6F-B9-B9-9B-08-05\",\"29-85-80-9B-4C-4A\"]},\"type\":\"string\"}},{\"name\":\"owner\",\"type\":{\"arg.properties\":{\"options\":[\"Frieda Baldi\",\"Cherrita Gallaccio\",\"Matt Cleugh\",\"Dulciana Murfill\",\"Germayne Streetley\",\"Brenna Woolfall\",\"Gerhardt Tenbrug\",\"Hayley Tuma\",\"Winny Cadigan\",\"Bonnibelle Macek\",\"Lionel Byneth\",\"Trev Roper\",\"Lena MacFadzean\",\"Benton Allcorn\",\"Avis Moyler\",\"Marchall Rochewell\",\"Adele Bohl\",\"Barnett Mcall\",\"Frieda Pirrone\",\"Pattin Eringey\",\"Kalila Fewings\",\"Giacobo Beuscher\",\"Rozalin Hair\",\"Egon Beagan\",\"Owen Strotton\",\"Fernando Rosensaft\",\"Carleton Gwyther\",\"Kata Coll\",\"Rossie Hobben\",\"Stephanie Gookey\",\"Robyn Milazzo\",\"Tilda O'Lunney\",\"Nolan Kidney\",\"Jori Ottiwill\",\"Benito Graveson\",\"Zechariah Wrate\",\"Chelsae Napton\",\"Jeremy Heffernon\",\"Derk McAviy\",\"Constantin Mears\",\"Fitz Ballin\",\"Essy Bettles\",\"Gene Klemt\",\"Nikolai Arnopp\",\"Gustave Westhofer\",\"Simona Mayhow\",\"Cort Bainbridge\",\"Sibyl Vockins\",\"Andriette Gaze\",\"Shaughn De Simoni\",\"Nathaniel Hallowell\",\"Charley Dudill\",\"Cirstoforo Joblin\",\"Hyacinthia Kinastan\",\"Dur Lasselle\",\"Gay Chadburn\",\"Livvie Hawyes\",\"Aldrich MacVay\",\"Riva Rossant\",\"Johanna Reichartz\",\"Trent Gantlett\",\"Aryn Haskell\",\"Byrann Barock\",\"Gerda Cleugher\",\"Sonnie Guildford\",\"Vergil Borge\",\"Lurline Rocco\",\"Geoff Eddy\",\"Zea Leighton\",\"Leif Baden\",\"Quint Bidgod\",\"Talbot Cashell\",\"Sheridan Foulsham\",\"Camile Shrimplin\",\"Marcel Nayshe\",\"Lea Murrish\",\"Lucais Midson\",\"Zeb Rylatt\",\"Nertie Zuker\",\"Babara Henderson\",\"Electra Ridgley\",\"Jere Standingford\",\"Cyril Yellowlea\",\"Isadora Peegrem\",\"Caria Smewings\",\"Karena Kauffman\",\"Haywood Snowball\",\"Winslow Starcks\",\"Alis Ponton\",\"Marietta Lezemere\",\"Emilee Broadbridge\",\"Faye Beaument\",\"Shannah Beatson\",\"West Doy\",\"Chryste Wren\",\"Trumann Labba\",\"Anatollo Beckwith\",\"Konstanze Dunsford\",\"Raychel Roset\",\"Heindrick Ravenscroft\"]},\"type\":\"string\"}}],\"name\":\"iot.IotDeviceInformation\",\"type\":\"record\"}" +} + +func (r IotDeviceInformation) SchemaName() string { + return "iot.IotDeviceInformation" +} + +func (_ IotDeviceInformation) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetInt(v int32) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetLong(v int64) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetFloat(v float32) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetDouble(v float64) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetString(v string) { panic("Unsupported operation") } +func (_ IotDeviceInformation) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *IotDeviceInformation) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Device_ip} + + return w + + case 1: + w := types.String{Target: &r.Mac_address} + + return w + + case 2: + w := types.String{Target: &r.Owner} + + return w + + } + panic("Unknown field index") +} + +func (r *IotDeviceInformation) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *IotDeviceInformation) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ IotDeviceInformation) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ IotDeviceInformation) AppendArray() types.Field { panic("Unsupported operation") } +func (_ IotDeviceInformation) HintSize(int) { panic("Unsupported operation") } +func (_ IotDeviceInformation) Finalize() {} + +func (_ IotDeviceInformation) AvroCRC64Fingerprint() []byte { + return []byte(IotDeviceInformationAvroCRC64Fingerprint) +} + +func (r IotDeviceInformation) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["device_ip"], err = json.Marshal(r.Device_ip) + if err != nil { + return nil, err + } + output["mac_address"], err = json.Marshal(r.Mac_address) + if err != nil { + return nil, err + } + output["owner"], err = json.Marshal(r.Owner) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *IotDeviceInformation) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["device_ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Device_ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for device_ip") + } + val = func() json.RawMessage { + if v, ok := fields["mac_address"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Mac_address); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for mac_address") + } + val = func() json.RawMessage { + if v, ok := fields["owner"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Owner); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for owner") + } + return nil +} diff --git a/pkg/types/location.go b/pkg/types/location.go new file mode 100644 index 00000000..b9314646 --- /dev/null +++ b/pkg/types/location.go @@ -0,0 +1,219 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Location struct { + Latitude float64 `json:"latitude"` + + Longitude float64 `json:"longitude"` +} + +const LocationAvroCRC64Fingerprint = "\xd022#\x84S7\x05" + +func NewLocation() Location { + r := Location{} + return r +} + +func DeserializeLocation(r io.Reader) (Location, error) { + t := NewLocation() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeLocationFromSchema(r io.Reader, schema string) (Location, error) { + t := NewLocation() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeLocation(r Location, w io.Writer) error { + var err error + err = vm.WriteDouble(r.Latitude, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Longitude, w) + if err != nil { + return err + } + return err +} + +func (r Location) Serialize(w io.Writer) error { + return writeLocation(r, w) +} + +func (r Location) Schema() string { + return "{\"fields\":[{\"name\":\"latitude\",\"type\":\"double\"},{\"name\":\"longitude\",\"type\":\"double\"}],\"name\":\"fleetmgmt.location\",\"type\":\"record\"}" +} + +func (r Location) SchemaName() string { + return "fleetmgmt.location" +} + +func (_ Location) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Location) SetInt(v int32) { panic("Unsupported operation") } +func (_ Location) SetLong(v int64) { panic("Unsupported operation") } +func (_ Location) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Location) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Location) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Location) SetString(v string) { panic("Unsupported operation") } +func (_ Location) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Location) Get(i int) types.Field { + switch i { + case 0: + w := types.Double{Target: &r.Latitude} + + return w + + case 1: + w := types.Double{Target: &r.Longitude} + + return w + + } + panic("Unknown field index") +} + +func (r *Location) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Location) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Location) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Location) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Location) HintSize(int) { panic("Unsupported operation") } +func (_ Location) Finalize() {} + +func (_ Location) AvroCRC64Fingerprint() []byte { + return []byte(LocationAvroCRC64Fingerprint) +} + +func (r Location) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["latitude"], err = json.Marshal(r.Latitude) + if err != nil { + return nil, err + } + output["longitude"], err = json.Marshal(r.Longitude) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Location) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["latitude"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Latitude); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for latitude") + } + val = func() json.RawMessage { + if v, ok := fields["longitude"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Longitude); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for longitude") + } + return nil +} diff --git a/pkg/types/map_bool.go b/pkg/types/map_bool.go new file mode 100644 index 00000000..5a885381 --- /dev/null +++ b/pkg/types/map_bool.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapBool(r map[string]bool, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteBool(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapBoolWrapper struct { + Target *map[string]bool + keys []string + values []bool +} + +func (_ *MapBoolWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapBoolWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapBoolWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapBoolWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]bool, 0, s) + } +} + +func (r *MapBoolWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapBoolWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapBoolWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v bool + r.values = append(r.values, v) + return &types.Boolean{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapBoolWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/map_bytes.go b/pkg/types/map_bytes.go new file mode 100644 index 00000000..7affcd23 --- /dev/null +++ b/pkg/types/map_bytes.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapBytes(r map[string]Bytes, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteBytes(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapBytesWrapper struct { + Target *map[string]Bytes + keys []string + values []Bytes +} + +func (_ *MapBytesWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapBytesWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapBytesWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapBytesWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]Bytes, 0, s) + } +} + +func (r *MapBytesWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapBytesWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapBytesWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v Bytes + r.values = append(r.values, v) + return &BytesWrapper{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapBytesWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/map_float.go b/pkg/types/map_float.go new file mode 100644 index 00000000..96aaa588 --- /dev/null +++ b/pkg/types/map_float.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapFloat(r map[string]float32, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteFloat(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapFloatWrapper struct { + Target *map[string]float32 + keys []string + values []float32 +} + +func (_ *MapFloatWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapFloatWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapFloatWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapFloatWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]float32, 0, s) + } +} + +func (r *MapFloatWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapFloatWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapFloatWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v float32 + r.values = append(r.values, v) + return &types.Float{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapFloatWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/map_int.go b/pkg/types/map_int.go new file mode 100644 index 00000000..c557a698 --- /dev/null +++ b/pkg/types/map_int.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapInt(r map[string]int32, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteInt(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapIntWrapper struct { + Target *map[string]int32 + keys []string + values []int32 +} + +func (_ *MapIntWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapIntWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapIntWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapIntWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]int32, 0, s) + } +} + +func (r *MapIntWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapIntWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapIntWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v int32 + r.values = append(r.values, v) + return &types.Int{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapIntWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/map_long.go b/pkg/types/map_long.go new file mode 100644 index 00000000..43ea345c --- /dev/null +++ b/pkg/types/map_long.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapLong(r map[string]int64, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteLong(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapLongWrapper struct { + Target *map[string]int64 + keys []string + values []int64 +} + +func (_ *MapLongWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapLongWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapLongWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapLongWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]int64, 0, s) + } +} + +func (r *MapLongWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapLongWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapLongWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v int64 + r.values = append(r.values, v) + return &types.Long{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapLongWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/map_string.go b/pkg/types/map_string.go new file mode 100644 index 00000000..698c8489 --- /dev/null +++ b/pkg/types/map_string.go @@ -0,0 +1,115 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" + "io" +) + +func writeMapString(r map[string]string, w io.Writer) error { + err := vm.WriteLong(int64(len(r)), w) + if err != nil || len(r) == 0 { + return err + } + for k, e := range r { + err = vm.WriteString(k, w) + if err != nil { + return err + } + err = vm.WriteString(e, w) + if err != nil { + return err + } + } + return vm.WriteLong(0, w) +} + +type MapStringWrapper struct { + Target *map[string]string + keys []string + values []string +} + +func (_ *MapStringWrapper) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetInt(v int32) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetLong(v int64) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetFloat(v float32) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetDouble(v float64) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetString(v string) { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetUnionElem(v int64) { panic("Unsupported operation") } +func (_ *MapStringWrapper) Get(i int) types.Field { panic("Unsupported operation") } +func (_ *MapStringWrapper) SetDefault(i int) { panic("Unsupported operation") } + +func (r *MapStringWrapper) HintSize(s int) { + if r.keys == nil { + r.keys = make([]string, 0, s) + r.values = make([]string, 0, s) + } +} + +func (r *MapStringWrapper) NullField(_ int) { + panic("Unsupported operation") +} + +func (r *MapStringWrapper) Finalize() { + for i := range r.keys { + (*r.Target)[r.keys[i]] = r.values[i] + } +} + +func (r *MapStringWrapper) AppendMap(key string) types.Field { + r.keys = append(r.keys, key) + var v string + r.values = append(r.values, v) + return &types.String{Target: &r.values[len(r.values)-1]} +} + +func (_ *MapStringWrapper) AppendArray() types.Field { panic("Unsupported operation") } diff --git a/pkg/types/marketing_campaign_finance.go b/pkg/types/marketing_campaign_finance.go new file mode 100644 index 00000000..38f0fd2a --- /dev/null +++ b/pkg/types/marketing_campaign_finance.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type MarketingCampaignFinance struct { + Time int64 `json:"time"` + + Candidate_id string `json:"candidate_id"` + + Party_affiliation string `json:"party_affiliation"` + + Contribution int32 `json:"contribution"` +} + +const MarketingCampaignFinanceAvroCRC64Fingerprint = "d\x91d\xafv\xbc6\xe9" + +func NewMarketingCampaignFinance() MarketingCampaignFinance { + r := MarketingCampaignFinance{} + return r +} + +func DeserializeMarketingCampaignFinance(r io.Reader) (MarketingCampaignFinance, error) { + t := NewMarketingCampaignFinance() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeMarketingCampaignFinanceFromSchema(r io.Reader, schema string) (MarketingCampaignFinance, error) { + t := NewMarketingCampaignFinance() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeMarketingCampaignFinance(r MarketingCampaignFinance, w io.Writer) error { + var err error + err = vm.WriteLong(r.Time, w) + if err != nil { + return err + } + err = vm.WriteString(r.Candidate_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Party_affiliation, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Contribution, w) + if err != nil { + return err + } + return err +} + +func (r MarketingCampaignFinance) Serialize(w io.Writer) error { + return writeMarketingCampaignFinance(r, w) +} + +func (r MarketingCampaignFinance) Schema() string { + return "{\"fields\":[{\"name\":\"time\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1619273364600,\"min\":1587715775521}},\"type\":\"long\"}},{\"name\":\"candidate_id\",\"type\":{\"arg.properties\":{\"regex\":\"[A-Z][1-9]{8,8}\"},\"type\":\"string\"}},{\"name\":\"party_affiliation\",\"type\":{\"arg.properties\":{\"options\":[\"REP\",\"DEM\",\"IND\"]},\"type\":\"string\"}},{\"name\":\"contribution\",\"type\":{\"arg.properties\":{\"range\":{\"max\":3500,\"min\":20}},\"type\":\"int\"}}],\"name\":\"marketing.MarketingCampaignFinance\",\"type\":\"record\"}" +} + +func (r MarketingCampaignFinance) SchemaName() string { + return "marketing.MarketingCampaignFinance" +} + +func (_ MarketingCampaignFinance) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetInt(v int32) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetLong(v int64) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetFloat(v float32) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetDouble(v float64) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetString(v string) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *MarketingCampaignFinance) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Time} + + return w + + case 1: + w := types.String{Target: &r.Candidate_id} + + return w + + case 2: + w := types.String{Target: &r.Party_affiliation} + + return w + + case 3: + w := types.Int{Target: &r.Contribution} + + return w + + } + panic("Unknown field index") +} + +func (r *MarketingCampaignFinance) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *MarketingCampaignFinance) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ MarketingCampaignFinance) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) AppendArray() types.Field { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) HintSize(int) { panic("Unsupported operation") } +func (_ MarketingCampaignFinance) Finalize() {} + +func (_ MarketingCampaignFinance) AvroCRC64Fingerprint() []byte { + return []byte(MarketingCampaignFinanceAvroCRC64Fingerprint) +} + +func (r MarketingCampaignFinance) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["time"], err = json.Marshal(r.Time) + if err != nil { + return nil, err + } + output["candidate_id"], err = json.Marshal(r.Candidate_id) + if err != nil { + return nil, err + } + output["party_affiliation"], err = json.Marshal(r.Party_affiliation) + if err != nil { + return nil, err + } + output["contribution"], err = json.Marshal(r.Contribution) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *MarketingCampaignFinance) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["time"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Time); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for time") + } + val = func() json.RawMessage { + if v, ok := fields["candidate_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Candidate_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for candidate_id") + } + val = func() json.RawMessage { + if v, ok := fields["party_affiliation"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Party_affiliation); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for party_affiliation") + } + val = func() json.RawMessage { + if v, ok := fields["contribution"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Contribution); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for contribution") + } + return nil +} diff --git a/pkg/types/my_map_test_record.go b/pkg/types/my_map_test_record.go new file mode 100644 index 00000000..9e351462 --- /dev/null +++ b/pkg/types/my_map_test_record.go @@ -0,0 +1,413 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type MyMapTestRecord struct { + IntField map[string]int32 `json:"IntField"` + + LongField map[string]int64 `json:"LongField"` + + StringField map[string]string `json:"StringField"` + + FloatField map[string]float32 `json:"FloatField"` + + BoolField map[string]bool `json:"BoolField"` + + BytesField map[string]Bytes `json:"BytesField"` +} + +const MyMapTestRecordAvroCRC64Fingerprint = ",%\xe7\x99:\xa1\xef\xbb" + +func NewMyMapTestRecord() MyMapTestRecord { + r := MyMapTestRecord{} + r.IntField = make(map[string]int32) + + r.IntField["default"] = 1 + + r.LongField = make(map[string]int64) + + r.LongField["default"] = 2 + + r.StringField = make(map[string]string) + + r.StringField["default"] = "defaultstring" + + r.FloatField = make(map[string]float32) + + r.FloatField["default"] = 236 + + r.BoolField = make(map[string]bool) + + r.BoolField["default"] = true + + r.BytesField = make(map[string]Bytes) + + r.BytesField["default"] = []byte("\x03\x0f\xde") + + return r +} + +func DeserializeMyMapTestRecord(r io.Reader) (MyMapTestRecord, error) { + t := NewMyMapTestRecord() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeMyMapTestRecordFromSchema(r io.Reader, schema string) (MyMapTestRecord, error) { + t := NewMyMapTestRecord() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeMyMapTestRecord(r MyMapTestRecord, w io.Writer) error { + var err error + err = writeMapInt(r.IntField, w) + if err != nil { + return err + } + err = writeMapLong(r.LongField, w) + if err != nil { + return err + } + err = writeMapString(r.StringField, w) + if err != nil { + return err + } + err = writeMapFloat(r.FloatField, w) + if err != nil { + return err + } + err = writeMapBool(r.BoolField, w) + if err != nil { + return err + } + err = writeMapBytes(r.BytesField, w) + if err != nil { + return err + } + return err +} + +func (r MyMapTestRecord) Serialize(w io.Writer) error { + return writeMyMapTestRecord(r, w) +} + +func (r MyMapTestRecord) Schema() string { + return "{\"fields\":[{\"default\":{\"default\":1},\"name\":\"IntField\",\"type\":{\"type\":\"map\",\"values\":\"int\"}},{\"default\":{\"default\":2},\"name\":\"LongField\",\"type\":{\"type\":\"map\",\"values\":\"long\"}},{\"default\":{\"default\":\"defaultstring\"},\"name\":\"StringField\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"default\":{\"default\":236},\"name\":\"FloatField\",\"type\":{\"type\":\"map\",\"values\":\"float\"}},{\"default\":{\"default\":true},\"name\":\"BoolField\",\"type\":{\"type\":\"map\",\"values\":\"boolean\"}},{\"default\":{\"default\":\"\\u0003\\u000fÞ\"},\"name\":\"BytesField\",\"type\":{\"type\":\"map\",\"values\":\"bytes\"}}],\"name\":\"MyMapTestRecord\",\"type\":\"record\"}" +} + +func (r MyMapTestRecord) SchemaName() string { + return "MyMapTestRecord" +} + +func (_ MyMapTestRecord) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetInt(v int32) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetLong(v int64) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetFloat(v float32) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetDouble(v float64) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetString(v string) { panic("Unsupported operation") } +func (_ MyMapTestRecord) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *MyMapTestRecord) Get(i int) types.Field { + switch i { + case 0: + r.IntField = make(map[string]int32) + + w := MapIntWrapper{Target: &r.IntField} + + return &w + + case 1: + r.LongField = make(map[string]int64) + + w := MapLongWrapper{Target: &r.LongField} + + return &w + + case 2: + r.StringField = make(map[string]string) + + w := MapStringWrapper{Target: &r.StringField} + + return &w + + case 3: + r.FloatField = make(map[string]float32) + + w := MapFloatWrapper{Target: &r.FloatField} + + return &w + + case 4: + r.BoolField = make(map[string]bool) + + w := MapBoolWrapper{Target: &r.BoolField} + + return &w + + case 5: + r.BytesField = make(map[string]Bytes) + + w := MapBytesWrapper{Target: &r.BytesField} + + return &w + + } + panic("Unknown field index") +} + +func (r *MyMapTestRecord) SetDefault(i int) { + switch i { + case 0: + r.IntField["default"] = 1 + + return + case 1: + r.LongField["default"] = 2 + + return + case 2: + r.StringField["default"] = "defaultstring" + + return + case 3: + r.FloatField["default"] = 236 + + return + case 4: + r.BoolField["default"] = true + + return + case 5: + r.BytesField["default"] = []byte("\x03\x0f\xde") + + return + } + panic("Unknown field index") +} + +func (r *MyMapTestRecord) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ MyMapTestRecord) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ MyMapTestRecord) AppendArray() types.Field { panic("Unsupported operation") } +func (_ MyMapTestRecord) HintSize(int) { panic("Unsupported operation") } +func (_ MyMapTestRecord) Finalize() {} + +func (_ MyMapTestRecord) AvroCRC64Fingerprint() []byte { + return []byte(MyMapTestRecordAvroCRC64Fingerprint) +} + +func (r MyMapTestRecord) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["IntField"], err = json.Marshal(r.IntField) + if err != nil { + return nil, err + } + output["LongField"], err = json.Marshal(r.LongField) + if err != nil { + return nil, err + } + output["StringField"], err = json.Marshal(r.StringField) + if err != nil { + return nil, err + } + output["FloatField"], err = json.Marshal(r.FloatField) + if err != nil { + return nil, err + } + output["BoolField"], err = json.Marshal(r.BoolField) + if err != nil { + return nil, err + } + output["BytesField"], err = json.Marshal(r.BytesField) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *MyMapTestRecord) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["IntField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.IntField); err != nil { + return err + } + } else { + r.IntField = make(map[string]int32) + + r.IntField["default"] = 1 + + } + val = func() json.RawMessage { + if v, ok := fields["LongField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.LongField); err != nil { + return err + } + } else { + r.LongField = make(map[string]int64) + + r.LongField["default"] = 2 + + } + val = func() json.RawMessage { + if v, ok := fields["StringField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.StringField); err != nil { + return err + } + } else { + r.StringField = make(map[string]string) + + r.StringField["default"] = "defaultstring" + + } + val = func() json.RawMessage { + if v, ok := fields["FloatField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.FloatField); err != nil { + return err + } + } else { + r.FloatField = make(map[string]float32) + + r.FloatField["default"] = 236 + + } + val = func() json.RawMessage { + if v, ok := fields["BoolField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.BoolField); err != nil { + return err + } + } else { + r.BoolField = make(map[string]bool) + + r.BoolField["default"] = true + + } + val = func() json.RawMessage { + if v, ok := fields["BytesField"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.BytesField); err != nil { + return err + } + } else { + r.BytesField = make(map[string]Bytes) + + r.BytesField["default"] = []byte("\x03\x0f\xde") + + } + return nil +} diff --git a/pkg/types/net_device.go b/pkg/types/net_device.go new file mode 100644 index 00000000..e0ef80e8 --- /dev/null +++ b/pkg/types/net_device.go @@ -0,0 +1,625 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type NetDevice struct { + VLAN string `json:"VLAN"` + + IPV4_SRC_ADDR string `json:"IPV4_SRC_ADDR"` + + IPV4_DST_ADDR string `json:"IPV4_DST_ADDR"` + + IN_BYTES int32 `json:"IN_BYTES"` + + FIRST_SWITCHED int64 `json:"FIRST_SWITCHED"` + + LAST_SWITCHED int64 `json:"LAST_SWITCHED"` + + L4_SRC_PORT int32 `json:"L4_SRC_PORT"` + + L4_DST_PORT int32 `json:"L4_DST_PORT"` + + TCP_FLAGS int32 `json:"TCP_FLAGS"` + + PROTOCOL int32 `json:"PROTOCOL"` + + SRC_TOS int32 `json:"SRC_TOS"` + + SRC_AS int32 `json:"SRC_AS"` + + DST_AS int32 `json:"DST_AS"` + + L7_PROTO int32 `json:"L7_PROTO"` + + L7_PROTO_NAME string `json:"L7_PROTO_NAME"` + + L7_PROTO_CATEGORY string `json:"L7_PROTO_CATEGORY"` +} + +const NetDeviceAvroCRC64Fingerprint = "\x1f\xec\x1e^Ef\x90\x1e" + +func NewNetDevice() NetDevice { + r := NetDevice{} + return r +} + +func DeserializeNetDevice(r io.Reader) (NetDevice, error) { + t := NewNetDevice() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeNetDeviceFromSchema(r io.Reader, schema string) (NetDevice, error) { + t := NewNetDevice() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeNetDevice(r NetDevice, w io.Writer) error { + var err error + err = vm.WriteString(r.VLAN, w) + if err != nil { + return err + } + err = vm.WriteString(r.IPV4_SRC_ADDR, w) + if err != nil { + return err + } + err = vm.WriteString(r.IPV4_DST_ADDR, w) + if err != nil { + return err + } + err = vm.WriteInt(r.IN_BYTES, w) + if err != nil { + return err + } + err = vm.WriteLong(r.FIRST_SWITCHED, w) + if err != nil { + return err + } + err = vm.WriteLong(r.LAST_SWITCHED, w) + if err != nil { + return err + } + err = vm.WriteInt(r.L4_SRC_PORT, w) + if err != nil { + return err + } + err = vm.WriteInt(r.L4_DST_PORT, w) + if err != nil { + return err + } + err = vm.WriteInt(r.TCP_FLAGS, w) + if err != nil { + return err + } + err = vm.WriteInt(r.PROTOCOL, w) + if err != nil { + return err + } + err = vm.WriteInt(r.SRC_TOS, w) + if err != nil { + return err + } + err = vm.WriteInt(r.SRC_AS, w) + if err != nil { + return err + } + err = vm.WriteInt(r.DST_AS, w) + if err != nil { + return err + } + err = vm.WriteInt(r.L7_PROTO, w) + if err != nil { + return err + } + err = vm.WriteString(r.L7_PROTO_NAME, w) + if err != nil { + return err + } + err = vm.WriteString(r.L7_PROTO_CATEGORY, w) + if err != nil { + return err + } + return err +} + +func (r NetDevice) Serialize(w io.Writer) error { + return writeNetDevice(r, w) +} + +func (r NetDevice) Schema() string { + return "{\"fields\":[{\"name\":\"VLAN\",\"type\":\"string\"},{\"name\":\"IPV4_SRC_ADDR\",\"type\":\"string\"},{\"name\":\"IPV4_DST_ADDR\",\"type\":\"string\"},{\"name\":\"IN_BYTES\",\"type\":\"int\"},{\"name\":\"FIRST_SWITCHED\",\"type\":\"long\"},{\"name\":\"LAST_SWITCHED\",\"type\":\"long\"},{\"name\":\"L4_SRC_PORT\",\"type\":\"int\"},{\"name\":\"L4_DST_PORT\",\"type\":\"int\"},{\"name\":\"TCP_FLAGS\",\"type\":\"int\"},{\"name\":\"PROTOCOL\",\"type\":\"int\"},{\"name\":\"SRC_TOS\",\"type\":\"int\"},{\"name\":\"SRC_AS\",\"type\":\"int\"},{\"name\":\"DST_AS\",\"type\":\"int\"},{\"name\":\"L7_PROTO\",\"type\":\"int\"},{\"name\":\"L7_PROTO_NAME\",\"type\":\"string\"},{\"name\":\"L7_PROTO_CATEGORY\",\"type\":\"string\"}],\"name\":\"netdevice.NetDevice\",\"type\":\"record\"}" +} + +func (r NetDevice) SchemaName() string { + return "netdevice.NetDevice" +} + +func (_ NetDevice) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ NetDevice) SetInt(v int32) { panic("Unsupported operation") } +func (_ NetDevice) SetLong(v int64) { panic("Unsupported operation") } +func (_ NetDevice) SetFloat(v float32) { panic("Unsupported operation") } +func (_ NetDevice) SetDouble(v float64) { panic("Unsupported operation") } +func (_ NetDevice) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ NetDevice) SetString(v string) { panic("Unsupported operation") } +func (_ NetDevice) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *NetDevice) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.VLAN} + + return w + + case 1: + w := types.String{Target: &r.IPV4_SRC_ADDR} + + return w + + case 2: + w := types.String{Target: &r.IPV4_DST_ADDR} + + return w + + case 3: + w := types.Int{Target: &r.IN_BYTES} + + return w + + case 4: + w := types.Long{Target: &r.FIRST_SWITCHED} + + return w + + case 5: + w := types.Long{Target: &r.LAST_SWITCHED} + + return w + + case 6: + w := types.Int{Target: &r.L4_SRC_PORT} + + return w + + case 7: + w := types.Int{Target: &r.L4_DST_PORT} + + return w + + case 8: + w := types.Int{Target: &r.TCP_FLAGS} + + return w + + case 9: + w := types.Int{Target: &r.PROTOCOL} + + return w + + case 10: + w := types.Int{Target: &r.SRC_TOS} + + return w + + case 11: + w := types.Int{Target: &r.SRC_AS} + + return w + + case 12: + w := types.Int{Target: &r.DST_AS} + + return w + + case 13: + w := types.Int{Target: &r.L7_PROTO} + + return w + + case 14: + w := types.String{Target: &r.L7_PROTO_NAME} + + return w + + case 15: + w := types.String{Target: &r.L7_PROTO_CATEGORY} + + return w + + } + panic("Unknown field index") +} + +func (r *NetDevice) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *NetDevice) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ NetDevice) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ NetDevice) AppendArray() types.Field { panic("Unsupported operation") } +func (_ NetDevice) HintSize(int) { panic("Unsupported operation") } +func (_ NetDevice) Finalize() {} + +func (_ NetDevice) AvroCRC64Fingerprint() []byte { + return []byte(NetDeviceAvroCRC64Fingerprint) +} + +func (r NetDevice) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["VLAN"], err = json.Marshal(r.VLAN) + if err != nil { + return nil, err + } + output["IPV4_SRC_ADDR"], err = json.Marshal(r.IPV4_SRC_ADDR) + if err != nil { + return nil, err + } + output["IPV4_DST_ADDR"], err = json.Marshal(r.IPV4_DST_ADDR) + if err != nil { + return nil, err + } + output["IN_BYTES"], err = json.Marshal(r.IN_BYTES) + if err != nil { + return nil, err + } + output["FIRST_SWITCHED"], err = json.Marshal(r.FIRST_SWITCHED) + if err != nil { + return nil, err + } + output["LAST_SWITCHED"], err = json.Marshal(r.LAST_SWITCHED) + if err != nil { + return nil, err + } + output["L4_SRC_PORT"], err = json.Marshal(r.L4_SRC_PORT) + if err != nil { + return nil, err + } + output["L4_DST_PORT"], err = json.Marshal(r.L4_DST_PORT) + if err != nil { + return nil, err + } + output["TCP_FLAGS"], err = json.Marshal(r.TCP_FLAGS) + if err != nil { + return nil, err + } + output["PROTOCOL"], err = json.Marshal(r.PROTOCOL) + if err != nil { + return nil, err + } + output["SRC_TOS"], err = json.Marshal(r.SRC_TOS) + if err != nil { + return nil, err + } + output["SRC_AS"], err = json.Marshal(r.SRC_AS) + if err != nil { + return nil, err + } + output["DST_AS"], err = json.Marshal(r.DST_AS) + if err != nil { + return nil, err + } + output["L7_PROTO"], err = json.Marshal(r.L7_PROTO) + if err != nil { + return nil, err + } + output["L7_PROTO_NAME"], err = json.Marshal(r.L7_PROTO_NAME) + if err != nil { + return nil, err + } + output["L7_PROTO_CATEGORY"], err = json.Marshal(r.L7_PROTO_CATEGORY) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *NetDevice) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["VLAN"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.VLAN); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for VLAN") + } + val = func() json.RawMessage { + if v, ok := fields["IPV4_SRC_ADDR"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.IPV4_SRC_ADDR); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for IPV4_SRC_ADDR") + } + val = func() json.RawMessage { + if v, ok := fields["IPV4_DST_ADDR"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.IPV4_DST_ADDR); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for IPV4_DST_ADDR") + } + val = func() json.RawMessage { + if v, ok := fields["IN_BYTES"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.IN_BYTES); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for IN_BYTES") + } + val = func() json.RawMessage { + if v, ok := fields["FIRST_SWITCHED"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.FIRST_SWITCHED); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for FIRST_SWITCHED") + } + val = func() json.RawMessage { + if v, ok := fields["LAST_SWITCHED"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.LAST_SWITCHED); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for LAST_SWITCHED") + } + val = func() json.RawMessage { + if v, ok := fields["L4_SRC_PORT"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L4_SRC_PORT); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for L4_SRC_PORT") + } + val = func() json.RawMessage { + if v, ok := fields["L4_DST_PORT"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L4_DST_PORT); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for L4_DST_PORT") + } + val = func() json.RawMessage { + if v, ok := fields["TCP_FLAGS"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.TCP_FLAGS); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for TCP_FLAGS") + } + val = func() json.RawMessage { + if v, ok := fields["PROTOCOL"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.PROTOCOL); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for PROTOCOL") + } + val = func() json.RawMessage { + if v, ok := fields["SRC_TOS"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.SRC_TOS); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for SRC_TOS") + } + val = func() json.RawMessage { + if v, ok := fields["SRC_AS"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.SRC_AS); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for SRC_AS") + } + val = func() json.RawMessage { + if v, ok := fields["DST_AS"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.DST_AS); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for DST_AS") + } + val = func() json.RawMessage { + if v, ok := fields["L7_PROTO"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L7_PROTO); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for L7_PROTO") + } + val = func() json.RawMessage { + if v, ok := fields["L7_PROTO_NAME"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L7_PROTO_NAME); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for L7_PROTO_NAME") + } + val = func() json.RawMessage { + if v, ok := fields["L7_PROTO_CATEGORY"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L7_PROTO_CATEGORY); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for L7_PROTO_CATEGORY") + } + return nil +} diff --git a/pkg/types/orderline.go b/pkg/types/orderline.go new file mode 100644 index 00000000..96972478 --- /dev/null +++ b/pkg/types/orderline.go @@ -0,0 +1,306 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Orderline struct { + Product_id int32 `json:"product_id"` + + Category string `json:"category"` + + Quantity int32 `json:"quantity"` + + Unit_price float64 `json:"unit_price"` + + Net_price float64 `json:"net_price"` +} + +const OrderlineAvroCRC64Fingerprint = "-c\x8c\xf8\xfa0\x11~" + +func NewOrderline() Orderline { + r := Orderline{} + return r +} + +func DeserializeOrderline(r io.Reader) (Orderline, error) { + t := NewOrderline() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeOrderlineFromSchema(r io.Reader, schema string) (Orderline, error) { + t := NewOrderline() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeOrderline(r Orderline, w io.Writer) error { + var err error + err = vm.WriteInt(r.Product_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Category, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Quantity, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Unit_price, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Net_price, w) + if err != nil { + return err + } + return err +} + +func (r Orderline) Serialize(w io.Writer) error { + return writeOrderline(r, w) +} + +func (r Orderline) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"category\":\"calzone\",\"net_price\":75.12,\"product_id\":66,\"quantity\":4,\"unit_price\":18.78},{\"category\":\"salad\",\"net_price\":19.6,\"product_id\":71,\"quantity\":4,\"unit_price\":4.9},{\"category\":\"pizza\",\"net_price\":58.83,\"product_id\":79,\"quantity\":3,\"unit_price\":19.61},{\"category\":\"calzone\",\"net_price\":26.1,\"product_id\":38,\"quantity\":2,\"unit_price\":13.05},{\"category\":\"calzone\",\"net_price\":17.37,\"product_id\":26,\"quantity\":1,\"unit_price\":17.37},{\"category\":\"calzone\",\"net_price\":73.89,\"product_id\":66,\"quantity\":3,\"unit_price\":24.63},{\"category\":\"dessert\",\"net_price\":63.42,\"product_id\":62,\"quantity\":3,\"unit_price\":21.14},{\"category\":\"salad\",\"net_price\":63.39,\"product_id\":68,\"quantity\":3,\"unit_price\":21.13},{\"category\":\"salad\",\"net_price\":16.92,\"product_id\":72,\"quantity\":2,\"unit_price\":8.46},{\"category\":\"calzone\",\"net_price\":7.2,\"product_id\":55,\"quantity\":2,\"unit_price\":3.6},{\"category\":\"pizza\",\"net_price\":76.04,\"product_id\":77,\"quantity\":4,\"unit_price\":19.01},{\"category\":\"pizza\",\"net_price\":4.47,\"product_id\":60,\"quantity\":3,\"unit_price\":1.49},{\"category\":\"dessert\",\"net_price\":69.99,\"product_id\":8,\"quantity\":3,\"unit_price\":23.33},{\"category\":\"calzone\",\"net_price\":44.96,\"product_id\":91,\"quantity\":4,\"unit_price\":11.24},{\"category\":\"pizza\",\"net_price\":22.9,\"product_id\":78,\"quantity\":2,\"unit_price\":11.45},{\"category\":\"dessert\",\"net_price\":66.06,\"product_id\":27,\"quantity\":3,\"unit_price\":22.02},{\"category\":\"salad\",\"net_price\":9.88,\"product_id\":58,\"quantity\":1,\"unit_price\":9.88},{\"category\":\"dessert\",\"net_price\":98.76,\"product_id\":9,\"quantity\":4,\"unit_price\":24.69},{\"category\":\"salad\",\"net_price\":12.62,\"product_id\":77,\"quantity\":1,\"unit_price\":12.62},{\"category\":\"wings\",\"net_price\":6.63,\"product_id\":27,\"quantity\":3,\"unit_price\":2.21},{\"category\":\"calzone\",\"net_price\":19.04,\"product_id\":4,\"quantity\":1,\"unit_price\":19.04},{\"category\":\"calzone\",\"net_price\":16.38,\"product_id\":48,\"quantity\":1,\"unit_price\":16.38},{\"category\":\"dessert\",\"net_price\":46.2,\"product_id\":26,\"quantity\":5,\"unit_price\":9.24},{\"category\":\"pizza\",\"net_price\":80.45,\"product_id\":75,\"quantity\":5,\"unit_price\":16.09},{\"category\":\"salad\",\"net_price\":32.64,\"product_id\":33,\"quantity\":3,\"unit_price\":10.88},{\"category\":\"calzone\",\"net_price\":113.2,\"product_id\":45,\"quantity\":5,\"unit_price\":22.64},{\"category\":\"dessert\",\"net_price\":13.15,\"product_id\":65,\"quantity\":5,\"unit_price\":2.63},{\"category\":\"wings\",\"net_price\":5.68,\"product_id\":52,\"quantity\":1,\"unit_price\":5.68},{\"category\":\"pizza\",\"net_price\":16.47,\"product_id\":23,\"quantity\":3,\"unit_price\":5.49},{\"category\":\"dessert\",\"net_price\":3.02,\"product_id\":67,\"quantity\":1,\"unit_price\":3.02},{\"category\":\"dessert\",\"net_price\":66.76,\"product_id\":71,\"quantity\":4,\"unit_price\":16.69},{\"category\":\"salad\",\"net_price\":51.21,\"product_id\":69,\"quantity\":3,\"unit_price\":17.07},{\"category\":\"pizza\",\"net_price\":46.2,\"product_id\":41,\"quantity\":4,\"unit_price\":11.55},{\"category\":\"wings\",\"net_price\":13.18,\"product_id\":44,\"quantity\":2,\"unit_price\":6.59},{\"category\":\"wings\",\"net_price\":33.08,\"product_id\":66,\"quantity\":2,\"unit_price\":16.54},{\"category\":\"calzone\",\"net_price\":60.35,\"product_id\":8,\"quantity\":5,\"unit_price\":12.07},{\"category\":\"salad\",\"net_price\":69.5,\"product_id\":43,\"quantity\":5,\"unit_price\":13.9},{\"category\":\"calzone\",\"net_price\":101.5,\"product_id\":13,\"quantity\":5,\"unit_price\":20.3},{\"category\":\"salad\",\"net_price\":83.05,\"product_id\":65,\"quantity\":5,\"unit_price\":16.61},{\"category\":\"dessert\",\"net_price\":4.18,\"product_id\":48,\"quantity\":1,\"unit_price\":4.18},{\"category\":\"calzone\",\"net_price\":17.22,\"product_id\":59,\"quantity\":3,\"unit_price\":5.74},{\"category\":\"calzone\",\"net_price\":15.65,\"product_id\":42,\"quantity\":1,\"unit_price\":15.65},{\"category\":\"calzone\",\"net_price\":13.95,\"product_id\":22,\"quantity\":5,\"unit_price\":2.79},{\"category\":\"pizza\",\"net_price\":30.7,\"product_id\":47,\"quantity\":2,\"unit_price\":15.35},{\"category\":\"salad\",\"net_price\":124.85,\"product_id\":72,\"quantity\":5,\"unit_price\":24.97},{\"category\":\"salad\",\"net_price\":2.85,\"product_id\":60,\"quantity\":1,\"unit_price\":2.85},{\"category\":\"dessert\",\"net_price\":1.24,\"product_id\":58,\"quantity\":1,\"unit_price\":1.24},{\"category\":\"calzone\",\"net_price\":96,\"product_id\":88,\"quantity\":4,\"unit_price\":24},{\"category\":\"wings\",\"net_price\":6.66,\"product_id\":98,\"quantity\":1,\"unit_price\":6.66},{\"category\":\"pizza\",\"net_price\":43.86,\"product_id\":37,\"quantity\":3,\"unit_price\":14.62},{\"category\":\"calzone\",\"net_price\":42.63,\"product_id\":37,\"quantity\":3,\"unit_price\":14.21},{\"category\":\"wings\",\"net_price\":18.88,\"product_id\":54,\"quantity\":1,\"unit_price\":18.88},{\"category\":\"wings\",\"net_price\":28.41,\"product_id\":52,\"quantity\":3,\"unit_price\":9.47},{\"category\":\"wings\",\"net_price\":13.39,\"product_id\":80,\"quantity\":1,\"unit_price\":13.39},{\"category\":\"pizza\",\"net_price\":40.92,\"product_id\":6,\"quantity\":3,\"unit_price\":13.64},{\"category\":\"wings\",\"net_price\":24.9,\"product_id\":95,\"quantity\":1,\"unit_price\":24.9},{\"category\":\"pizza\",\"net_price\":38.15,\"product_id\":60,\"quantity\":5,\"unit_price\":7.63},{\"category\":\"wings\",\"net_price\":81.24,\"product_id\":81,\"quantity\":4,\"unit_price\":20.31},{\"category\":\"dessert\",\"net_price\":6.61,\"product_id\":42,\"quantity\":1,\"unit_price\":6.61},{\"category\":\"salad\",\"net_price\":30.64,\"product_id\":6,\"quantity\":4,\"unit_price\":7.66},{\"category\":\"calzone\",\"net_price\":12.92,\"product_id\":36,\"quantity\":4,\"unit_price\":3.23},{\"category\":\"calzone\",\"net_price\":8.64,\"product_id\":27,\"quantity\":1,\"unit_price\":8.64},{\"category\":\"salad\",\"net_price\":31.65,\"product_id\":97,\"quantity\":5,\"unit_price\":6.33},{\"category\":\"salad\",\"net_price\":59.56,\"product_id\":95,\"quantity\":4,\"unit_price\":14.89},{\"category\":\"pizza\",\"net_price\":8.81,\"product_id\":89,\"quantity\":1,\"unit_price\":8.81},{\"category\":\"dessert\",\"net_price\":48.09,\"product_id\":97,\"quantity\":3,\"unit_price\":16.03},{\"category\":\"salad\",\"net_price\":12.68,\"product_id\":25,\"quantity\":4,\"unit_price\":3.17},{\"category\":\"wings\",\"net_price\":10.94,\"product_id\":42,\"quantity\":2,\"unit_price\":5.47},{\"category\":\"salad\",\"net_price\":36.5,\"product_id\":7,\"quantity\":2,\"unit_price\":18.25},{\"category\":\"wings\",\"net_price\":65.84,\"product_id\":4,\"quantity\":4,\"unit_price\":16.46},{\"category\":\"calzone\",\"net_price\":2.15,\"product_id\":78,\"quantity\":1,\"unit_price\":2.15},{\"category\":\"calzone\",\"net_price\":22.3,\"product_id\":71,\"quantity\":1,\"unit_price\":22.3},{\"category\":\"dessert\",\"net_price\":63.45,\"product_id\":80,\"quantity\":5,\"unit_price\":12.69},{\"category\":\"salad\",\"net_price\":1.66,\"product_id\":83,\"quantity\":1,\"unit_price\":1.66},{\"category\":\"dessert\",\"net_price\":72.72,\"product_id\":44,\"quantity\":4,\"unit_price\":18.18},{\"category\":\"calzone\",\"net_price\":8.04,\"product_id\":43,\"quantity\":4,\"unit_price\":2.01},{\"category\":\"calzone\",\"net_price\":39.18,\"product_id\":91,\"quantity\":3,\"unit_price\":13.06},{\"category\":\"wings\",\"net_price\":44.2,\"product_id\":55,\"quantity\":2,\"unit_price\":22.1},{\"category\":\"wings\",\"net_price\":5.33,\"product_id\":88,\"quantity\":1,\"unit_price\":5.33},{\"category\":\"dessert\",\"net_price\":17.36,\"product_id\":10,\"quantity\":2,\"unit_price\":8.68},{\"category\":\"salad\",\"net_price\":2.78,\"product_id\":76,\"quantity\":2,\"unit_price\":1.39},{\"category\":\"salad\",\"net_price\":88.45,\"product_id\":13,\"quantity\":5,\"unit_price\":17.69},{\"category\":\"salad\",\"net_price\":36.88,\"product_id\":27,\"quantity\":4,\"unit_price\":9.22},{\"category\":\"wings\",\"net_price\":21.48,\"product_id\":94,\"quantity\":3,\"unit_price\":7.16},{\"category\":\"dessert\",\"net_price\":20.2,\"product_id\":89,\"quantity\":1,\"unit_price\":20.2},{\"category\":\"wings\",\"net_price\":14.08,\"product_id\":4,\"quantity\":4,\"unit_price\":3.52},{\"category\":\"dessert\",\"net_price\":26.48,\"product_id\":97,\"quantity\":4,\"unit_price\":6.62},{\"category\":\"dessert\",\"net_price\":40.88,\"product_id\":57,\"quantity\":2,\"unit_price\":20.44},{\"category\":\"dessert\",\"net_price\":42.36,\"product_id\":6,\"quantity\":4,\"unit_price\":10.59},{\"category\":\"salad\",\"net_price\":73.8,\"product_id\":86,\"quantity\":3,\"unit_price\":24.6},{\"category\":\"salad\",\"net_price\":35.49,\"product_id\":85,\"quantity\":3,\"unit_price\":11.83},{\"category\":\"wings\",\"net_price\":45.81,\"product_id\":95,\"quantity\":3,\"unit_price\":15.27},{\"category\":\"calzone\",\"net_price\":33.75,\"product_id\":18,\"quantity\":3,\"unit_price\":11.25},{\"category\":\"wings\",\"net_price\":40.59,\"product_id\":85,\"quantity\":3,\"unit_price\":13.53},{\"category\":\"wings\",\"net_price\":66.32,\"product_id\":13,\"quantity\":4,\"unit_price\":16.58},{\"category\":\"salad\",\"net_price\":45.95,\"product_id\":12,\"quantity\":5,\"unit_price\":9.19},{\"category\":\"pizza\",\"net_price\":13.65,\"product_id\":21,\"quantity\":1,\"unit_price\":13.65},{\"category\":\"dessert\",\"net_price\":36.64,\"product_id\":14,\"quantity\":2,\"unit_price\":18.32},{\"category\":\"calzone\",\"net_price\":119.4,\"product_id\":7,\"quantity\":5,\"unit_price\":23.88},{\"category\":\"pizza\",\"net_price\":22.52,\"product_id\":71,\"quantity\":1,\"unit_price\":22.52}]},\"fields\":[{\"name\":\"product_id\",\"type\":\"int\"},{\"name\":\"category\",\"type\":\"string\"},{\"name\":\"quantity\",\"type\":\"int\"},{\"name\":\"unit_price\",\"type\":\"double\"},{\"name\":\"net_price\",\"type\":\"double\"}],\"name\":\"pizzastore.orderline\",\"type\":\"record\"}" +} + +func (r Orderline) SchemaName() string { + return "pizzastore.orderline" +} + +func (_ Orderline) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Orderline) SetInt(v int32) { panic("Unsupported operation") } +func (_ Orderline) SetLong(v int64) { panic("Unsupported operation") } +func (_ Orderline) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Orderline) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Orderline) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Orderline) SetString(v string) { panic("Unsupported operation") } +func (_ Orderline) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Orderline) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Product_id} + + return w + + case 1: + w := types.String{Target: &r.Category} + + return w + + case 2: + w := types.Int{Target: &r.Quantity} + + return w + + case 3: + w := types.Double{Target: &r.Unit_price} + + return w + + case 4: + w := types.Double{Target: &r.Net_price} + + return w + + } + panic("Unknown field index") +} + +func (r *Orderline) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Orderline) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Orderline) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Orderline) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Orderline) HintSize(int) { panic("Unsupported operation") } +func (_ Orderline) Finalize() {} + +func (_ Orderline) AvroCRC64Fingerprint() []byte { + return []byte(OrderlineAvroCRC64Fingerprint) +} + +func (r Orderline) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["product_id"], err = json.Marshal(r.Product_id) + if err != nil { + return nil, err + } + output["category"], err = json.Marshal(r.Category) + if err != nil { + return nil, err + } + output["quantity"], err = json.Marshal(r.Quantity) + if err != nil { + return nil, err + } + output["unit_price"], err = json.Marshal(r.Unit_price) + if err != nil { + return nil, err + } + output["net_price"], err = json.Marshal(r.Net_price) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Orderline) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["product_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Product_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for product_id") + } + val = func() json.RawMessage { + if v, ok := fields["category"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Category); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for category") + } + val = func() json.RawMessage { + if v, ok := fields["quantity"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Quantity); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for quantity") + } + val = func() json.RawMessage { + if v, ok := fields["unit_price"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Unit_price); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for unit_price") + } + val = func() json.RawMessage { + if v, ok := fields["net_price"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Net_price); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for net_price") + } + return nil +} diff --git a/pkg/types/payment_credit_card.go b/pkg/types/payment_credit_card.go new file mode 100644 index 00000000..8786d3de --- /dev/null +++ b/pkg/types/payment_credit_card.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PaymentCreditCard struct { + Card_id int32 `json:"card_id"` + + Card_number string `json:"card_number"` + + Cvv string `json:"cvv"` + + Expiration_date string `json:"expiration_date"` +} + +const PaymentCreditCardAvroCRC64Fingerprint = "$\xb6\xac\xf6\v:\xbe(" + +func NewPaymentCreditCard() PaymentCreditCard { + r := PaymentCreditCard{} + return r +} + +func DeserializePaymentCreditCard(r io.Reader) (PaymentCreditCard, error) { + t := NewPaymentCreditCard() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePaymentCreditCardFromSchema(r io.Reader, schema string) (PaymentCreditCard, error) { + t := NewPaymentCreditCard() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePaymentCreditCard(r PaymentCreditCard, w io.Writer) error { + var err error + err = vm.WriteInt(r.Card_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Card_number, w) + if err != nil { + return err + } + err = vm.WriteString(r.Cvv, w) + if err != nil { + return err + } + err = vm.WriteString(r.Expiration_date, w) + if err != nil { + return err + } + return err +} + +func (r PaymentCreditCard) Serialize(w io.Writer) error { + return writePaymentCreditCard(r, w) +} + +func (r PaymentCreditCard) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"card_id\":1,\"card_number\":6011601160116611,\"cvv\":832,\"expiration_date\":\"12/27\"},{\"card_id\":2,\"card_number\":6011111111111117,\"cvv\":833,\"expiration_date\":\"12/26\"},{\"card_id\":3,\"card_number\":6011000990139424,\"cvv\":348,\"expiration_date\":\"12/27\"},{\"card_id\":4,\"card_number\":3530111333300000,\"cvv\":288,\"expiration_date\":\"11/27\"},{\"card_id\":5,\"card_number\":3566002020360505,\"cvv\":558,\"expiration_date\":\"11/27\"},{\"card_id\":6,\"card_number\":5431111111111111,\"cvv\":383,\"expiration_date\":\"11/26\"},{\"card_id\":7,\"card_number\":5555555555554444,\"cvv\":273,\"expiration_date\":\"10/27\"},{\"card_id\":8,\"card_number\":5105105105105100,\"cvv\":663,\"expiration_date\":\"10/27\"},{\"card_id\":9,\"card_number\":4111111111111111,\"cvv\":822,\"expiration_date\":\"10/26\"},{\"card_id\":10,\"card_number\":4242424242424242,\"cvv\":190,\"expiration_date\":\"09/27\"},{\"card_id\":11,\"card_number\":4000056655665556,\"cvv\":729,\"expiration_date\":\"09/26\"},{\"card_id\":12,\"card_number\":5555555555554444,\"cvv\":289,\"expiration_date\":\"08/27\"},{\"card_id\":13,\"card_number\":2223003122003222,\"cvv\":115,\"expiration_date\":\"08/26\"},{\"card_id\":14,\"card_number\":5200828282828210,\"cvv\":927,\"expiration_date\":\"08/27\"},{\"card_id\":15,\"card_number\":5105105105105100,\"cvv\":329,\"expiration_date\":\"07/27\"},{\"card_id\":16,\"card_number\":6200000000000005,\"cvv\":727,\"expiration_date\":\"06/27\"},{\"card_id\":17,\"card_number\":3056930009020004,\"cvv\":563,\"expiration_date\":\"05/27\"},{\"card_id\":18,\"card_number\":4000000760000002,\"cvv\":922,\"expiration_date\":\"04/27\"},{\"card_id\":19,\"card_number\":4000001240000000,\"cvv\":293,\"expiration_date\":\"03/27\"},{\"card_id\":20,\"card_number\":4000004840008001,\"cvv\":779,\"expiration_date\":\"02/27\"},{\"card_id\":21,\"card_number\":4000002500003155,\"cvv\":443,\"expiration_date\":\"02/26\"},{\"card_id\":22,\"card_number\":4000002760003184,\"cvv\":487,\"expiration_date\":\"06/27\"},{\"card_id\":23,\"card_number\":4000008260003178,\"cvv\":663,\"expiration_date\":\"01/26\"},{\"card_id\":24,\"card_number\":4000008260003179,\"cvv\":723,\"expiration_date\":\"01/26\"}]},\"fields\":[{\"name\":\"card_id\",\"type\":\"int\"},{\"name\":\"card_number\",\"type\":\"string\"},{\"name\":\"cvv\",\"type\":\"string\"},{\"name\":\"expiration_date\",\"type\":\"string\"}],\"name\":\"payment.PaymentCreditCard\",\"type\":\"record\"}" +} + +func (r PaymentCreditCard) SchemaName() string { + return "payment.PaymentCreditCard" +} + +func (_ PaymentCreditCard) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetInt(v int32) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetLong(v int64) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetString(v string) { panic("Unsupported operation") } +func (_ PaymentCreditCard) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PaymentCreditCard) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Card_id} + + return w + + case 1: + w := types.String{Target: &r.Card_number} + + return w + + case 2: + w := types.String{Target: &r.Cvv} + + return w + + case 3: + w := types.String{Target: &r.Expiration_date} + + return w + + } + panic("Unknown field index") +} + +func (r *PaymentCreditCard) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PaymentCreditCard) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PaymentCreditCard) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PaymentCreditCard) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PaymentCreditCard) HintSize(int) { panic("Unsupported operation") } +func (_ PaymentCreditCard) Finalize() {} + +func (_ PaymentCreditCard) AvroCRC64Fingerprint() []byte { + return []byte(PaymentCreditCardAvroCRC64Fingerprint) +} + +func (r PaymentCreditCard) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["card_id"], err = json.Marshal(r.Card_id) + if err != nil { + return nil, err + } + output["card_number"], err = json.Marshal(r.Card_number) + if err != nil { + return nil, err + } + output["cvv"], err = json.Marshal(r.Cvv) + if err != nil { + return nil, err + } + output["expiration_date"], err = json.Marshal(r.Expiration_date) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PaymentCreditCard) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["card_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Card_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for card_id") + } + val = func() json.RawMessage { + if v, ok := fields["card_number"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Card_number); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for card_number") + } + val = func() json.RawMessage { + if v, ok := fields["cvv"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Cvv); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for cvv") + } + val = func() json.RawMessage { + if v, ok := fields["expiration_date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Expiration_date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for expiration_date") + } + return nil +} diff --git a/pkg/types/payment_transaction.go b/pkg/types/payment_transaction.go new file mode 100644 index 00000000..7f7cb524 --- /dev/null +++ b/pkg/types/payment_transaction.go @@ -0,0 +1,306 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PaymentTransaction struct { + Transaction_id int64 `json:"transaction_id"` + + Card_id int64 `json:"card_id"` + + User_id string `json:"user_id"` + + Purchase_id int64 `json:"purchase_id"` + + Store_id int32 `json:"store_id"` +} + +const PaymentTransactionAvroCRC64Fingerprint = "\x1c\xf4\xf3^v\x9eU\xad" + +func NewPaymentTransaction() PaymentTransaction { + r := PaymentTransaction{} + return r +} + +func DeserializePaymentTransaction(r io.Reader) (PaymentTransaction, error) { + t := NewPaymentTransaction() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePaymentTransactionFromSchema(r io.Reader, schema string) (PaymentTransaction, error) { + t := NewPaymentTransaction() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePaymentTransaction(r PaymentTransaction, w io.Writer) error { + var err error + err = vm.WriteLong(r.Transaction_id, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Card_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.User_id, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Purchase_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Store_id, w) + if err != nil { + return err + } + return err +} + +func (r PaymentTransaction) Serialize(w io.Writer) error { + return writePaymentTransaction(r, w) +} + +func (r PaymentTransaction) Schema() string { + return "{\"fields\":[{\"name\":\"transaction_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1}},\"type\":\"long\"}},{\"name\":\"card_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":24,\"min\":1}},\"type\":\"long\"}},{\"name\":\"user_id\",\"type\":{\"arg.properties\":{\"regex\":\"User_[1-9]{0,1}\"},\"type\":\"string\"}},{\"name\":\"purchase_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}},{\"name\":\"store_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":7,\"min\":1}},\"type\":\"int\"}}],\"name\":\"transaction.PaymentTransaction\",\"type\":\"record\"}" +} + +func (r PaymentTransaction) SchemaName() string { + return "transaction.PaymentTransaction" +} + +func (_ PaymentTransaction) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetInt(v int32) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetLong(v int64) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetString(v string) { panic("Unsupported operation") } +func (_ PaymentTransaction) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PaymentTransaction) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Transaction_id} + + return w + + case 1: + w := types.Long{Target: &r.Card_id} + + return w + + case 2: + w := types.String{Target: &r.User_id} + + return w + + case 3: + w := types.Long{Target: &r.Purchase_id} + + return w + + case 4: + w := types.Int{Target: &r.Store_id} + + return w + + } + panic("Unknown field index") +} + +func (r *PaymentTransaction) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PaymentTransaction) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PaymentTransaction) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PaymentTransaction) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PaymentTransaction) HintSize(int) { panic("Unsupported operation") } +func (_ PaymentTransaction) Finalize() {} + +func (_ PaymentTransaction) AvroCRC64Fingerprint() []byte { + return []byte(PaymentTransactionAvroCRC64Fingerprint) +} + +func (r PaymentTransaction) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["transaction_id"], err = json.Marshal(r.Transaction_id) + if err != nil { + return nil, err + } + output["card_id"], err = json.Marshal(r.Card_id) + if err != nil { + return nil, err + } + output["user_id"], err = json.Marshal(r.User_id) + if err != nil { + return nil, err + } + output["purchase_id"], err = json.Marshal(r.Purchase_id) + if err != nil { + return nil, err + } + output["store_id"], err = json.Marshal(r.Store_id) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PaymentTransaction) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["transaction_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Transaction_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for transaction_id") + } + val = func() json.RawMessage { + if v, ok := fields["card_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Card_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for card_id") + } + val = func() json.RawMessage { + if v, ok := fields["user_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.User_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for user_id") + } + val = func() json.RawMessage { + if v, ok := fields["purchase_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Purchase_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for purchase_id") + } + val = func() json.RawMessage { + if v, ok := fields["store_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_id") + } + return nil +} diff --git a/pkg/types/payroll_bonus.go b/pkg/types/payroll_bonus.go new file mode 100644 index 00000000..4fda2dc0 --- /dev/null +++ b/pkg/types/payroll_bonus.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PayrollBonus struct { + Employee_id int32 `json:"employee_id"` + + Bonus int32 `json:"bonus"` + + Ts int64 `json:"ts"` +} + +const PayrollBonusAvroCRC64Fingerprint = "6\xcfΊˌ\xa40" + +func NewPayrollBonus() PayrollBonus { + r := PayrollBonus{} + return r +} + +func DeserializePayrollBonus(r io.Reader) (PayrollBonus, error) { + t := NewPayrollBonus() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePayrollBonusFromSchema(r io.Reader, schema string) (PayrollBonus, error) { + t := NewPayrollBonus() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePayrollBonus(r PayrollBonus, w io.Writer) error { + var err error + err = vm.WriteInt(r.Employee_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Bonus, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Ts, w) + if err != nil { + return err + } + return err +} + +func (r PayrollBonus) Serialize(w io.Writer) error { + return writePayrollBonus(r, w) +} + +func (r PayrollBonus) Schema() string { + return "{\"fields\":[{\"name\":\"employee_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1100,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"bonus\",\"type\":{\"arg.properties\":{\"range\":{\"max\":50,\"min\":10}},\"type\":\"int\"}},{\"name\":\"ts\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1640995199000,\"min\":1609459200000}},\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}}],\"name\":\"payroll.PayrollBonus\",\"type\":\"record\"}" +} + +func (r PayrollBonus) SchemaName() string { + return "payroll.PayrollBonus" +} + +func (_ PayrollBonus) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PayrollBonus) SetInt(v int32) { panic("Unsupported operation") } +func (_ PayrollBonus) SetLong(v int64) { panic("Unsupported operation") } +func (_ PayrollBonus) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PayrollBonus) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PayrollBonus) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PayrollBonus) SetString(v string) { panic("Unsupported operation") } +func (_ PayrollBonus) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PayrollBonus) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Employee_id} + + return w + + case 1: + w := types.Int{Target: &r.Bonus} + + return w + + case 2: + w := types.Long{Target: &r.Ts} + + return w + + } + panic("Unknown field index") +} + +func (r *PayrollBonus) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PayrollBonus) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PayrollBonus) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PayrollBonus) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PayrollBonus) HintSize(int) { panic("Unsupported operation") } +func (_ PayrollBonus) Finalize() {} + +func (_ PayrollBonus) AvroCRC64Fingerprint() []byte { + return []byte(PayrollBonusAvroCRC64Fingerprint) +} + +func (r PayrollBonus) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["employee_id"], err = json.Marshal(r.Employee_id) + if err != nil { + return nil, err + } + output["bonus"], err = json.Marshal(r.Bonus) + if err != nil { + return nil, err + } + output["ts"], err = json.Marshal(r.Ts) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PayrollBonus) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["employee_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Employee_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for employee_id") + } + val = func() json.RawMessage { + if v, ok := fields["bonus"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Bonus); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for bonus") + } + val = func() json.RawMessage { + if v, ok := fields["ts"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ts); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ts") + } + return nil +} diff --git a/pkg/types/payroll_employee.go b/pkg/types/payroll_employee.go new file mode 100644 index 00000000..66ee2dbf --- /dev/null +++ b/pkg/types/payroll_employee.go @@ -0,0 +1,393 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PayrollEmployee struct { + Employee_id int32 `json:"employee_id"` + + First_name string `json:"first_name"` + + Last_name string `json:"last_name"` + + Age int32 `json:"age"` + + Ssn string `json:"ssn"` + + Hourly_rate int32 `json:"hourly_rate"` + + Gender string `json:"gender"` + + Email string `json:"email"` +} + +const PayrollEmployeeAvroCRC64Fingerprint = "w\xcb\"*H}#\xfd" + +func NewPayrollEmployee() PayrollEmployee { + r := PayrollEmployee{} + return r +} + +func DeserializePayrollEmployee(r io.Reader) (PayrollEmployee, error) { + t := NewPayrollEmployee() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePayrollEmployeeFromSchema(r io.Reader, schema string) (PayrollEmployee, error) { + t := NewPayrollEmployee() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePayrollEmployee(r PayrollEmployee, w io.Writer) error { + var err error + err = vm.WriteInt(r.Employee_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.First_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Last_name, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Age, w) + if err != nil { + return err + } + err = vm.WriteString(r.Ssn, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Hourly_rate, w) + if err != nil { + return err + } + err = vm.WriteString(r.Gender, w) + if err != nil { + return err + } + err = vm.WriteString(r.Email, w) + if err != nil { + return err + } + return err +} + +func (r PayrollEmployee) Serialize(w io.Writer) error { + return writePayrollEmployee(r, w) +} + +func (r PayrollEmployee) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"age\":32,\"email\":\"xcqn@mycompany.com\",\"employee_id\":1000,\"first_name\":\"Carleton\",\"gender\":\"female\",\"hourly_rate\":21,\"last_name\":\"Beagan\",\"ssn\":\"723-37-6885\"},{\"age\":42,\"email\":\"ymcw@mycompany.com\",\"employee_id\":1001,\"first_name\":\"Frieda\",\"gender\":\"male\",\"hourly_rate\":20,\"last_name\":\"Starcks\",\"ssn\":\"992-86-7676\"},{\"age\":38,\"email\":\"zkth@mycompany.com\",\"employee_id\":1002,\"first_name\":\"Trumann\",\"gender\":\"male\",\"hourly_rate\":17,\"last_name\":\"Murfill\",\"ssn\":\"980-75-4291\"},{\"age\":46,\"email\":\"yfxw@mycompany.com\",\"employee_id\":1003,\"first_name\":\"Zeb\",\"gender\":\"male\",\"hourly_rate\":11,\"last_name\":\"Murrish\",\"ssn\":\"557-94-0484\"},{\"age\":49,\"email\":\"ireg@mycompany.com\",\"employee_id\":1004,\"first_name\":\"Hayley\",\"gender\":\"female\",\"hourly_rate\":16,\"last_name\":\"Beatson\",\"ssn\":\"291-87-0461\"},{\"age\":47,\"email\":\"kzvq@mycompany.com\",\"employee_id\":1005,\"first_name\":\"Nolan\",\"gender\":\"female\",\"hourly_rate\":15,\"last_name\":\"Hallowell\",\"ssn\":\"798-35-7786\"},{\"age\":46,\"email\":\"tauo@mycompany.com\",\"employee_id\":1006,\"first_name\":\"Frieda\",\"gender\":\"male\",\"hourly_rate\":22,\"last_name\":\"Joblin\",\"ssn\":\"124-52-6784\"},{\"age\":46,\"email\":\"gexc@mycompany.com\",\"employee_id\":1007,\"first_name\":\"Kalila\",\"gender\":\"female\",\"hourly_rate\":8,\"last_name\":\"Foulsham\",\"ssn\":\"287-30-7370\"},{\"age\":38,\"email\":\"ryny@mycompany.com\",\"employee_id\":1008,\"first_name\":\"Nolan\",\"gender\":\"female\",\"hourly_rate\":13,\"last_name\":\"Rosensaft\",\"ssn\":\"666-02-9029\"},{\"age\":33,\"email\":\"haad@mycompany.com\",\"employee_id\":1009,\"first_name\":\"Isadora\",\"gender\":\"female\",\"hourly_rate\":23,\"last_name\":\"Ravenscroft\",\"ssn\":\"524-83-3550\"},{\"age\":39,\"email\":\"hgxz@mycompany.com\",\"employee_id\":1010,\"first_name\":\"Byrann\",\"gender\":\"female\",\"hourly_rate\":13,\"last_name\":\"Zuker\",\"ssn\":\"608-15-9492\"},{\"age\":46,\"email\":\"bnhl@mycompany.com\",\"employee_id\":1011,\"first_name\":\"Egon\",\"gender\":\"female\",\"hourly_rate\":24,\"last_name\":\"Bettles\",\"ssn\":\"455-48-4428\"},{\"age\":35,\"email\":\"yxpu@mycompany.com\",\"employee_id\":1012,\"first_name\":\"Faye\",\"gender\":\"female\",\"hourly_rate\":17,\"last_name\":\"Mcall\",\"ssn\":\"967-90-4356\"},{\"age\":43,\"email\":\"yofv@mycompany.com\",\"employee_id\":1013,\"first_name\":\"Lucais\",\"gender\":\"male\",\"hourly_rate\":24,\"last_name\":\"Mears\",\"ssn\":\"378-20-1991\"},{\"age\":41,\"email\":\"alln@mycompany.com\",\"employee_id\":1014,\"first_name\":\"Frieda\",\"gender\":\"female\",\"hourly_rate\":22,\"last_name\":\"Rocco\",\"ssn\":\"401-12-7473\"},{\"age\":34,\"email\":\"feym@mycompany.com\",\"employee_id\":1015,\"first_name\":\"Marchall\",\"gender\":\"male\",\"hourly_rate\":20,\"last_name\":\"Ottiwill\",\"ssn\":\"989-47-6666\"},{\"age\":36,\"email\":\"uflo@mycompany.com\",\"employee_id\":1016,\"first_name\":\"Raychel\",\"gender\":\"male\",\"hourly_rate\":17,\"last_name\":\"Cleugher\",\"ssn\":\"859-19-5275\"},{\"age\":39,\"email\":\"nkkb@mycompany.com\",\"employee_id\":1017,\"first_name\":\"Lea\",\"gender\":\"female\",\"hourly_rate\":18,\"last_name\":\"Hobben\",\"ssn\":\"848-02-9978\"},{\"age\":48,\"email\":\"ecec@mycompany.com\",\"employee_id\":1018,\"first_name\":\"Sonnie\",\"gender\":\"male\",\"hourly_rate\":21,\"last_name\":\"Woolfall\",\"ssn\":\"211-34-6636\"},{\"age\":31,\"email\":\"apun@mycompany.com\",\"employee_id\":1019,\"first_name\":\"Derk\",\"gender\":\"female\",\"hourly_rate\":10,\"last_name\":\"Labba\",\"ssn\":\"628-39-7556\"},{\"age\":44,\"email\":\"nyse@mycompany.com\",\"employee_id\":1020,\"first_name\":\"Johanna\",\"gender\":\"female\",\"hourly_rate\":22,\"last_name\":\"Wren\",\"ssn\":\"544-75-7207\"},{\"age\":38,\"email\":\"ygrg@mycompany.com\",\"employee_id\":1021,\"first_name\":\"Barnett\",\"gender\":\"male\",\"hourly_rate\":20,\"last_name\":\"Graveson\",\"ssn\":\"238-81-9399\"},{\"age\":34,\"email\":\"gidb@mycompany.com\",\"employee_id\":1022,\"first_name\":\"Trent\",\"gender\":\"male\",\"hourly_rate\":22,\"last_name\":\"Broadbridge\",\"ssn\":\"928-07-0451\"},{\"age\":47,\"email\":\"mkoz@mycompany.com\",\"employee_id\":1023,\"first_name\":\"Cyril\",\"gender\":\"female\",\"hourly_rate\":13,\"last_name\":\"Rylatt\",\"ssn\":\"100-38-8723\"},{\"age\":44,\"email\":\"yezj@mycompany.com\",\"employee_id\":1024,\"first_name\":\"Johanna\",\"gender\":\"male\",\"hourly_rate\":23,\"last_name\":\"Murrish\",\"ssn\":\"612-61-9477\"},{\"age\":39,\"email\":\"govs@mycompany.com\",\"employee_id\":1025,\"first_name\":\"Byrann\",\"gender\":\"female\",\"hourly_rate\":18,\"last_name\":\"Woolfall\",\"ssn\":\"889-10-6161\"},{\"age\":36,\"email\":\"cruw@mycompany.com\",\"employee_id\":1026,\"first_name\":\"Derk\",\"gender\":\"male\",\"hourly_rate\":24,\"last_name\":\"Baldi\",\"ssn\":\"929-39-7920\"},{\"age\":37,\"email\":\"mwic@mycompany.com\",\"employee_id\":1027,\"first_name\":\"Matt\",\"gender\":\"male\",\"hourly_rate\":10,\"last_name\":\"Vockins\",\"ssn\":\"174-48-7138\"},{\"age\":46,\"email\":\"vklt@mycompany.com\",\"employee_id\":1028,\"first_name\":\"Faye\",\"gender\":\"male\",\"hourly_rate\":17,\"last_name\":\"Barock\",\"ssn\":\"495-35-5641\"},{\"age\":41,\"email\":\"rbvg@mycompany.com\",\"employee_id\":1029,\"first_name\":\"Carleton\",\"gender\":\"male\",\"hourly_rate\":18,\"last_name\":\"Ridgley\",\"ssn\":\"172-35-4720\"},{\"age\":41,\"email\":\"mtnj@mycompany.com\",\"employee_id\":1030,\"first_name\":\"Derk\",\"gender\":\"female\",\"hourly_rate\":10,\"last_name\":\"Ridgley\",\"ssn\":\"317-43-5426\"},{\"age\":33,\"email\":\"ojkl@mycompany.com\",\"employee_id\":1031,\"first_name\":\"Trent\",\"gender\":\"female\",\"hourly_rate\":8,\"last_name\":\"Milazzo\",\"ssn\":\"435-51-6785\"},{\"age\":49,\"email\":\"zasw@mycompany.com\",\"employee_id\":1032,\"first_name\":\"Lucais\",\"gender\":\"male\",\"hourly_rate\":12,\"last_name\":\"Haskell\",\"ssn\":\"598-73-8837\"},{\"age\":32,\"email\":\"jyum@mycompany.com\",\"employee_id\":1033,\"first_name\":\"Avis\",\"gender\":\"female\",\"hourly_rate\":20,\"last_name\":\"Wren\",\"ssn\":\"215-96-0693\"},{\"age\":38,\"email\":\"gbce@mycompany.com\",\"employee_id\":1034,\"first_name\":\"Sibyl\",\"gender\":\"female\",\"hourly_rate\":11,\"last_name\":\"Guildford\",\"ssn\":\"811-14-9013\"},{\"age\":34,\"email\":\"bcgy@mycompany.com\",\"employee_id\":1035,\"first_name\":\"Raychel\",\"gender\":\"female\",\"hourly_rate\":19,\"last_name\":\"MacVay\",\"ssn\":\"991-62-5231\"},{\"age\":32,\"email\":\"fyzt@mycompany.com\",\"employee_id\":1036,\"first_name\":\"Winslow\",\"gender\":\"female\",\"hourly_rate\":19,\"last_name\":\"Beagan\",\"ssn\":\"884-20-3190\"},{\"age\":36,\"email\":\"erpx@mycompany.com\",\"employee_id\":1037,\"first_name\":\"Robyn\",\"gender\":\"female\",\"hourly_rate\":15,\"last_name\":\"Westhofer\",\"ssn\":\"433-18-5627\"},{\"age\":48,\"email\":\"dshv@mycompany.com\",\"employee_id\":1038,\"first_name\":\"Lurline\",\"gender\":\"female\",\"hourly_rate\":21,\"last_name\":\"Woolfall\",\"ssn\":\"153-88-4840\"},{\"age\":38,\"email\":\"vahe@mycompany.com\",\"employee_id\":1039,\"first_name\":\"Electra\",\"gender\":\"male\",\"hourly_rate\":15,\"last_name\":\"MacVay\",\"ssn\":\"906-28-8038\"},{\"age\":45,\"email\":\"grhs@mycompany.com\",\"employee_id\":1040,\"first_name\":\"Babara\",\"gender\":\"female\",\"hourly_rate\":18,\"last_name\":\"Rosensaft\",\"ssn\":\"732-77-6755\"},{\"age\":42,\"email\":\"rven@mycompany.com\",\"employee_id\":1041,\"first_name\":\"Gerda\",\"gender\":\"female\",\"hourly_rate\":9,\"last_name\":\"Cleugher\",\"ssn\":\"904-94-1504\"},{\"age\":42,\"email\":\"ynxr@mycompany.com\",\"employee_id\":1042,\"first_name\":\"Charley\",\"gender\":\"female\",\"hourly_rate\":17,\"last_name\":\"Lezemere\",\"ssn\":\"869-37-8441\"},{\"age\":49,\"email\":\"ocpi@mycompany.com\",\"employee_id\":1043,\"first_name\":\"Dur\",\"gender\":\"female\",\"hourly_rate\":18,\"last_name\":\"Klemt\",\"ssn\":\"091-49-9989\"},{\"age\":47,\"email\":\"xiyy@mycompany.com\",\"employee_id\":1044,\"first_name\":\"Sonnie\",\"gender\":\"male\",\"hourly_rate\":22,\"last_name\":\"Lezemere\",\"ssn\":\"458-96-3638\"},{\"age\":38,\"email\":\"jcex@mycompany.com\",\"employee_id\":1045,\"first_name\":\"Quint\",\"gender\":\"male\",\"hourly_rate\":11,\"last_name\":\"Beckwith\",\"ssn\":\"262-57-5599\"},{\"age\":35,\"email\":\"mvcx@mycompany.com\",\"employee_id\":1046,\"first_name\":\"Electra\",\"gender\":\"male\",\"hourly_rate\":11,\"last_name\":\"Bidgod\",\"ssn\":\"753-51-8847\"},{\"age\":37,\"email\":\"dlow@mycompany.com\",\"employee_id\":1047,\"first_name\":\"Frieda\",\"gender\":\"male\",\"hourly_rate\":15,\"last_name\":\"Dudill\",\"ssn\":\"364-67-4057\"},{\"age\":44,\"email\":\"uovu@mycompany.com\",\"employee_id\":1048,\"first_name\":\"Aryn\",\"gender\":\"male\",\"hourly_rate\":21,\"last_name\":\"Rocco\",\"ssn\":\"730-69-3872\"},{\"age\":44,\"email\":\"vqyh@mycompany.com\",\"employee_id\":1049,\"first_name\":\"Frieda\",\"gender\":\"male\",\"hourly_rate\":12,\"last_name\":\"Tuma\",\"ssn\":\"696-95-5025\"},{\"age\":31,\"email\":\"voel@mycompany.com\",\"employee_id\":1050,\"first_name\":\"Trev\",\"gender\":\"male\",\"hourly_rate\":22,\"last_name\":\"Napton\",\"ssn\":\"770-11-4815\"},{\"age\":43,\"email\":\"ugiz@mycompany.com\",\"employee_id\":1051,\"first_name\":\"Jere\",\"gender\":\"female\",\"hourly_rate\":9,\"last_name\":\"Rosensaft\",\"ssn\":\"593-18-2315\"},{\"age\":39,\"email\":\"lcfy@mycompany.com\",\"employee_id\":1052,\"first_name\":\"Sibyl\",\"gender\":\"female\",\"hourly_rate\":20,\"last_name\":\"Nayshe\",\"ssn\":\"229-81-4143\"},{\"age\":42,\"email\":\"hspi@mycompany.com\",\"employee_id\":1053,\"first_name\":\"Talbot\",\"gender\":\"male\",\"hourly_rate\":14,\"last_name\":\"Coll\",\"ssn\":\"397-54-1060\"},{\"age\":48,\"email\":\"dxwi@mycompany.com\",\"employee_id\":1054,\"first_name\":\"Adele\",\"gender\":\"male\",\"hourly_rate\":13,\"last_name\":\"Zuker\",\"ssn\":\"053-08-6877\"},{\"age\":48,\"email\":\"ovoz@mycompany.com\",\"employee_id\":1055,\"first_name\":\"Gustave\",\"gender\":\"male\",\"hourly_rate\":12,\"last_name\":\"Lezemere\",\"ssn\":\"632-36-0913\"},{\"age\":32,\"email\":\"cxrr@mycompany.com\",\"employee_id\":1056,\"first_name\":\"Cherrita\",\"gender\":\"male\",\"hourly_rate\":9,\"last_name\":\"Lezemere\",\"ssn\":\"920-73-3034\"},{\"age\":34,\"email\":\"ymov@mycompany.com\",\"employee_id\":1057,\"first_name\":\"Dur\",\"gender\":\"female\",\"hourly_rate\":22,\"last_name\":\"Beaument\",\"ssn\":\"367-26-8343\"},{\"age\":49,\"email\":\"atfe@mycompany.com\",\"employee_id\":1058,\"first_name\":\"Livvie\",\"gender\":\"female\",\"hourly_rate\":16,\"last_name\":\"Smewings\",\"ssn\":\"300-99-5551\"},{\"age\":49,\"email\":\"dwxm@mycompany.com\",\"employee_id\":1059,\"first_name\":\"Karena\",\"gender\":\"male\",\"hourly_rate\":23,\"last_name\":\"Bainbridge\",\"ssn\":\"960-91-6169\"},{\"age\":30,\"email\":\"qvfv@mycompany.com\",\"employee_id\":1060,\"first_name\":\"Trev\",\"gender\":\"female\",\"hourly_rate\":17,\"last_name\":\"Beaument\",\"ssn\":\"172-28-3691\"},{\"age\":48,\"email\":\"fpaz@mycompany.com\",\"employee_id\":1061,\"first_name\":\"Avis\",\"gender\":\"female\",\"hourly_rate\":9,\"last_name\":\"Borge\",\"ssn\":\"476-07-4335\"},{\"age\":31,\"email\":\"qzkg@mycompany.com\",\"employee_id\":1062,\"first_name\":\"Vergil\",\"gender\":\"male\",\"hourly_rate\":20,\"last_name\":\"Foulsham\",\"ssn\":\"713-65-6480\"},{\"age\":37,\"email\":\"ezdw@mycompany.com\",\"employee_id\":1063,\"first_name\":\"Robyn\",\"gender\":\"female\",\"hourly_rate\":21,\"last_name\":\"Haskell\",\"ssn\":\"209-24-6869\"},{\"age\":37,\"email\":\"ulct@mycompany.com\",\"employee_id\":1064,\"first_name\":\"Pattin\",\"gender\":\"male\",\"hourly_rate\":17,\"last_name\":\"Moyler\",\"ssn\":\"023-00-7370\"},{\"age\":40,\"email\":\"sbwf@mycompany.com\",\"employee_id\":1065,\"first_name\":\"Sonnie\",\"gender\":\"male\",\"hourly_rate\":11,\"last_name\":\"Tenbrug\",\"ssn\":\"739-69-6275\"},{\"age\":31,\"email\":\"juba@mycompany.com\",\"employee_id\":1066,\"first_name\":\"Talbot\",\"gender\":\"male\",\"hourly_rate\":20,\"last_name\":\"Milazzo\",\"ssn\":\"080-46-2275\"},{\"age\":31,\"email\":\"hcln@mycompany.com\",\"employee_id\":1067,\"first_name\":\"Trumann\",\"gender\":\"female\",\"hourly_rate\":12,\"last_name\":\"Coll\",\"ssn\":\"343-16-9551\"},{\"age\":37,\"email\":\"iwpx@mycompany.com\",\"employee_id\":1068,\"first_name\":\"Andriette\",\"gender\":\"male\",\"hourly_rate\":12,\"last_name\":\"Starcks\",\"ssn\":\"658-51-1241\"},{\"age\":39,\"email\":\"jfik@mycompany.com\",\"employee_id\":1069,\"first_name\":\"Lea\",\"gender\":\"male\",\"hourly_rate\":18,\"last_name\":\"Hobben\",\"ssn\":\"842-28-9022\"},{\"age\":47,\"email\":\"sqyg@mycompany.com\",\"employee_id\":1070,\"first_name\":\"Barnett\",\"gender\":\"female\",\"hourly_rate\":10,\"last_name\":\"Bidgod\",\"ssn\":\"860-14-7110\"},{\"age\":38,\"email\":\"yqkb@mycompany.com\",\"employee_id\":1071,\"first_name\":\"West\",\"gender\":\"female\",\"hourly_rate\":8,\"last_name\":\"Milazzo\",\"ssn\":\"449-28-4678\"},{\"age\":41,\"email\":\"oowf@mycompany.com\",\"employee_id\":1072,\"first_name\":\"Avis\",\"gender\":\"female\",\"hourly_rate\":12,\"last_name\":\"Mears\",\"ssn\":\"164-80-2955\"},{\"age\":41,\"email\":\"dmmi@mycompany.com\",\"employee_id\":1073,\"first_name\":\"Robyn\",\"gender\":\"male\",\"hourly_rate\":15,\"last_name\":\"Rylatt\",\"ssn\":\"062-56-4978\"},{\"age\":30,\"email\":\"ozkd@mycompany.com\",\"employee_id\":1074,\"first_name\":\"Giacobo\",\"gender\":\"male\",\"hourly_rate\":23,\"last_name\":\"Mayhow\",\"ssn\":\"960-65-6801\"},{\"age\":33,\"email\":\"nhlm@mycompany.com\",\"employee_id\":1075,\"first_name\":\"Giacobo\",\"gender\":\"female\",\"hourly_rate\":22,\"last_name\":\"MacVay\",\"ssn\":\"801-57-0746\"},{\"age\":41,\"email\":\"mzfb@mycompany.com\",\"employee_id\":1076,\"first_name\":\"Germayne\",\"gender\":\"female\",\"hourly_rate\":10,\"last_name\":\"Bainbridge\",\"ssn\":\"226-28-2222\"},{\"age\":43,\"email\":\"jbpl@mycompany.com\",\"employee_id\":1077,\"first_name\":\"Alis\",\"gender\":\"female\",\"hourly_rate\":24,\"last_name\":\"Vockins\",\"ssn\":\"997-17-4419\"},{\"age\":49,\"email\":\"pgwd@mycompany.com\",\"employee_id\":1078,\"first_name\":\"Caria\",\"gender\":\"male\",\"hourly_rate\":18,\"last_name\":\"Hobben\",\"ssn\":\"438-17-3464\"},{\"age\":38,\"email\":\"eska@mycompany.com\",\"employee_id\":1079,\"first_name\":\"Talbot\",\"gender\":\"female\",\"hourly_rate\":14,\"last_name\":\"Eringey\",\"ssn\":\"416-10-1590\"},{\"age\":43,\"email\":\"tbeg@mycompany.com\",\"employee_id\":1080,\"first_name\":\"Simona\",\"gender\":\"female\",\"hourly_rate\":19,\"last_name\":\"Gookey\",\"ssn\":\"742-79-2261\"},{\"age\":48,\"email\":\"jpbi@mycompany.com\",\"employee_id\":1081,\"first_name\":\"Sheridan\",\"gender\":\"male\",\"hourly_rate\":23,\"last_name\":\"Lezemere\",\"ssn\":\"674-68-7406\"},{\"age\":49,\"email\":\"ihxq@mycompany.com\",\"employee_id\":1082,\"first_name\":\"Nikolai\",\"gender\":\"male\",\"hourly_rate\":15,\"last_name\":\"Fewings\",\"ssn\":\"662-14-4672\"},{\"age\":33,\"email\":\"lzrf@mycompany.com\",\"employee_id\":1083,\"first_name\":\"Winslow\",\"gender\":\"male\",\"hourly_rate\":14,\"last_name\":\"Murfill\",\"ssn\":\"536-57-7029\"},{\"age\":32,\"email\":\"ygfg@mycompany.com\",\"employee_id\":1084,\"first_name\":\"Constantin\",\"gender\":\"male\",\"hourly_rate\":8,\"last_name\":\"Ballin\",\"ssn\":\"422-62-7803\"},{\"age\":49,\"email\":\"cfpl@mycompany.com\",\"employee_id\":1085,\"first_name\":\"Lea\",\"gender\":\"female\",\"hourly_rate\":9,\"last_name\":\"Wren\",\"ssn\":\"825-03-0834\"},{\"age\":44,\"email\":\"phju@mycompany.com\",\"employee_id\":1086,\"first_name\":\"Giacobo\",\"gender\":\"female\",\"hourly_rate\":13,\"last_name\":\"Hawyes\",\"ssn\":\"611-82-8402\"},{\"age\":31,\"email\":\"chst@mycompany.com\",\"employee_id\":1087,\"first_name\":\"Livvie\",\"gender\":\"female\",\"hourly_rate\":24,\"last_name\":\"Guildford\",\"ssn\":\"016-14-4716\"},{\"age\":42,\"email\":\"kpum@mycompany.com\",\"employee_id\":1088,\"first_name\":\"West\",\"gender\":\"female\",\"hourly_rate\":8,\"last_name\":\"Klemt\",\"ssn\":\"307-27-8393\"},{\"age\":30,\"email\":\"gpbe@mycompany.com\",\"employee_id\":1089,\"first_name\":\"Anatollo\",\"gender\":\"female\",\"hourly_rate\":13,\"last_name\":\"Henderson\",\"ssn\":\"547-89-0756\"},{\"age\":39,\"email\":\"awns@mycompany.com\",\"employee_id\":1090,\"first_name\":\"Caria\",\"gender\":\"male\",\"hourly_rate\":19,\"last_name\":\"Murfill\",\"ssn\":\"968-92-5521\"},{\"age\":49,\"email\":\"ickd@mycompany.com\",\"employee_id\":1091,\"first_name\":\"Trent\",\"gender\":\"female\",\"hourly_rate\":17,\"last_name\":\"Napton\",\"ssn\":\"131-10-2192\"},{\"age\":38,\"email\":\"hevl@mycompany.com\",\"employee_id\":1092,\"first_name\":\"Chelsae\",\"gender\":\"female\",\"hourly_rate\":21,\"last_name\":\"Ballin\",\"ssn\":\"929-64-1842\"},{\"age\":37,\"email\":\"kcms@mycompany.com\",\"employee_id\":1093,\"first_name\":\"Rossie\",\"gender\":\"female\",\"hourly_rate\":15,\"last_name\":\"Gwyther\",\"ssn\":\"675-97-3680\"},{\"age\":41,\"email\":\"xjkz@mycompany.com\",\"employee_id\":1094,\"first_name\":\"Sonnie\",\"gender\":\"male\",\"hourly_rate\":9,\"last_name\":\"Smewings\",\"ssn\":\"841-57-1504\"},{\"age\":35,\"email\":\"jpji@mycompany.com\",\"employee_id\":1095,\"first_name\":\"Jeremy\",\"gender\":\"female\",\"hourly_rate\":8,\"last_name\":\"MacFadzean\",\"ssn\":\"847-82-0071\"},{\"age\":47,\"email\":\"cevc@mycompany.com\",\"employee_id\":1096,\"first_name\":\"Jere\",\"gender\":\"female\",\"hourly_rate\":11,\"last_name\":\"Coll\",\"ssn\":\"427-07-7019\"},{\"age\":44,\"email\":\"ftpk@mycompany.com\",\"employee_id\":1097,\"first_name\":\"Andriette\",\"gender\":\"male\",\"hourly_rate\":16,\"last_name\":\"Broadbridge\",\"ssn\":\"342-03-4896\"},{\"age\":33,\"email\":\"bcrr@mycompany.com\",\"employee_id\":1098,\"first_name\":\"Brenna\",\"gender\":\"female\",\"hourly_rate\":10,\"last_name\":\"Cleugher\",\"ssn\":\"874-68-3535\"},{\"age\":37,\"email\":\"bmvb@mycompany.com\",\"employee_id\":1099,\"first_name\":\"Trumann\",\"gender\":\"male\",\"hourly_rate\":9,\"last_name\":\"Graveson\",\"ssn\":\"345-99-5761\"}]},\"fields\":[{\"name\":\"employee_id\",\"type\":\"int\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"},{\"name\":\"age\",\"type\":\"int\"},{\"name\":\"ssn\",\"type\":\"string\"},{\"name\":\"hourly_rate\",\"type\":\"int\"},{\"name\":\"gender\",\"type\":\"string\"},{\"name\":\"email\",\"type\":\"string\"}],\"name\":\"payroll.PayrollEmployee\",\"type\":\"record\"}" +} + +func (r PayrollEmployee) SchemaName() string { + return "payroll.PayrollEmployee" +} + +func (_ PayrollEmployee) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetInt(v int32) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetLong(v int64) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetString(v string) { panic("Unsupported operation") } +func (_ PayrollEmployee) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PayrollEmployee) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Employee_id} + + return w + + case 1: + w := types.String{Target: &r.First_name} + + return w + + case 2: + w := types.String{Target: &r.Last_name} + + return w + + case 3: + w := types.Int{Target: &r.Age} + + return w + + case 4: + w := types.String{Target: &r.Ssn} + + return w + + case 5: + w := types.Int{Target: &r.Hourly_rate} + + return w + + case 6: + w := types.String{Target: &r.Gender} + + return w + + case 7: + w := types.String{Target: &r.Email} + + return w + + } + panic("Unknown field index") +} + +func (r *PayrollEmployee) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PayrollEmployee) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PayrollEmployee) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PayrollEmployee) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PayrollEmployee) HintSize(int) { panic("Unsupported operation") } +func (_ PayrollEmployee) Finalize() {} + +func (_ PayrollEmployee) AvroCRC64Fingerprint() []byte { + return []byte(PayrollEmployeeAvroCRC64Fingerprint) +} + +func (r PayrollEmployee) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["employee_id"], err = json.Marshal(r.Employee_id) + if err != nil { + return nil, err + } + output["first_name"], err = json.Marshal(r.First_name) + if err != nil { + return nil, err + } + output["last_name"], err = json.Marshal(r.Last_name) + if err != nil { + return nil, err + } + output["age"], err = json.Marshal(r.Age) + if err != nil { + return nil, err + } + output["ssn"], err = json.Marshal(r.Ssn) + if err != nil { + return nil, err + } + output["hourly_rate"], err = json.Marshal(r.Hourly_rate) + if err != nil { + return nil, err + } + output["gender"], err = json.Marshal(r.Gender) + if err != nil { + return nil, err + } + output["email"], err = json.Marshal(r.Email) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PayrollEmployee) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["employee_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Employee_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for employee_id") + } + val = func() json.RawMessage { + if v, ok := fields["first_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.First_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for first_name") + } + val = func() json.RawMessage { + if v, ok := fields["last_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Last_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for last_name") + } + val = func() json.RawMessage { + if v, ok := fields["age"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Age); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for age") + } + val = func() json.RawMessage { + if v, ok := fields["ssn"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ssn); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ssn") + } + val = func() json.RawMessage { + if v, ok := fields["hourly_rate"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Hourly_rate); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for hourly_rate") + } + val = func() json.RawMessage { + if v, ok := fields["gender"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Gender); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for gender") + } + val = func() json.RawMessage { + if v, ok := fields["email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for email") + } + return nil +} diff --git a/pkg/types/payroll_employee_location.go b/pkg/types/payroll_employee_location.go new file mode 100644 index 00000000..c04fb009 --- /dev/null +++ b/pkg/types/payroll_employee_location.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PayrollEmployeeLocation struct { + Employee_id int32 `json:"employee_id"` + + Lab string `json:"lab"` + + Department_id int32 `json:"department_id"` + + Arrival_date int32 `json:"arrival_date"` +} + +const PayrollEmployeeLocationAvroCRC64Fingerprint = "\x936؇ur\x00(" + +func NewPayrollEmployeeLocation() PayrollEmployeeLocation { + r := PayrollEmployeeLocation{} + return r +} + +func DeserializePayrollEmployeeLocation(r io.Reader) (PayrollEmployeeLocation, error) { + t := NewPayrollEmployeeLocation() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePayrollEmployeeLocationFromSchema(r io.Reader, schema string) (PayrollEmployeeLocation, error) { + t := NewPayrollEmployeeLocation() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePayrollEmployeeLocation(r PayrollEmployeeLocation, w io.Writer) error { + var err error + err = vm.WriteInt(r.Employee_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Lab, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Department_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Arrival_date, w) + if err != nil { + return err + } + return err +} + +func (r PayrollEmployeeLocation) Serialize(w io.Writer) error { + return writePayrollEmployeeLocation(r, w) +} + +func (r PayrollEmployeeLocation) Schema() string { + return "{\"fields\":[{\"name\":\"employee_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1100,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"lab\",\"type\":{\"arg.properties\":{\"regex\":\"lab-\\\\d{1}\"},\"type\":\"string\"}},{\"name\":\"department_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":1}},\"type\":\"int\"}},{\"name\":\"arrival_date\",\"type\":{\"arg.properties\":{\"range\":{\"max\":19000,\"min\":18000}},\"logicalType\":\"date\",\"type\":\"int\"}}],\"name\":\"payroll.PayrollEmployeeLocation\",\"type\":\"record\"}" +} + +func (r PayrollEmployeeLocation) SchemaName() string { + return "payroll.PayrollEmployeeLocation" +} + +func (_ PayrollEmployeeLocation) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetInt(v int32) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetLong(v int64) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetString(v string) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PayrollEmployeeLocation) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Employee_id} + + return w + + case 1: + w := types.String{Target: &r.Lab} + + return w + + case 2: + w := types.Int{Target: &r.Department_id} + + return w + + case 3: + w := types.Int{Target: &r.Arrival_date} + + return w + + } + panic("Unknown field index") +} + +func (r *PayrollEmployeeLocation) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PayrollEmployeeLocation) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PayrollEmployeeLocation) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) HintSize(int) { panic("Unsupported operation") } +func (_ PayrollEmployeeLocation) Finalize() {} + +func (_ PayrollEmployeeLocation) AvroCRC64Fingerprint() []byte { + return []byte(PayrollEmployeeLocationAvroCRC64Fingerprint) +} + +func (r PayrollEmployeeLocation) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["employee_id"], err = json.Marshal(r.Employee_id) + if err != nil { + return nil, err + } + output["lab"], err = json.Marshal(r.Lab) + if err != nil { + return nil, err + } + output["department_id"], err = json.Marshal(r.Department_id) + if err != nil { + return nil, err + } + output["arrival_date"], err = json.Marshal(r.Arrival_date) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PayrollEmployeeLocation) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["employee_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Employee_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for employee_id") + } + val = func() json.RawMessage { + if v, ok := fields["lab"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Lab); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for lab") + } + val = func() json.RawMessage { + if v, ok := fields["department_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Department_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for department_id") + } + val = func() json.RawMessage { + if v, ok := fields["arrival_date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Arrival_date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for arrival_date") + } + return nil +} diff --git a/pkg/types/pizzastore_order.go b/pkg/types/pizzastore_order.go new file mode 100644 index 00000000..d0d56206 --- /dev/null +++ b/pkg/types/pizzastore_order.go @@ -0,0 +1,339 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PizzastoreOrder struct { + Store_id int32 `json:"store_id"` + + Store_order_id int32 `json:"store_order_id"` + + Coupon_code int32 `json:"coupon_code"` + + Date int32 `json:"date"` + + Status string `json:"status"` + + Orderlines []Orderline `json:"orderlines"` +} + +const PizzastoreOrderAvroCRC64Fingerprint = "ux\xc9\xcaq\x9d@\x9a" + +func NewPizzastoreOrder() PizzastoreOrder { + r := PizzastoreOrder{} + r.Orderlines = make([]Orderline, 0) + + return r +} + +func DeserializePizzastoreOrder(r io.Reader) (PizzastoreOrder, error) { + t := NewPizzastoreOrder() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePizzastoreOrderFromSchema(r io.Reader, schema string) (PizzastoreOrder, error) { + t := NewPizzastoreOrder() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePizzastoreOrder(r PizzastoreOrder, w io.Writer) error { + var err error + err = vm.WriteInt(r.Store_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Store_order_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Coupon_code, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Date, w) + if err != nil { + return err + } + err = vm.WriteString(r.Status, w) + if err != nil { + return err + } + err = writeArrayOrderline(r.Orderlines, w) + if err != nil { + return err + } + return err +} + +func (r PizzastoreOrder) Serialize(w io.Writer) error { + return writePizzastoreOrder(r, w) +} + +func (r PizzastoreOrder) Schema() string { + return "{\"fields\":[{\"name\":\"store_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":1}},\"type\":\"int\"}},{\"name\":\"store_order_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1000,\"step\":1}},\"type\":\"int\"}},{\"name\":\"coupon_code\",\"type\":{\"arg.properties\":{\"range\":{\"max\":2000,\"min\":1000}},\"type\":\"int\"}},{\"name\":\"date\",\"type\":{\"arg.properties\":{\"range\":{\"max\":19000,\"min\":18000}},\"logicalType\":\"date\",\"type\":\"int\"}},{\"name\":\"status\",\"type\":{\"arg.properties\":{\"options\":[\"accepted\"]},\"type\":\"string\"}},{\"name\":\"orderlines\",\"type\":{\"arg.properties\":{\"length\":{\"max\":5,\"min\":1}},\"items\":{\"arg.properties\":{\"options\":[{\"category\":\"calzone\",\"net_price\":75.12,\"product_id\":66,\"quantity\":4,\"unit_price\":18.78},{\"category\":\"salad\",\"net_price\":19.6,\"product_id\":71,\"quantity\":4,\"unit_price\":4.9},{\"category\":\"pizza\",\"net_price\":58.83,\"product_id\":79,\"quantity\":3,\"unit_price\":19.61},{\"category\":\"calzone\",\"net_price\":26.1,\"product_id\":38,\"quantity\":2,\"unit_price\":13.05},{\"category\":\"calzone\",\"net_price\":17.37,\"product_id\":26,\"quantity\":1,\"unit_price\":17.37},{\"category\":\"calzone\",\"net_price\":73.89,\"product_id\":66,\"quantity\":3,\"unit_price\":24.63},{\"category\":\"dessert\",\"net_price\":63.42,\"product_id\":62,\"quantity\":3,\"unit_price\":21.14},{\"category\":\"salad\",\"net_price\":63.39,\"product_id\":68,\"quantity\":3,\"unit_price\":21.13},{\"category\":\"salad\",\"net_price\":16.92,\"product_id\":72,\"quantity\":2,\"unit_price\":8.46},{\"category\":\"calzone\",\"net_price\":7.2,\"product_id\":55,\"quantity\":2,\"unit_price\":3.6},{\"category\":\"pizza\",\"net_price\":76.04,\"product_id\":77,\"quantity\":4,\"unit_price\":19.01},{\"category\":\"pizza\",\"net_price\":4.47,\"product_id\":60,\"quantity\":3,\"unit_price\":1.49},{\"category\":\"dessert\",\"net_price\":69.99,\"product_id\":8,\"quantity\":3,\"unit_price\":23.33},{\"category\":\"calzone\",\"net_price\":44.96,\"product_id\":91,\"quantity\":4,\"unit_price\":11.24},{\"category\":\"pizza\",\"net_price\":22.9,\"product_id\":78,\"quantity\":2,\"unit_price\":11.45},{\"category\":\"dessert\",\"net_price\":66.06,\"product_id\":27,\"quantity\":3,\"unit_price\":22.02},{\"category\":\"salad\",\"net_price\":9.88,\"product_id\":58,\"quantity\":1,\"unit_price\":9.88},{\"category\":\"dessert\",\"net_price\":98.76,\"product_id\":9,\"quantity\":4,\"unit_price\":24.69},{\"category\":\"salad\",\"net_price\":12.62,\"product_id\":77,\"quantity\":1,\"unit_price\":12.62},{\"category\":\"wings\",\"net_price\":6.63,\"product_id\":27,\"quantity\":3,\"unit_price\":2.21},{\"category\":\"calzone\",\"net_price\":19.04,\"product_id\":4,\"quantity\":1,\"unit_price\":19.04},{\"category\":\"calzone\",\"net_price\":16.38,\"product_id\":48,\"quantity\":1,\"unit_price\":16.38},{\"category\":\"dessert\",\"net_price\":46.2,\"product_id\":26,\"quantity\":5,\"unit_price\":9.24},{\"category\":\"pizza\",\"net_price\":80.45,\"product_id\":75,\"quantity\":5,\"unit_price\":16.09},{\"category\":\"salad\",\"net_price\":32.64,\"product_id\":33,\"quantity\":3,\"unit_price\":10.88},{\"category\":\"calzone\",\"net_price\":113.2,\"product_id\":45,\"quantity\":5,\"unit_price\":22.64},{\"category\":\"dessert\",\"net_price\":13.15,\"product_id\":65,\"quantity\":5,\"unit_price\":2.63},{\"category\":\"wings\",\"net_price\":5.68,\"product_id\":52,\"quantity\":1,\"unit_price\":5.68},{\"category\":\"pizza\",\"net_price\":16.47,\"product_id\":23,\"quantity\":3,\"unit_price\":5.49},{\"category\":\"dessert\",\"net_price\":3.02,\"product_id\":67,\"quantity\":1,\"unit_price\":3.02},{\"category\":\"dessert\",\"net_price\":66.76,\"product_id\":71,\"quantity\":4,\"unit_price\":16.69},{\"category\":\"salad\",\"net_price\":51.21,\"product_id\":69,\"quantity\":3,\"unit_price\":17.07},{\"category\":\"pizza\",\"net_price\":46.2,\"product_id\":41,\"quantity\":4,\"unit_price\":11.55},{\"category\":\"wings\",\"net_price\":13.18,\"product_id\":44,\"quantity\":2,\"unit_price\":6.59},{\"category\":\"wings\",\"net_price\":33.08,\"product_id\":66,\"quantity\":2,\"unit_price\":16.54},{\"category\":\"calzone\",\"net_price\":60.35,\"product_id\":8,\"quantity\":5,\"unit_price\":12.07},{\"category\":\"salad\",\"net_price\":69.5,\"product_id\":43,\"quantity\":5,\"unit_price\":13.9},{\"category\":\"calzone\",\"net_price\":101.5,\"product_id\":13,\"quantity\":5,\"unit_price\":20.3},{\"category\":\"salad\",\"net_price\":83.05,\"product_id\":65,\"quantity\":5,\"unit_price\":16.61},{\"category\":\"dessert\",\"net_price\":4.18,\"product_id\":48,\"quantity\":1,\"unit_price\":4.18},{\"category\":\"calzone\",\"net_price\":17.22,\"product_id\":59,\"quantity\":3,\"unit_price\":5.74},{\"category\":\"calzone\",\"net_price\":15.65,\"product_id\":42,\"quantity\":1,\"unit_price\":15.65},{\"category\":\"calzone\",\"net_price\":13.95,\"product_id\":22,\"quantity\":5,\"unit_price\":2.79},{\"category\":\"pizza\",\"net_price\":30.7,\"product_id\":47,\"quantity\":2,\"unit_price\":15.35},{\"category\":\"salad\",\"net_price\":124.85,\"product_id\":72,\"quantity\":5,\"unit_price\":24.97},{\"category\":\"salad\",\"net_price\":2.85,\"product_id\":60,\"quantity\":1,\"unit_price\":2.85},{\"category\":\"dessert\",\"net_price\":1.24,\"product_id\":58,\"quantity\":1,\"unit_price\":1.24},{\"category\":\"calzone\",\"net_price\":96,\"product_id\":88,\"quantity\":4,\"unit_price\":24},{\"category\":\"wings\",\"net_price\":6.66,\"product_id\":98,\"quantity\":1,\"unit_price\":6.66},{\"category\":\"pizza\",\"net_price\":43.86,\"product_id\":37,\"quantity\":3,\"unit_price\":14.62},{\"category\":\"calzone\",\"net_price\":42.63,\"product_id\":37,\"quantity\":3,\"unit_price\":14.21},{\"category\":\"wings\",\"net_price\":18.88,\"product_id\":54,\"quantity\":1,\"unit_price\":18.88},{\"category\":\"wings\",\"net_price\":28.41,\"product_id\":52,\"quantity\":3,\"unit_price\":9.47},{\"category\":\"wings\",\"net_price\":13.39,\"product_id\":80,\"quantity\":1,\"unit_price\":13.39},{\"category\":\"pizza\",\"net_price\":40.92,\"product_id\":6,\"quantity\":3,\"unit_price\":13.64},{\"category\":\"wings\",\"net_price\":24.9,\"product_id\":95,\"quantity\":1,\"unit_price\":24.9},{\"category\":\"pizza\",\"net_price\":38.15,\"product_id\":60,\"quantity\":5,\"unit_price\":7.63},{\"category\":\"wings\",\"net_price\":81.24,\"product_id\":81,\"quantity\":4,\"unit_price\":20.31},{\"category\":\"dessert\",\"net_price\":6.61,\"product_id\":42,\"quantity\":1,\"unit_price\":6.61},{\"category\":\"salad\",\"net_price\":30.64,\"product_id\":6,\"quantity\":4,\"unit_price\":7.66},{\"category\":\"calzone\",\"net_price\":12.92,\"product_id\":36,\"quantity\":4,\"unit_price\":3.23},{\"category\":\"calzone\",\"net_price\":8.64,\"product_id\":27,\"quantity\":1,\"unit_price\":8.64},{\"category\":\"salad\",\"net_price\":31.65,\"product_id\":97,\"quantity\":5,\"unit_price\":6.33},{\"category\":\"salad\",\"net_price\":59.56,\"product_id\":95,\"quantity\":4,\"unit_price\":14.89},{\"category\":\"pizza\",\"net_price\":8.81,\"product_id\":89,\"quantity\":1,\"unit_price\":8.81},{\"category\":\"dessert\",\"net_price\":48.09,\"product_id\":97,\"quantity\":3,\"unit_price\":16.03},{\"category\":\"salad\",\"net_price\":12.68,\"product_id\":25,\"quantity\":4,\"unit_price\":3.17},{\"category\":\"wings\",\"net_price\":10.94,\"product_id\":42,\"quantity\":2,\"unit_price\":5.47},{\"category\":\"salad\",\"net_price\":36.5,\"product_id\":7,\"quantity\":2,\"unit_price\":18.25},{\"category\":\"wings\",\"net_price\":65.84,\"product_id\":4,\"quantity\":4,\"unit_price\":16.46},{\"category\":\"calzone\",\"net_price\":2.15,\"product_id\":78,\"quantity\":1,\"unit_price\":2.15},{\"category\":\"calzone\",\"net_price\":22.3,\"product_id\":71,\"quantity\":1,\"unit_price\":22.3},{\"category\":\"dessert\",\"net_price\":63.45,\"product_id\":80,\"quantity\":5,\"unit_price\":12.69},{\"category\":\"salad\",\"net_price\":1.66,\"product_id\":83,\"quantity\":1,\"unit_price\":1.66},{\"category\":\"dessert\",\"net_price\":72.72,\"product_id\":44,\"quantity\":4,\"unit_price\":18.18},{\"category\":\"calzone\",\"net_price\":8.04,\"product_id\":43,\"quantity\":4,\"unit_price\":2.01},{\"category\":\"calzone\",\"net_price\":39.18,\"product_id\":91,\"quantity\":3,\"unit_price\":13.06},{\"category\":\"wings\",\"net_price\":44.2,\"product_id\":55,\"quantity\":2,\"unit_price\":22.1},{\"category\":\"wings\",\"net_price\":5.33,\"product_id\":88,\"quantity\":1,\"unit_price\":5.33},{\"category\":\"dessert\",\"net_price\":17.36,\"product_id\":10,\"quantity\":2,\"unit_price\":8.68},{\"category\":\"salad\",\"net_price\":2.78,\"product_id\":76,\"quantity\":2,\"unit_price\":1.39},{\"category\":\"salad\",\"net_price\":88.45,\"product_id\":13,\"quantity\":5,\"unit_price\":17.69},{\"category\":\"salad\",\"net_price\":36.88,\"product_id\":27,\"quantity\":4,\"unit_price\":9.22},{\"category\":\"wings\",\"net_price\":21.48,\"product_id\":94,\"quantity\":3,\"unit_price\":7.16},{\"category\":\"dessert\",\"net_price\":20.2,\"product_id\":89,\"quantity\":1,\"unit_price\":20.2},{\"category\":\"wings\",\"net_price\":14.08,\"product_id\":4,\"quantity\":4,\"unit_price\":3.52},{\"category\":\"dessert\",\"net_price\":26.48,\"product_id\":97,\"quantity\":4,\"unit_price\":6.62},{\"category\":\"dessert\",\"net_price\":40.88,\"product_id\":57,\"quantity\":2,\"unit_price\":20.44},{\"category\":\"dessert\",\"net_price\":42.36,\"product_id\":6,\"quantity\":4,\"unit_price\":10.59},{\"category\":\"salad\",\"net_price\":73.8,\"product_id\":86,\"quantity\":3,\"unit_price\":24.6},{\"category\":\"salad\",\"net_price\":35.49,\"product_id\":85,\"quantity\":3,\"unit_price\":11.83},{\"category\":\"wings\",\"net_price\":45.81,\"product_id\":95,\"quantity\":3,\"unit_price\":15.27},{\"category\":\"calzone\",\"net_price\":33.75,\"product_id\":18,\"quantity\":3,\"unit_price\":11.25},{\"category\":\"wings\",\"net_price\":40.59,\"product_id\":85,\"quantity\":3,\"unit_price\":13.53},{\"category\":\"wings\",\"net_price\":66.32,\"product_id\":13,\"quantity\":4,\"unit_price\":16.58},{\"category\":\"salad\",\"net_price\":45.95,\"product_id\":12,\"quantity\":5,\"unit_price\":9.19},{\"category\":\"pizza\",\"net_price\":13.65,\"product_id\":21,\"quantity\":1,\"unit_price\":13.65},{\"category\":\"dessert\",\"net_price\":36.64,\"product_id\":14,\"quantity\":2,\"unit_price\":18.32},{\"category\":\"calzone\",\"net_price\":119.4,\"product_id\":7,\"quantity\":5,\"unit_price\":23.88},{\"category\":\"pizza\",\"net_price\":22.52,\"product_id\":71,\"quantity\":1,\"unit_price\":22.52}]},\"fields\":[{\"name\":\"product_id\",\"type\":\"int\"},{\"name\":\"category\",\"type\":\"string\"},{\"name\":\"quantity\",\"type\":\"int\"},{\"name\":\"unit_price\",\"type\":\"double\"},{\"name\":\"net_price\",\"type\":\"double\"}],\"name\":\"orderline\",\"type\":\"record\"},\"type\":\"array\"}}],\"name\":\"pizzastore.PizzastoreOrder\",\"type\":\"record\"}" +} + +func (r PizzastoreOrder) SchemaName() string { + return "pizzastore.PizzastoreOrder" +} + +func (_ PizzastoreOrder) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetInt(v int32) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetLong(v int64) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetString(v string) { panic("Unsupported operation") } +func (_ PizzastoreOrder) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PizzastoreOrder) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Store_id} + + return w + + case 1: + w := types.Int{Target: &r.Store_order_id} + + return w + + case 2: + w := types.Int{Target: &r.Coupon_code} + + return w + + case 3: + w := types.Int{Target: &r.Date} + + return w + + case 4: + w := types.String{Target: &r.Status} + + return w + + case 5: + r.Orderlines = make([]Orderline, 0) + + w := ArrayOrderlineWrapper{Target: &r.Orderlines} + + return w + + } + panic("Unknown field index") +} + +func (r *PizzastoreOrder) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PizzastoreOrder) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PizzastoreOrder) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrder) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrder) HintSize(int) { panic("Unsupported operation") } +func (_ PizzastoreOrder) Finalize() {} + +func (_ PizzastoreOrder) AvroCRC64Fingerprint() []byte { + return []byte(PizzastoreOrderAvroCRC64Fingerprint) +} + +func (r PizzastoreOrder) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["store_id"], err = json.Marshal(r.Store_id) + if err != nil { + return nil, err + } + output["store_order_id"], err = json.Marshal(r.Store_order_id) + if err != nil { + return nil, err + } + output["coupon_code"], err = json.Marshal(r.Coupon_code) + if err != nil { + return nil, err + } + output["date"], err = json.Marshal(r.Date) + if err != nil { + return nil, err + } + output["status"], err = json.Marshal(r.Status) + if err != nil { + return nil, err + } + output["orderlines"], err = json.Marshal(r.Orderlines) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PizzastoreOrder) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["store_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_id") + } + val = func() json.RawMessage { + if v, ok := fields["store_order_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_order_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_order_id") + } + val = func() json.RawMessage { + if v, ok := fields["coupon_code"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Coupon_code); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for coupon_code") + } + val = func() json.RawMessage { + if v, ok := fields["date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for date") + } + val = func() json.RawMessage { + if v, ok := fields["status"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Status); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for status") + } + val = func() json.RawMessage { + if v, ok := fields["orderlines"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Orderlines); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for orderlines") + } + return nil +} diff --git a/pkg/types/pizzastore_order_cancelled.go b/pkg/types/pizzastore_order_cancelled.go new file mode 100644 index 00000000..ba70b29d --- /dev/null +++ b/pkg/types/pizzastore_order_cancelled.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PizzastoreOrderCancelled struct { + Store_id int32 `json:"store_id"` + + Store_order_id int32 `json:"store_order_id"` + + Date int32 `json:"date"` + + Status string `json:"status"` +} + +const PizzastoreOrderCancelledAvroCRC64Fingerprint = "\x1d\v\xa8\xe9\xa1voP" + +func NewPizzastoreOrderCancelled() PizzastoreOrderCancelled { + r := PizzastoreOrderCancelled{} + return r +} + +func DeserializePizzastoreOrderCancelled(r io.Reader) (PizzastoreOrderCancelled, error) { + t := NewPizzastoreOrderCancelled() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePizzastoreOrderCancelledFromSchema(r io.Reader, schema string) (PizzastoreOrderCancelled, error) { + t := NewPizzastoreOrderCancelled() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePizzastoreOrderCancelled(r PizzastoreOrderCancelled, w io.Writer) error { + var err error + err = vm.WriteInt(r.Store_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Store_order_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Date, w) + if err != nil { + return err + } + err = vm.WriteString(r.Status, w) + if err != nil { + return err + } + return err +} + +func (r PizzastoreOrderCancelled) Serialize(w io.Writer) error { + return writePizzastoreOrderCancelled(r, w) +} + +func (r PizzastoreOrderCancelled) Schema() string { + return "{\"fields\":[{\"name\":\"store_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":1}},\"type\":\"int\"}},{\"name\":\"store_order_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1001,\"step\":2}},\"type\":\"int\"}},{\"name\":\"date\",\"type\":{\"arg.properties\":{\"range\":{\"max\":19000,\"min\":18000}},\"logicalType\":\"date\",\"type\":\"int\"}},{\"name\":\"status\",\"type\":{\"arg.properties\":{\"options\":[\"cancelled\"]},\"type\":\"string\"}}],\"name\":\"pizzastore.PizzastoreOrderCancelled\",\"type\":\"record\"}" +} + +func (r PizzastoreOrderCancelled) SchemaName() string { + return "pizzastore.PizzastoreOrderCancelled" +} + +func (_ PizzastoreOrderCancelled) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetInt(v int32) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetLong(v int64) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetString(v string) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PizzastoreOrderCancelled) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Store_id} + + return w + + case 1: + w := types.Int{Target: &r.Store_order_id} + + return w + + case 2: + w := types.Int{Target: &r.Date} + + return w + + case 3: + w := types.String{Target: &r.Status} + + return w + + } + panic("Unknown field index") +} + +func (r *PizzastoreOrderCancelled) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PizzastoreOrderCancelled) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PizzastoreOrderCancelled) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) HintSize(int) { panic("Unsupported operation") } +func (_ PizzastoreOrderCancelled) Finalize() {} + +func (_ PizzastoreOrderCancelled) AvroCRC64Fingerprint() []byte { + return []byte(PizzastoreOrderCancelledAvroCRC64Fingerprint) +} + +func (r PizzastoreOrderCancelled) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["store_id"], err = json.Marshal(r.Store_id) + if err != nil { + return nil, err + } + output["store_order_id"], err = json.Marshal(r.Store_order_id) + if err != nil { + return nil, err + } + output["date"], err = json.Marshal(r.Date) + if err != nil { + return nil, err + } + output["status"], err = json.Marshal(r.Status) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PizzastoreOrderCancelled) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["store_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_id") + } + val = func() json.RawMessage { + if v, ok := fields["store_order_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_order_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_order_id") + } + val = func() json.RawMessage { + if v, ok := fields["date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for date") + } + val = func() json.RawMessage { + if v, ok := fields["status"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Status); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for status") + } + return nil +} diff --git a/pkg/types/pizzastore_order_completed.go b/pkg/types/pizzastore_order_completed.go new file mode 100644 index 00000000..10fe1789 --- /dev/null +++ b/pkg/types/pizzastore_order_completed.go @@ -0,0 +1,335 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type PizzastoreOrderCompleted struct { + Store_id int32 `json:"store_id"` + + Store_order_id int32 `json:"store_order_id"` + + Date int32 `json:"date"` + + Status string `json:"status"` + + Rack_time_secs int32 `json:"rack_time_secs"` + + Order_delivery_time_secs int32 `json:"order_delivery_time_secs"` +} + +const PizzastoreOrderCompletedAvroCRC64Fingerprint = "\xbcnW,\xe0\x0e\xdaB" + +func NewPizzastoreOrderCompleted() PizzastoreOrderCompleted { + r := PizzastoreOrderCompleted{} + return r +} + +func DeserializePizzastoreOrderCompleted(r io.Reader) (PizzastoreOrderCompleted, error) { + t := NewPizzastoreOrderCompleted() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePizzastoreOrderCompletedFromSchema(r io.Reader, schema string) (PizzastoreOrderCompleted, error) { + t := NewPizzastoreOrderCompleted() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePizzastoreOrderCompleted(r PizzastoreOrderCompleted, w io.Writer) error { + var err error + err = vm.WriteInt(r.Store_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Store_order_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Date, w) + if err != nil { + return err + } + err = vm.WriteString(r.Status, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Rack_time_secs, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Order_delivery_time_secs, w) + if err != nil { + return err + } + return err +} + +func (r PizzastoreOrderCompleted) Serialize(w io.Writer) error { + return writePizzastoreOrderCompleted(r, w) +} + +func (r PizzastoreOrderCompleted) Schema() string { + return "{\"fields\":[{\"name\":\"store_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":1}},\"type\":\"int\"}},{\"name\":\"store_order_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1000,\"step\":2}},\"type\":\"int\"}},{\"name\":\"date\",\"type\":{\"arg.properties\":{\"range\":{\"max\":19000,\"min\":18000}},\"logicalType\":\"date\",\"type\":\"int\"}},{\"name\":\"status\",\"type\":{\"arg.properties\":{\"options\":[\"completed\"]},\"type\":\"string\"}},{\"name\":\"rack_time_secs\",\"type\":{\"arg.properties\":{\"range\":{\"max\":230,\"min\":130}},\"type\":\"int\"}},{\"name\":\"order_delivery_time_secs\",\"type\":{\"arg.properties\":{\"range\":{\"max\":2000,\"min\":1100}},\"type\":\"int\"}}],\"name\":\"pizzastore.PizzastoreOrderCompleted\",\"type\":\"record\"}" +} + +func (r PizzastoreOrderCompleted) SchemaName() string { + return "pizzastore.PizzastoreOrderCompleted" +} + +func (_ PizzastoreOrderCompleted) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetInt(v int32) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetLong(v int64) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetFloat(v float32) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetDouble(v float64) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetString(v string) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *PizzastoreOrderCompleted) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Store_id} + + return w + + case 1: + w := types.Int{Target: &r.Store_order_id} + + return w + + case 2: + w := types.Int{Target: &r.Date} + + return w + + case 3: + w := types.String{Target: &r.Status} + + return w + + case 4: + w := types.Int{Target: &r.Rack_time_secs} + + return w + + case 5: + w := types.Int{Target: &r.Order_delivery_time_secs} + + return w + + } + panic("Unknown field index") +} + +func (r *PizzastoreOrderCompleted) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *PizzastoreOrderCompleted) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ PizzastoreOrderCompleted) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) AppendArray() types.Field { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) HintSize(int) { panic("Unsupported operation") } +func (_ PizzastoreOrderCompleted) Finalize() {} + +func (_ PizzastoreOrderCompleted) AvroCRC64Fingerprint() []byte { + return []byte(PizzastoreOrderCompletedAvroCRC64Fingerprint) +} + +func (r PizzastoreOrderCompleted) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["store_id"], err = json.Marshal(r.Store_id) + if err != nil { + return nil, err + } + output["store_order_id"], err = json.Marshal(r.Store_order_id) + if err != nil { + return nil, err + } + output["date"], err = json.Marshal(r.Date) + if err != nil { + return nil, err + } + output["status"], err = json.Marshal(r.Status) + if err != nil { + return nil, err + } + output["rack_time_secs"], err = json.Marshal(r.Rack_time_secs) + if err != nil { + return nil, err + } + output["order_delivery_time_secs"], err = json.Marshal(r.Order_delivery_time_secs) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *PizzastoreOrderCompleted) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["store_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_id") + } + val = func() json.RawMessage { + if v, ok := fields["store_order_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_order_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_order_id") + } + val = func() json.RawMessage { + if v, ok := fields["date"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Date); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for date") + } + val = func() json.RawMessage { + if v, ok := fields["status"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Status); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for status") + } + val = func() json.RawMessage { + if v, ok := fields["rack_time_secs"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Rack_time_secs); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for rack_time_secs") + } + val = func() json.RawMessage { + if v, ok := fields["order_delivery_time_secs"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Order_delivery_time_secs); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for order_delivery_time_secs") + } + return nil +} diff --git a/pkg/types/purchase.go b/pkg/types/purchase.go new file mode 100644 index 00000000..737a6330 --- /dev/null +++ b/pkg/types/purchase.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Purchase struct { + Id int64 `json:"id"` + + Item_type string `json:"item_type"` + + Quantity int64 `json:"quantity"` + + Price_per_unit Bytes `json:"price_per_unit"` +} + +const PurchaseAvroCRC64Fingerprint = "\xaa\x99\x81\xb8\xe9EE;" + +func NewPurchase() Purchase { + r := Purchase{} + return r +} + +func DeserializePurchase(r io.Reader) (Purchase, error) { + t := NewPurchase() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializePurchaseFromSchema(r io.Reader, schema string) (Purchase, error) { + t := NewPurchase() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writePurchase(r Purchase, w io.Writer) error { + var err error + err = vm.WriteLong(r.Id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Item_type, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Quantity, w) + if err != nil { + return err + } + err = vm.WriteBytes(r.Price_per_unit, w) + if err != nil { + return err + } + return err +} + +func (r Purchase) Serialize(w io.Writer) error { + return writePurchase(r, w) +} + +func (r Purchase) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"long\"}},{\"name\":\"item_type\",\"type\":{\"arg.properties\":{\"options\":[\"boots\",\"shirt\",\"knife\",\"saucepan\",\"table\",\"chair\",\"clock\",\"frame\",\"guitar\",\"thermometer\",\"scarf\",\"doormat\",\"vase\",\"clippers\",\"game\",\"towels\"]},\"type\":\"string\"}},{\"name\":\"quantity\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":1}},\"type\":\"long\"}},{\"name\":\"price_per_unit\",\"type\":{\"arg.properties\":{\"range\":{\"max\":50,\"min\":10}},\"logicalType\":\"decimal\",\"precision\":4,\"scale\":2,\"type\":\"bytes\"}}],\"name\":\"purchase.purchase\",\"type\":\"record\"}" +} + +func (r Purchase) SchemaName() string { + return "purchase.purchase" +} + +func (_ Purchase) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Purchase) SetInt(v int32) { panic("Unsupported operation") } +func (_ Purchase) SetLong(v int64) { panic("Unsupported operation") } +func (_ Purchase) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Purchase) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Purchase) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Purchase) SetString(v string) { panic("Unsupported operation") } +func (_ Purchase) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Purchase) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Id} + + return w + + case 1: + w := types.String{Target: &r.Item_type} + + return w + + case 2: + w := types.Long{Target: &r.Quantity} + + return w + + case 3: + w := BytesWrapper{Target: &r.Price_per_unit} + + return w + + } + panic("Unknown field index") +} + +func (r *Purchase) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Purchase) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Purchase) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Purchase) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Purchase) HintSize(int) { panic("Unsupported operation") } +func (_ Purchase) Finalize() {} + +func (_ Purchase) AvroCRC64Fingerprint() []byte { + return []byte(PurchaseAvroCRC64Fingerprint) +} + +func (r Purchase) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["item_type"], err = json.Marshal(r.Item_type) + if err != nil { + return nil, err + } + output["quantity"], err = json.Marshal(r.Quantity) + if err != nil { + return nil, err + } + output["price_per_unit"], err = json.Marshal(r.Price_per_unit) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Purchase) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["item_type"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Item_type); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for item_type") + } + val = func() json.RawMessage { + if v, ok := fields["quantity"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Quantity); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for quantity") + } + val = func() json.RawMessage { + if v, ok := fields["price_per_unit"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Price_per_unit); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for price_per_unit") + } + return nil +} diff --git a/pkg/types/registry.go b/pkg/types/registry.go new file mode 100755 index 00000000..a844a561 --- /dev/null +++ b/pkg/types/registry.go @@ -0,0 +1,295 @@ +// Autogenerated code. DO NOT EDIT. +package types + +var address Address + +var array_orderline_wrapper ArrayOrderlineWrapper + +var array_string_wrapper ArrayStringWrapper + +var bytes Bytes + +var csv_product CsvProduct + +var csv_user CsvUser + +var destination Destination + +var finance_stock_trade FinanceStockTrade + +var fleetmgmt_description FleetmgmtDescription + +var fleetmgmt_location FleetmgmtLocation + +var fleetmgmt_sensor FleetmgmtSensor + +var gaming_game GamingGame + +var gaming_player GamingPlayer + +var gaming_player_activity GamingPlayerActivity + +var insurance_customer InsuranceCustomer + +var insurance_customer_activity InsuranceCustomerActivity + +var insurance_offer InsuranceOffer + +var inventorymgmt_inventory InventorymgmtInventory + +var inventorymgmt_product InventorymgmtProduct + +var iot_device_information IotDeviceInformation + +var location Location + +var map_bool_wrapper MapBoolWrapper + +var map_bytes_wrapper MapBytesWrapper + +var map_float_wrapper MapFloatWrapper + +var map_int_wrapper MapIntWrapper + +var map_long_wrapper MapLongWrapper + +var map_string_wrapper MapStringWrapper + +var marketing_campaign_finance MarketingCampaignFinance + +var my_map_test_record MyMapTestRecord + +var net_device NetDevice + +var orderline Orderline + +var payment_credit_card PaymentCreditCard + +var payment_transaction PaymentTransaction + +var payroll_bonus PayrollBonus + +var payroll_employee PayrollEmployee + +var payroll_employee_location PayrollEmployeeLocation + +var pizzastore_order PizzastoreOrder + +var pizzastore_order_cancelled PizzastoreOrderCancelled + +var pizzastore_order_completed PizzastoreOrderCompleted + +var purchase Purchase + +var shoestore_clickstream ShoestoreClickstream + +var shoestore_customer ShoestoreCustomer + +var shoestore_order ShoestoreOrder + +var shoestore_shoe ShoestoreShoe + +var shopping_order ShoppingOrder + +var shopping_rating ShoppingRating + +var siem_log SiemLog + +var source Source + +var store Store + +var syslog_log SyslogLog + +var user User + +var users Users + +var users_array_map UsersArrayMap + +var webanalytics_clickstream WebanalyticsClickstream + +var webanalytics_code WebanalyticsCode + +var webanalytics_page_view WebanalyticsPageView + +var webanalytics_user WebanalyticsUser + +//gocyclo:ignore +func GetType(templateType string) interface{} { + + switch templateType { + + case "address": + return &address + + case "array_orderline_wrapper": + return &array_orderline_wrapper + + case "array_string_wrapper": + return &array_string_wrapper + + case "bytes": + return &bytes + + case "csv_product": + return &csv_product + + case "csv_user": + return &csv_user + + case "destination": + return &destination + + case "finance_stock_trade": + return &finance_stock_trade + + case "fleetmgmt_description": + return &fleetmgmt_description + + case "fleetmgmt_location": + return &fleetmgmt_location + + case "fleetmgmt_sensor": + return &fleetmgmt_sensor + + case "gaming_game": + return &gaming_game + + case "gaming_player": + return &gaming_player + + case "gaming_player_activity": + return &gaming_player_activity + + case "insurance_customer": + return &insurance_customer + + case "insurance_customer_activity": + return &insurance_customer_activity + + case "insurance_offer": + return &insurance_offer + + case "inventorymgmt_inventory": + return &inventorymgmt_inventory + + case "inventorymgmt_product": + return &inventorymgmt_product + + case "iot_device_information": + return &iot_device_information + + case "location": + return &location + + case "map_bool_wrapper": + return &map_bool_wrapper + + case "map_bytes_wrapper": + return &map_bytes_wrapper + + case "map_float_wrapper": + return &map_float_wrapper + + case "map_int_wrapper": + return &map_int_wrapper + + case "map_long_wrapper": + return &map_long_wrapper + + case "map_string_wrapper": + return &map_string_wrapper + + case "marketing_campaign_finance": + return &marketing_campaign_finance + + case "my_map_test_record": + return &my_map_test_record + + case "net_device": + return &net_device + + case "orderline": + return &orderline + + case "payment_credit_card": + return &payment_credit_card + + case "payment_transaction": + return &payment_transaction + + case "payroll_bonus": + return &payroll_bonus + + case "payroll_employee": + return &payroll_employee + + case "payroll_employee_location": + return &payroll_employee_location + + case "pizzastore_order": + return &pizzastore_order + + case "pizzastore_order_cancelled": + return &pizzastore_order_cancelled + + case "pizzastore_order_completed": + return &pizzastore_order_completed + + case "purchase": + return &purchase + + case "shoestore_clickstream": + return &shoestore_clickstream + + case "shoestore_customer": + return &shoestore_customer + + case "shoestore_order": + return &shoestore_order + + case "shoestore_shoe": + return &shoestore_shoe + + case "shopping_order": + return &shopping_order + + case "shopping_rating": + return &shopping_rating + + case "siem_log": + return &siem_log + + case "source": + return &source + + case "store": + return &store + + case "syslog_log": + return &syslog_log + + case "user": + return &user + + case "users": + return &users + + case "users_array_map": + return &users_array_map + + case "webanalytics_clickstream": + return &webanalytics_clickstream + + case "webanalytics_code": + return &webanalytics_code + + case "webanalytics_page_view": + return &webanalytics_page_view + + case "webanalytics_user": + return &webanalytics_user + } + return nil +} diff --git a/pkg/types/shoestore_clickstream.go b/pkg/types/shoestore_clickstream.go new file mode 100644 index 00000000..9b944bbc --- /dev/null +++ b/pkg/types/shoestore_clickstream.go @@ -0,0 +1,335 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoestoreClickstream struct { + Product_id string `json:"product_id"` + + User_id string `json:"user_id"` + + View_time int32 `json:"view_time"` + + Page_url string `json:"page_url"` + + Ip string `json:"ip"` + + Ts int64 `json:"ts"` +} + +const ShoestoreClickstreamAvroCRC64Fingerprint = "\x8a\x85\xa5\x89\xa8\xffi\xcb" + +func NewShoestoreClickstream() ShoestoreClickstream { + r := ShoestoreClickstream{} + return r +} + +func DeserializeShoestoreClickstream(r io.Reader) (ShoestoreClickstream, error) { + t := NewShoestoreClickstream() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoestoreClickstreamFromSchema(r io.Reader, schema string) (ShoestoreClickstream, error) { + t := NewShoestoreClickstream() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoestoreClickstream(r ShoestoreClickstream, w io.Writer) error { + var err error + err = vm.WriteString(r.Product_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.User_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.View_time, w) + if err != nil { + return err + } + err = vm.WriteString(r.Page_url, w) + if err != nil { + return err + } + err = vm.WriteString(r.Ip, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Ts, w) + if err != nil { + return err + } + return err +} + +func (r ShoestoreClickstream) Serialize(w io.Writer) error { + return writeShoestoreClickstream(r, w) +} + +func (r ShoestoreClickstream) Schema() string { + return "{\"fields\":[{\"name\":\"product_id\",\"type\":\"string\"},{\"name\":\"user_id\",\"type\":\"string\"},{\"name\":\"view_time\",\"type\":\"int\"},{\"name\":\"page_url\",\"type\":\"string\"},{\"name\":\"ip\",\"type\":\"string\"},{\"name\":\"ts\",\"type\":\"long\"}],\"name\":\"shoestore.ShoestoreClickstream\",\"type\":\"record\"}" +} + +func (r ShoestoreClickstream) SchemaName() string { + return "shoestore.ShoestoreClickstream" +} + +func (_ ShoestoreClickstream) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetString(v string) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoestoreClickstream) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Product_id} + + return w + + case 1: + w := types.String{Target: &r.User_id} + + return w + + case 2: + w := types.Int{Target: &r.View_time} + + return w + + case 3: + w := types.String{Target: &r.Page_url} + + return w + + case 4: + w := types.String{Target: &r.Ip} + + return w + + case 5: + w := types.Long{Target: &r.Ts} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoestoreClickstream) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoestoreClickstream) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoestoreClickstream) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoestoreClickstream) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoestoreClickstream) HintSize(int) { panic("Unsupported operation") } +func (_ ShoestoreClickstream) Finalize() {} + +func (_ ShoestoreClickstream) AvroCRC64Fingerprint() []byte { + return []byte(ShoestoreClickstreamAvroCRC64Fingerprint) +} + +func (r ShoestoreClickstream) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["product_id"], err = json.Marshal(r.Product_id) + if err != nil { + return nil, err + } + output["user_id"], err = json.Marshal(r.User_id) + if err != nil { + return nil, err + } + output["view_time"], err = json.Marshal(r.View_time) + if err != nil { + return nil, err + } + output["page_url"], err = json.Marshal(r.Page_url) + if err != nil { + return nil, err + } + output["ip"], err = json.Marshal(r.Ip) + if err != nil { + return nil, err + } + output["ts"], err = json.Marshal(r.Ts) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoestoreClickstream) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["product_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Product_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for product_id") + } + val = func() json.RawMessage { + if v, ok := fields["user_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.User_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for user_id") + } + val = func() json.RawMessage { + if v, ok := fields["view_time"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.View_time); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for view_time") + } + val = func() json.RawMessage { + if v, ok := fields["page_url"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Page_url); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for page_url") + } + val = func() json.RawMessage { + if v, ok := fields["ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip") + } + val = func() json.RawMessage { + if v, ok := fields["ts"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ts); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ts") + } + return nil +} diff --git a/pkg/types/shoestore_customer.go b/pkg/types/shoestore_customer.go new file mode 100644 index 00000000..545b6f35 --- /dev/null +++ b/pkg/types/shoestore_customer.go @@ -0,0 +1,451 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoestoreCustomer struct { + Id string `json:"id"` + + First_name string `json:"first_name"` + + Last_name string `json:"last_name"` + + Email string `json:"email"` + + Phone_number string `json:"phone_number"` + + Street_address string `json:"street_address"` + + State string `json:"state"` + + Zip_code string `json:"zip_code"` + + Country string `json:"country"` + + Country_code string `json:"country_code"` +} + +const ShoestoreCustomerAvroCRC64Fingerprint = "徔\xbfI\xc2\x00\v" + +func NewShoestoreCustomer() ShoestoreCustomer { + r := ShoestoreCustomer{} + return r +} + +func DeserializeShoestoreCustomer(r io.Reader) (ShoestoreCustomer, error) { + t := NewShoestoreCustomer() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoestoreCustomerFromSchema(r io.Reader, schema string) (ShoestoreCustomer, error) { + t := NewShoestoreCustomer() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoestoreCustomer(r ShoestoreCustomer, w io.Writer) error { + var err error + err = vm.WriteString(r.Id, w) + if err != nil { + return err + } + err = vm.WriteString(r.First_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Last_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Email, w) + if err != nil { + return err + } + err = vm.WriteString(r.Phone_number, w) + if err != nil { + return err + } + err = vm.WriteString(r.Street_address, w) + if err != nil { + return err + } + err = vm.WriteString(r.State, w) + if err != nil { + return err + } + err = vm.WriteString(r.Zip_code, w) + if err != nil { + return err + } + err = vm.WriteString(r.Country, w) + if err != nil { + return err + } + err = vm.WriteString(r.Country_code, w) + if err != nil { + return err + } + return err +} + +func (r ShoestoreCustomer) Serialize(w io.Writer) error { + return writeShoestoreCustomer(r, w) +} + +func (r ShoestoreCustomer) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"first_name\",\"type\":\"string\"},{\"name\":\"last_name\",\"type\":\"string\"},{\"name\":\"email\",\"type\":\"string\"},{\"name\":\"phone_number\",\"type\":\"string\"},{\"name\":\"street_address\",\"type\":\"string\"},{\"name\":\"state\",\"type\":\"string\"},{\"name\":\"zip_code\",\"type\":\"string\"},{\"name\":\"country\",\"type\":\"string\"},{\"name\":\"country_code\",\"type\":\"string\"}],\"name\":\"shoes.ShoestoreCustomer\",\"type\":\"record\"}" +} + +func (r ShoestoreCustomer) SchemaName() string { + return "shoes.ShoestoreCustomer" +} + +func (_ ShoestoreCustomer) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetString(v string) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoestoreCustomer) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Id} + + return w + + case 1: + w := types.String{Target: &r.First_name} + + return w + + case 2: + w := types.String{Target: &r.Last_name} + + return w + + case 3: + w := types.String{Target: &r.Email} + + return w + + case 4: + w := types.String{Target: &r.Phone_number} + + return w + + case 5: + w := types.String{Target: &r.Street_address} + + return w + + case 6: + w := types.String{Target: &r.State} + + return w + + case 7: + w := types.String{Target: &r.Zip_code} + + return w + + case 8: + w := types.String{Target: &r.Country} + + return w + + case 9: + w := types.String{Target: &r.Country_code} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoestoreCustomer) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoestoreCustomer) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoestoreCustomer) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoestoreCustomer) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoestoreCustomer) HintSize(int) { panic("Unsupported operation") } +func (_ ShoestoreCustomer) Finalize() {} + +func (_ ShoestoreCustomer) AvroCRC64Fingerprint() []byte { + return []byte(ShoestoreCustomerAvroCRC64Fingerprint) +} + +func (r ShoestoreCustomer) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["first_name"], err = json.Marshal(r.First_name) + if err != nil { + return nil, err + } + output["last_name"], err = json.Marshal(r.Last_name) + if err != nil { + return nil, err + } + output["email"], err = json.Marshal(r.Email) + if err != nil { + return nil, err + } + output["phone_number"], err = json.Marshal(r.Phone_number) + if err != nil { + return nil, err + } + output["street_address"], err = json.Marshal(r.Street_address) + if err != nil { + return nil, err + } + output["state"], err = json.Marshal(r.State) + if err != nil { + return nil, err + } + output["zip_code"], err = json.Marshal(r.Zip_code) + if err != nil { + return nil, err + } + output["country"], err = json.Marshal(r.Country) + if err != nil { + return nil, err + } + output["country_code"], err = json.Marshal(r.Country_code) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoestoreCustomer) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["first_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.First_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for first_name") + } + val = func() json.RawMessage { + if v, ok := fields["last_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Last_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for last_name") + } + val = func() json.RawMessage { + if v, ok := fields["email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for email") + } + val = func() json.RawMessage { + if v, ok := fields["phone_number"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Phone_number); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for phone_number") + } + val = func() json.RawMessage { + if v, ok := fields["street_address"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Street_address); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for street_address") + } + val = func() json.RawMessage { + if v, ok := fields["state"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.State); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for state") + } + val = func() json.RawMessage { + if v, ok := fields["zip_code"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Zip_code); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for zip_code") + } + val = func() json.RawMessage { + if v, ok := fields["country"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Country); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for country") + } + val = func() json.RawMessage { + if v, ok := fields["country_code"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Country_code); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for country_code") + } + return nil +} diff --git a/pkg/types/shoestore_order.go b/pkg/types/shoestore_order.go new file mode 100644 index 00000000..daed70b9 --- /dev/null +++ b/pkg/types/shoestore_order.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoestoreOrder struct { + Order_id int32 `json:"order_id"` + + Product_id string `json:"product_id"` + + Customer_id string `json:"customer_id"` + + Ts int64 `json:"ts"` +} + +const ShoestoreOrderAvroCRC64Fingerprint = "\xe7_\xf3\xf3r\xa1:)" + +func NewShoestoreOrder() ShoestoreOrder { + r := ShoestoreOrder{} + return r +} + +func DeserializeShoestoreOrder(r io.Reader) (ShoestoreOrder, error) { + t := NewShoestoreOrder() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoestoreOrderFromSchema(r io.Reader, schema string) (ShoestoreOrder, error) { + t := NewShoestoreOrder() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoestoreOrder(r ShoestoreOrder, w io.Writer) error { + var err error + err = vm.WriteInt(r.Order_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Product_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Customer_id, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Ts, w) + if err != nil { + return err + } + return err +} + +func (r ShoestoreOrder) Serialize(w io.Writer) error { + return writeShoestoreOrder(r, w) +} + +func (r ShoestoreOrder) Schema() string { + return "{\"fields\":[{\"name\":\"order_id\",\"type\":\"int\"},{\"name\":\"product_id\",\"type\":\"string\"},{\"name\":\"customer_id\",\"type\":\"string\"},{\"name\":\"ts\",\"type\":\"long\"}],\"name\":\"shoes.ShoestoreOrder\",\"type\":\"record\"}" +} + +func (r ShoestoreOrder) SchemaName() string { + return "shoes.ShoestoreOrder" +} + +func (_ ShoestoreOrder) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetString(v string) { panic("Unsupported operation") } +func (_ ShoestoreOrder) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoestoreOrder) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Order_id} + + return w + + case 1: + w := types.String{Target: &r.Product_id} + + return w + + case 2: + w := types.String{Target: &r.Customer_id} + + return w + + case 3: + w := types.Long{Target: &r.Ts} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoestoreOrder) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoestoreOrder) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoestoreOrder) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoestoreOrder) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoestoreOrder) HintSize(int) { panic("Unsupported operation") } +func (_ ShoestoreOrder) Finalize() {} + +func (_ ShoestoreOrder) AvroCRC64Fingerprint() []byte { + return []byte(ShoestoreOrderAvroCRC64Fingerprint) +} + +func (r ShoestoreOrder) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["order_id"], err = json.Marshal(r.Order_id) + if err != nil { + return nil, err + } + output["product_id"], err = json.Marshal(r.Product_id) + if err != nil { + return nil, err + } + output["customer_id"], err = json.Marshal(r.Customer_id) + if err != nil { + return nil, err + } + output["ts"], err = json.Marshal(r.Ts) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoestoreOrder) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["order_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Order_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for order_id") + } + val = func() json.RawMessage { + if v, ok := fields["product_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Product_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for product_id") + } + val = func() json.RawMessage { + if v, ok := fields["customer_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Customer_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for customer_id") + } + val = func() json.RawMessage { + if v, ok := fields["ts"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ts); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ts") + } + return nil +} diff --git a/pkg/types/shoestore_shoe.go b/pkg/types/shoestore_shoe.go new file mode 100644 index 00000000..bec961b2 --- /dev/null +++ b/pkg/types/shoestore_shoe.go @@ -0,0 +1,306 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoestoreShoe struct { + Id string `json:"id"` + + Sale_price string `json:"sale_price"` + + Brand string `json:"brand"` + + Name string `json:"name"` + + Rating float32 `json:"rating"` +} + +const ShoestoreShoeAvroCRC64Fingerprint = "\f\x89In\x8e*\x16\xfc" + +func NewShoestoreShoe() ShoestoreShoe { + r := ShoestoreShoe{} + return r +} + +func DeserializeShoestoreShoe(r io.Reader) (ShoestoreShoe, error) { + t := NewShoestoreShoe() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoestoreShoeFromSchema(r io.Reader, schema string) (ShoestoreShoe, error) { + t := NewShoestoreShoe() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoestoreShoe(r ShoestoreShoe, w io.Writer) error { + var err error + err = vm.WriteString(r.Id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Sale_price, w) + if err != nil { + return err + } + err = vm.WriteString(r.Brand, w) + if err != nil { + return err + } + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteFloat(r.Rating, w) + if err != nil { + return err + } + return err +} + +func (r ShoestoreShoe) Serialize(w io.Writer) error { + return writeShoestoreShoe(r, w) +} + +func (r ShoestoreShoe) Schema() string { + return "{\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"sale_price\",\"type\":\"string\"},{\"name\":\"brand\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"rating\",\"type\":\"float\"}],\"name\":\"shoestore.ShoestoreShoe\",\"type\":\"record\"}" +} + +func (r ShoestoreShoe) SchemaName() string { + return "shoestore.ShoestoreShoe" +} + +func (_ ShoestoreShoe) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetString(v string) { panic("Unsupported operation") } +func (_ ShoestoreShoe) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoestoreShoe) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Id} + + return w + + case 1: + w := types.String{Target: &r.Sale_price} + + return w + + case 2: + w := types.String{Target: &r.Brand} + + return w + + case 3: + w := types.String{Target: &r.Name} + + return w + + case 4: + w := types.Float{Target: &r.Rating} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoestoreShoe) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoestoreShoe) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoestoreShoe) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoestoreShoe) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoestoreShoe) HintSize(int) { panic("Unsupported operation") } +func (_ ShoestoreShoe) Finalize() {} + +func (_ ShoestoreShoe) AvroCRC64Fingerprint() []byte { + return []byte(ShoestoreShoeAvroCRC64Fingerprint) +} + +func (r ShoestoreShoe) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["id"], err = json.Marshal(r.Id) + if err != nil { + return nil, err + } + output["sale_price"], err = json.Marshal(r.Sale_price) + if err != nil { + return nil, err + } + output["brand"], err = json.Marshal(r.Brand) + if err != nil { + return nil, err + } + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["rating"], err = json.Marshal(r.Rating) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoestoreShoe) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for id") + } + val = func() json.RawMessage { + if v, ok := fields["sale_price"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Sale_price); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for sale_price") + } + val = func() json.RawMessage { + if v, ok := fields["brand"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Brand); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for brand") + } + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["rating"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Rating); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for rating") + } + return nil +} diff --git a/pkg/types/shopping_order.go b/pkg/types/shopping_order.go new file mode 100644 index 00000000..3528823e --- /dev/null +++ b/pkg/types/shopping_order.go @@ -0,0 +1,310 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoppingOrder struct { + Ordertime int64 `json:"ordertime"` + + Orderid int32 `json:"orderid"` + + Itemid string `json:"itemid"` + + Orderunits float64 `json:"orderunits"` + + Address Address `json:"address"` +} + +const ShoppingOrderAvroCRC64Fingerprint = "\x14ʵ\x1d\xd3\xc7g\x8d" + +func NewShoppingOrder() ShoppingOrder { + r := ShoppingOrder{} + r.Address = NewAddress() + + return r +} + +func DeserializeShoppingOrder(r io.Reader) (ShoppingOrder, error) { + t := NewShoppingOrder() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoppingOrderFromSchema(r io.Reader, schema string) (ShoppingOrder, error) { + t := NewShoppingOrder() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoppingOrder(r ShoppingOrder, w io.Writer) error { + var err error + err = vm.WriteLong(r.Ordertime, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Orderid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Itemid, w) + if err != nil { + return err + } + err = vm.WriteDouble(r.Orderunits, w) + if err != nil { + return err + } + err = writeAddress(r.Address, w) + if err != nil { + return err + } + return err +} + +func (r ShoppingOrder) Serialize(w io.Writer) error { + return writeShoppingOrder(r, w) +} + +func (r ShoppingOrder) Schema() string { + return "{\"fields\":[{\"name\":\"ordertime\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1519273364600,\"min\":1487715775521}},\"type\":\"long\"}},{\"name\":\"orderid\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":0}},\"type\":\"int\"}},{\"name\":\"itemid\",\"type\":{\"arg.properties\":{\"regex\":\"Item_[1-9][0-9]{0,2}\"},\"type\":\"string\"}},{\"name\":\"orderunits\",\"type\":{\"arg.properties\":{\"range\":{\"max\":10,\"min\":0.1}},\"type\":\"double\"}},{\"name\":\"address\",\"type\":{\"fields\":[{\"name\":\"city\",\"type\":{\"arg.properties\":{\"regex\":\"City_[1-9]{0,2}\"},\"type\":\"string\"}},{\"name\":\"state\",\"type\":{\"arg.properties\":{\"regex\":\"State_[1-9]{0,2}\"},\"type\":\"string\"}},{\"name\":\"zipcode\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"long\"}}],\"name\":\"address\",\"type\":\"record\"}}],\"name\":\"shopping.ShoppingOrder\",\"type\":\"record\"}" +} + +func (r ShoppingOrder) SchemaName() string { + return "shopping.ShoppingOrder" +} + +func (_ ShoppingOrder) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetString(v string) { panic("Unsupported operation") } +func (_ ShoppingOrder) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoppingOrder) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Ordertime} + + return w + + case 1: + w := types.Int{Target: &r.Orderid} + + return w + + case 2: + w := types.String{Target: &r.Itemid} + + return w + + case 3: + w := types.Double{Target: &r.Orderunits} + + return w + + case 4: + r.Address = NewAddress() + + w := types.Record{Target: &r.Address} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoppingOrder) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoppingOrder) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoppingOrder) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoppingOrder) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoppingOrder) HintSize(int) { panic("Unsupported operation") } +func (_ ShoppingOrder) Finalize() {} + +func (_ ShoppingOrder) AvroCRC64Fingerprint() []byte { + return []byte(ShoppingOrderAvroCRC64Fingerprint) +} + +func (r ShoppingOrder) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["ordertime"], err = json.Marshal(r.Ordertime) + if err != nil { + return nil, err + } + output["orderid"], err = json.Marshal(r.Orderid) + if err != nil { + return nil, err + } + output["itemid"], err = json.Marshal(r.Itemid) + if err != nil { + return nil, err + } + output["orderunits"], err = json.Marshal(r.Orderunits) + if err != nil { + return nil, err + } + output["address"], err = json.Marshal(r.Address) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoppingOrder) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["ordertime"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ordertime); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ordertime") + } + val = func() json.RawMessage { + if v, ok := fields["orderid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Orderid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for orderid") + } + val = func() json.RawMessage { + if v, ok := fields["itemid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Itemid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for itemid") + } + val = func() json.RawMessage { + if v, ok := fields["orderunits"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Orderunits); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for orderunits") + } + val = func() json.RawMessage { + if v, ok := fields["address"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Address); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for address") + } + return nil +} diff --git a/pkg/types/shopping_rating.go b/pkg/types/shopping_rating.go new file mode 100644 index 00000000..197d6352 --- /dev/null +++ b/pkg/types/shopping_rating.go @@ -0,0 +1,364 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type ShoppingRating struct { + Rating_id int64 `json:"rating_id"` + + User_id int32 `json:"user_id"` + + Stars int32 `json:"stars"` + + Route_id int32 `json:"route_id"` + + Rating_time int64 `json:"rating_time"` + + Channel string `json:"channel"` + + Message string `json:"message"` +} + +const ShoppingRatingAvroCRC64Fingerprint = ")\x05\xa2:\xcb\xdd\xf4/" + +func NewShoppingRating() ShoppingRating { + r := ShoppingRating{} + return r +} + +func DeserializeShoppingRating(r io.Reader) (ShoppingRating, error) { + t := NewShoppingRating() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeShoppingRatingFromSchema(r io.Reader, schema string) (ShoppingRating, error) { + t := NewShoppingRating() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeShoppingRating(r ShoppingRating, w io.Writer) error { + var err error + err = vm.WriteLong(r.Rating_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.User_id, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Stars, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Route_id, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Rating_time, w) + if err != nil { + return err + } + err = vm.WriteString(r.Channel, w) + if err != nil { + return err + } + err = vm.WriteString(r.Message, w) + if err != nil { + return err + } + return err +} + +func (r ShoppingRating) Serialize(w io.Writer) error { + return writeShoppingRating(r, w) +} + +func (r ShoppingRating) Schema() string { + return "{\"fields\":[{\"name\":\"rating_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1}},\"type\":\"long\"}},{\"name\":\"user_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":20,\"min\":-1}},\"type\":\"int\"}},{\"name\":\"stars\",\"type\":{\"arg.properties\":{\"range\":{\"max\":5,\"min\":1}},\"type\":\"int\"}},{\"name\":\"route_id\",\"type\":{\"arg.properties\":{\"range\":{\"max\":9999,\"min\":1}},\"type\":\"int\"}},{\"name\":\"rating_time\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1,\"step\":12}},\"format_as_time\":\"unix_long\",\"type\":\"long\"}},{\"name\":\"channel\",\"type\":{\"arg.properties\":{\"options\":[\"web\",\"iOS\",\"ios\",\"iOS-test\",\"android\"]},\"type\":\"string\"}},{\"name\":\"message\",\"type\":{\"arg.properties\":{\"options\":[\"worst. flight. ever. #neveragain\",\"Surprisingly good, maybe you are getting your mojo back at long last!\",\"Exceeded all my expectations. Thank you !\",\"meh\",\"(expletive deleted)\",\"is this as good as it gets? really ?\",\"airport refurb looks great, will fly outta here more!\",\"why is it so difficult to keep the bathrooms clean ?\",\"thank you for the most friendly, helpful experience today at your new lounge\",\"more peanuts please\",\"your team here rocks!\"]},\"type\":\"string\"}}],\"name\":\"shopping.ShoppingRating\",\"type\":\"record\"}" +} + +func (r ShoppingRating) SchemaName() string { + return "shopping.ShoppingRating" +} + +func (_ ShoppingRating) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ ShoppingRating) SetInt(v int32) { panic("Unsupported operation") } +func (_ ShoppingRating) SetLong(v int64) { panic("Unsupported operation") } +func (_ ShoppingRating) SetFloat(v float32) { panic("Unsupported operation") } +func (_ ShoppingRating) SetDouble(v float64) { panic("Unsupported operation") } +func (_ ShoppingRating) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ ShoppingRating) SetString(v string) { panic("Unsupported operation") } +func (_ ShoppingRating) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *ShoppingRating) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Rating_id} + + return w + + case 1: + w := types.Int{Target: &r.User_id} + + return w + + case 2: + w := types.Int{Target: &r.Stars} + + return w + + case 3: + w := types.Int{Target: &r.Route_id} + + return w + + case 4: + w := types.Long{Target: &r.Rating_time} + + return w + + case 5: + w := types.String{Target: &r.Channel} + + return w + + case 6: + w := types.String{Target: &r.Message} + + return w + + } + panic("Unknown field index") +} + +func (r *ShoppingRating) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *ShoppingRating) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ ShoppingRating) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ ShoppingRating) AppendArray() types.Field { panic("Unsupported operation") } +func (_ ShoppingRating) HintSize(int) { panic("Unsupported operation") } +func (_ ShoppingRating) Finalize() {} + +func (_ ShoppingRating) AvroCRC64Fingerprint() []byte { + return []byte(ShoppingRatingAvroCRC64Fingerprint) +} + +func (r ShoppingRating) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["rating_id"], err = json.Marshal(r.Rating_id) + if err != nil { + return nil, err + } + output["user_id"], err = json.Marshal(r.User_id) + if err != nil { + return nil, err + } + output["stars"], err = json.Marshal(r.Stars) + if err != nil { + return nil, err + } + output["route_id"], err = json.Marshal(r.Route_id) + if err != nil { + return nil, err + } + output["rating_time"], err = json.Marshal(r.Rating_time) + if err != nil { + return nil, err + } + output["channel"], err = json.Marshal(r.Channel) + if err != nil { + return nil, err + } + output["message"], err = json.Marshal(r.Message) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *ShoppingRating) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["rating_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Rating_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for rating_id") + } + val = func() json.RawMessage { + if v, ok := fields["user_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.User_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for user_id") + } + val = func() json.RawMessage { + if v, ok := fields["stars"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Stars); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for stars") + } + val = func() json.RawMessage { + if v, ok := fields["route_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Route_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for route_id") + } + val = func() json.RawMessage { + if v, ok := fields["rating_time"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Rating_time); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for rating_time") + } + val = func() json.RawMessage { + if v, ok := fields["channel"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Channel); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for channel") + } + val = func() json.RawMessage { + if v, ok := fields["message"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Message); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for message") + } + return nil +} diff --git a/pkg/types/siem_log.go b/pkg/types/siem_log.go new file mode 100644 index 00000000..2eebc123 --- /dev/null +++ b/pkg/types/siem_log.go @@ -0,0 +1,343 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type SiemLog struct { + Hostname string `json:"hostname"` + + Action string `json:"action"` + + L4 string `json:"l4"` + + Access_group string `json:"access_group"` + + Source Source `json:"source"` + + Destination Destination `json:"destination"` +} + +const SiemLogAvroCRC64Fingerprint = "\xcb\xfc\x05v{\xe50t" + +func NewSiemLog() SiemLog { + r := SiemLog{} + r.Source = NewSource() + + r.Destination = NewDestination() + + return r +} + +func DeserializeSiemLog(r io.Reader) (SiemLog, error) { + t := NewSiemLog() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeSiemLogFromSchema(r io.Reader, schema string) (SiemLog, error) { + t := NewSiemLog() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeSiemLog(r SiemLog, w io.Writer) error { + var err error + err = vm.WriteString(r.Hostname, w) + if err != nil { + return err + } + err = vm.WriteString(r.Action, w) + if err != nil { + return err + } + err = vm.WriteString(r.L4, w) + if err != nil { + return err + } + err = vm.WriteString(r.Access_group, w) + if err != nil { + return err + } + err = writeSource(r.Source, w) + if err != nil { + return err + } + err = writeDestination(r.Destination, w) + if err != nil { + return err + } + return err +} + +func (r SiemLog) Serialize(w io.Writer) error { + return writeSiemLog(r, w) +} + +func (r SiemLog) Schema() string { + return "{\"fields\":[{\"name\":\"hostname\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"action\",\"type\":{\"arg.properties\":{\"options\":[\"allow\",\"deny\"]},\"type\":\"string\"}},{\"name\":\"l4\",\"type\":{\"arg.properties\":{\"options\":[\"tcp\"]},\"type\":\"string\"}},{\"name\":\"access_group\",\"type\":{\"arg.properties\":{\"options\":[\"group-1\",\"group-2\",\"group-3\",\"group-4\",\"admin\"]},\"type\":\"string\"}},{\"name\":\"source\",\"type\":{\"fields\":[{\"name\":\"ip\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"port\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"int\"}}],\"name\":\"source\",\"type\":\"record\"}},{\"name\":\"destination\",\"type\":{\"fields\":[{\"name\":\"ip\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"port\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"int\"}}],\"name\":\"destination\",\"type\":\"record\"}}],\"name\":\"siem.SiemLog\",\"type\":\"record\"}" +} + +func (r SiemLog) SchemaName() string { + return "siem.SiemLog" +} + +func (_ SiemLog) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ SiemLog) SetInt(v int32) { panic("Unsupported operation") } +func (_ SiemLog) SetLong(v int64) { panic("Unsupported operation") } +func (_ SiemLog) SetFloat(v float32) { panic("Unsupported operation") } +func (_ SiemLog) SetDouble(v float64) { panic("Unsupported operation") } +func (_ SiemLog) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ SiemLog) SetString(v string) { panic("Unsupported operation") } +func (_ SiemLog) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *SiemLog) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Hostname} + + return w + + case 1: + w := types.String{Target: &r.Action} + + return w + + case 2: + w := types.String{Target: &r.L4} + + return w + + case 3: + w := types.String{Target: &r.Access_group} + + return w + + case 4: + r.Source = NewSource() + + w := types.Record{Target: &r.Source} + + return w + + case 5: + r.Destination = NewDestination() + + w := types.Record{Target: &r.Destination} + + return w + + } + panic("Unknown field index") +} + +func (r *SiemLog) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *SiemLog) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ SiemLog) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ SiemLog) AppendArray() types.Field { panic("Unsupported operation") } +func (_ SiemLog) HintSize(int) { panic("Unsupported operation") } +func (_ SiemLog) Finalize() {} + +func (_ SiemLog) AvroCRC64Fingerprint() []byte { + return []byte(SiemLogAvroCRC64Fingerprint) +} + +func (r SiemLog) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["hostname"], err = json.Marshal(r.Hostname) + if err != nil { + return nil, err + } + output["action"], err = json.Marshal(r.Action) + if err != nil { + return nil, err + } + output["l4"], err = json.Marshal(r.L4) + if err != nil { + return nil, err + } + output["access_group"], err = json.Marshal(r.Access_group) + if err != nil { + return nil, err + } + output["source"], err = json.Marshal(r.Source) + if err != nil { + return nil, err + } + output["destination"], err = json.Marshal(r.Destination) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *SiemLog) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["hostname"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Hostname); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for hostname") + } + val = func() json.RawMessage { + if v, ok := fields["action"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Action); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for action") + } + val = func() json.RawMessage { + if v, ok := fields["l4"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.L4); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for l4") + } + val = func() json.RawMessage { + if v, ok := fields["access_group"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Access_group); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for access_group") + } + val = func() json.RawMessage { + if v, ok := fields["source"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Source); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for source") + } + val = func() json.RawMessage { + if v, ok := fields["destination"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Destination); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for destination") + } + return nil +} diff --git a/pkg/types/source.go b/pkg/types/source.go new file mode 100644 index 00000000..33938f92 --- /dev/null +++ b/pkg/types/source.go @@ -0,0 +1,219 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Source struct { + Ip string `json:"ip"` + + Port int32 `json:"port"` +} + +const SourceAvroCRC64Fingerprint = "\xee\xdf\xe6XΈQ\xb1" + +func NewSource() Source { + r := Source{} + return r +} + +func DeserializeSource(r io.Reader) (Source, error) { + t := NewSource() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeSourceFromSchema(r io.Reader, schema string) (Source, error) { + t := NewSource() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeSource(r Source, w io.Writer) error { + var err error + err = vm.WriteString(r.Ip, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Port, w) + if err != nil { + return err + } + return err +} + +func (r Source) Serialize(w io.Writer) error { + return writeSource(r, w) +} + +func (r Source) Schema() string { + return "{\"fields\":[{\"name\":\"ip\",\"type\":{\"arg.properties\":{\"options\":[\"204.149.41.63\",\"54.222.176.193\",\"122.120.109.66\",\"59.145.93.29\",\"222.85.75.48\",\"68.70.120.23\",\"8.243.217.97\",\"47.82.29.180\",\"182.23.41.165\",\"230.195.181.37\",\"45.206.35.54\",\"59.222.135.27\",\"178.74.178.202\",\"112.10.11.67\",\"231.62.195.226\",\"56.25.171.14\",\"72.206.143.236\",\"101.162.21.103\",\"98.24.15.221\",\"109.151.30.96\",\"67.143.145.10\",\"161.110.198.55\",\"56.186.158.4\",\"215.63.183.99\",\"173.218.229.93\",\"119.0.185.169\",\"13.206.166.235\",\"17.208.177.68\",\"230.234.177.180\",\"177.83.69.26\",\"109.78.222.30\",\"232.59.60.147\",\"250.173.99.68\",\"4.75.226.124\",\"174.185.97.9\",\"214.15.142.138\",\"84.46.49.248\",\"189.150.30.47\",\"226.178.139.46\",\"167.153.109.224\",\"126.147.106.47\",\"157.200.87.61\",\"131.255.186.13\",\"152.102.102.68\",\"214.177.4.5\",\"161.166.90.144\",\"98.160.215.50\",\"210.74.249.137\",\"244.64.29.244\",\"68.227.6.52\",\"141.228.33.77\",\"33.207.45.196\",\"60.35.239.48\",\"25.88.68.126\",\"239.126.133.195\",\"173.13.57.55\",\"134.23.137.5\",\"120.48.50.185\",\"215.90.55.197\",\"23.97.205.108\",\"117.250.191.255\",\"165.188.33.225\",\"153.41.174.133\",\"42.252.99.100\",\"12.42.99.54\",\"237.83.9.240\",\"137.148.240.223\",\"113.9.0.63\",\"73.126.21.73\",\"70.109.118.28\",\"121.166.215.228\",\"15.128.133.129\",\"156.64.22.26\",\"74.31.184.80\",\"32.110.165.153\",\"3.84.77.181\",\"106.45.159.209\",\"49.33.192.133\",\"66.95.63.195\",\"242.252.182.130\",\"245.91.183.42\",\"120.121.18.230\",\"144.81.168.91\",\"206.219.105.117\",\"225.242.249.169\",\"66.153.168.58\",\"160.199.67.92\",\"53.124.103.36\",\"94.51.180.226\",\"60.179.124.207\",\"4.126.94.49\",\"127.136.244.28\",\"171.169.227.52\",\"137.204.219.247\",\"20.195.159.248\",\"97.217.72.152\",\"152.30.133.188\",\"173.79.61.56\",\"173.119.145.171\",\"149.135.212.84\"]},\"type\":\"string\"}},{\"name\":\"port\",\"type\":{\"arg.properties\":{\"range\":{\"max\":99999,\"min\":10000}},\"type\":\"int\"}}],\"name\":\"siem.source\",\"type\":\"record\"}" +} + +func (r Source) SchemaName() string { + return "siem.source" +} + +func (_ Source) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Source) SetInt(v int32) { panic("Unsupported operation") } +func (_ Source) SetLong(v int64) { panic("Unsupported operation") } +func (_ Source) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Source) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Source) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Source) SetString(v string) { panic("Unsupported operation") } +func (_ Source) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Source) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Ip} + + return w + + case 1: + w := types.Int{Target: &r.Port} + + return w + + } + panic("Unknown field index") +} + +func (r *Source) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Source) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Source) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Source) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Source) HintSize(int) { panic("Unsupported operation") } +func (_ Source) Finalize() {} + +func (_ Source) AvroCRC64Fingerprint() []byte { + return []byte(SourceAvroCRC64Fingerprint) +} + +func (r Source) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["ip"], err = json.Marshal(r.Ip) + if err != nil { + return nil, err + } + output["port"], err = json.Marshal(r.Port) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Source) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip") + } + val = func() json.RawMessage { + if v, ok := fields["port"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Port); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for port") + } + return nil +} diff --git a/pkg/types/store.go b/pkg/types/store.go new file mode 100644 index 00000000..777c9a21 --- /dev/null +++ b/pkg/types/store.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Store struct { + Store_id int32 `json:"store_id"` + + City string `json:"city"` + + State string `json:"state"` +} + +const StoreAvroCRC64Fingerprint = "@\xb0\xdd\x02\xa49%;" + +func NewStore() Store { + r := Store{} + return r +} + +func DeserializeStore(r io.Reader) (Store, error) { + t := NewStore() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeStoreFromSchema(r io.Reader, schema string) (Store, error) { + t := NewStore() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeStore(r Store, w io.Writer) error { + var err error + err = vm.WriteInt(r.Store_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.City, w) + if err != nil { + return err + } + err = vm.WriteString(r.State, w) + if err != nil { + return err + } + return err +} + +func (r Store) Serialize(w io.Writer) error { + return writeStore(r, w) +} + +func (r Store) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"city\":\"Raleigh\",\"state\":\"NC\",\"store_id\":1},{\"city\":\"Chicago\",\"state\":\"IL\",\"store_id\":2},{\"city\":\"Sacramento\",\"state\":\"CA\",\"store_id\":3},{\"city\":\"Austin\",\"state\":\"TX\",\"store_id\":4},{\"city\":\"Boston\",\"state\":\"MA\",\"store_id\":5},{\"city\":\"Atlanta\",\"state\":\"GA\",\"store_id\":6},{\"city\":\"Lexington\",\"state\":\"SC\",\"store_id\":7}]},\"fields\":[{\"name\":\"store_id\",\"type\":\"int\"},{\"name\":\"city\",\"type\":\"string\"},{\"name\":\"state\",\"type\":\"string\"}],\"name\":\"store.store\",\"type\":\"record\"}" +} + +func (r Store) SchemaName() string { + return "store.store" +} + +func (_ Store) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Store) SetInt(v int32) { panic("Unsupported operation") } +func (_ Store) SetLong(v int64) { panic("Unsupported operation") } +func (_ Store) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Store) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Store) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Store) SetString(v string) { panic("Unsupported operation") } +func (_ Store) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Store) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Store_id} + + return w + + case 1: + w := types.String{Target: &r.City} + + return w + + case 2: + w := types.String{Target: &r.State} + + return w + + } + panic("Unknown field index") +} + +func (r *Store) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Store) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Store) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Store) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Store) HintSize(int) { panic("Unsupported operation") } +func (_ Store) Finalize() {} + +func (_ Store) AvroCRC64Fingerprint() []byte { + return []byte(StoreAvroCRC64Fingerprint) +} + +func (r Store) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["store_id"], err = json.Marshal(r.Store_id) + if err != nil { + return nil, err + } + output["city"], err = json.Marshal(r.City) + if err != nil { + return nil, err + } + output["state"], err = json.Marshal(r.State) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Store) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["store_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Store_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for store_id") + } + val = func() json.RawMessage { + if v, ok := fields["city"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.City); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for city") + } + val = func() json.RawMessage { + if v, ok := fields["state"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.State); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for state") + } + return nil +} diff --git a/pkg/types/syslog_log.go b/pkg/types/syslog_log.go new file mode 100644 index 00000000..3448d37d --- /dev/null +++ b/pkg/types/syslog_log.go @@ -0,0 +1,683 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type SyslogLog struct { + Name string `json:"name"` + + Type string `json:"type"` + + Message string `json:"message"` + + Host string `json:"host"` + + Version string `json:"version"` + + Tag string `json:"tag"` + + Level int32 `json:"level"` + + Facility string `json:"facility"` + + Severity int32 `json:"severity"` + + AppName string `json:"appName"` + + RemoteAddress string `json:"remoteAddress"` + + RawMessage string `json:"rawMessage"` + + ProcessId string `json:"processId"` + + MessageId string `json:"messageId"` + + DeviceVendor string `json:"deviceVendor"` + + DeviceProduct string `json:"deviceProduct"` + + DeviceVersion string `json:"deviceVersion"` + + Ts int64 `json:"ts"` +} + +const SyslogLogAvroCRC64Fingerprint = "\xaaIUYr\xa0\xe8\x13" + +func NewSyslogLog() SyslogLog { + r := SyslogLog{} + return r +} + +func DeserializeSyslogLog(r io.Reader) (SyslogLog, error) { + t := NewSyslogLog() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeSyslogLogFromSchema(r io.Reader, schema string) (SyslogLog, error) { + t := NewSyslogLog() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeSyslogLog(r SyslogLog, w io.Writer) error { + var err error + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Type, w) + if err != nil { + return err + } + err = vm.WriteString(r.Message, w) + if err != nil { + return err + } + err = vm.WriteString(r.Host, w) + if err != nil { + return err + } + err = vm.WriteString(r.Version, w) + if err != nil { + return err + } + err = vm.WriteString(r.Tag, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Level, w) + if err != nil { + return err + } + err = vm.WriteString(r.Facility, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Severity, w) + if err != nil { + return err + } + err = vm.WriteString(r.AppName, w) + if err != nil { + return err + } + err = vm.WriteString(r.RemoteAddress, w) + if err != nil { + return err + } + err = vm.WriteString(r.RawMessage, w) + if err != nil { + return err + } + err = vm.WriteString(r.ProcessId, w) + if err != nil { + return err + } + err = vm.WriteString(r.MessageId, w) + if err != nil { + return err + } + err = vm.WriteString(r.DeviceVendor, w) + if err != nil { + return err + } + err = vm.WriteString(r.DeviceProduct, w) + if err != nil { + return err + } + err = vm.WriteString(r.DeviceVersion, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Ts, w) + if err != nil { + return err + } + return err +} + +func (r SyslogLog) Serialize(w io.Writer) error { + return writeSyslogLog(r, w) +} + +func (r SyslogLog) Schema() string { + return "{\"fields\":[{\"name\":\"name\",\"type\":{\"arg.properties\":{\"regex\":\"[a-zA-Z]{5,8}\"},\"type\":\"string\"}},{\"name\":\"type\",\"type\":{\"arg.properties\":{\"options\":[\"RFC5424\",\"RFC3164\",\"CEF\",\"UNKNOWN\"]},\"type\":\"string\"}},{\"name\":\"message\",\"type\":{\"arg.properties\":{\"regex\":\"[a-z ]{10,15}\"},\"type\":\"string\"}},{\"name\":\"host\",\"type\":{\"arg.properties\":{\"options\":[\"121.46.66.201\",\"127.26.223.241\",\"185.167.200.143\",\"137.92.22.136\",\"191.84.20.142\",\"151.253.100.45\",\"76.115.125.169\",\"25.19.61.124\",\"140.136.224.11\",\"107.226.4.123\"]},\"type\":\"string\"}},{\"name\":\"version\",\"type\":{\"arg.properties\":{\"options\":[\"3.25.1\"]},\"type\":\"string\"}},{\"name\":\"tag\",\"type\":{\"arg.properties\":{\"options\":[\".source.s_src\"]},\"type\":\"string\"}},{\"name\":\"level\",\"type\":{\"arg.properties\":{\"range\":{\"max\":191,\"min\":0}},\"type\":\"int\"}},{\"name\":\"facility\",\"type\":{\"arg.properties\":{\"options\":[\"syslog\",\"authpriv\",\"cron\"]},\"type\":\"string\"}},{\"name\":\"severity\",\"type\":{\"arg.properties\":{\"range\":{\"max\":8,\"min\":0}},\"type\":\"int\"}},{\"name\":\"appName\",\"type\":{\"arg.properties\":{\"regex\":\"[A-Z]{5,8}\"},\"type\":\"string\"}},{\"name\":\"remoteAddress\",\"type\":{\"arg.properties\":{\"options\":[\"91.253.222.9\",\"48.92.8.255\",\"107.150.81.0\",\"254.11.108.139\",\"14.53.111.201\",\"215.70.232.123\",\"122.96.193.183\",\"185.128.89.135\",\"246.46.59.238\",\"238.158.147.172\"]},\"type\":\"string\"}},{\"name\":\"rawMessage\",\"type\":{\"arg.properties\":{\"regex\":\"[a-z ]{10,15}\"},\"type\":\"string\"}},{\"name\":\"processId\",\"type\":{\"arg.properties\":{\"regex\":\"[1-9]{1}[0-9]{6}\"},\"type\":\"string\"}},{\"name\":\"messageId\",\"type\":{\"arg.properties\":{\"regex\":\"[1-9]{1}[0-9]{2}\"},\"type\":\"string\"}},{\"name\":\"deviceVendor\",\"type\":{\"arg.properties\":{\"regex\":\"[a-z]{5}\"},\"type\":\"string\"}},{\"name\":\"deviceProduct\",\"type\":{\"arg.properties\":{\"regex\":\"[a-z]{5}\"},\"type\":\"string\"}},{\"name\":\"deviceVersion\",\"type\":{\"arg.properties\":{\"options\":[\"1.0\",\"2.0\",\"3.0\",\"4.0\",\"5.0\"]},\"type\":\"string\"}},{\"name\":\"ts\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1609459200000,\"step\":100}},\"type\":\"long\"}}],\"name\":\"syslog.SyslogLog\",\"type\":\"record\"}" +} + +func (r SyslogLog) SchemaName() string { + return "syslog.SyslogLog" +} + +func (_ SyslogLog) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ SyslogLog) SetInt(v int32) { panic("Unsupported operation") } +func (_ SyslogLog) SetLong(v int64) { panic("Unsupported operation") } +func (_ SyslogLog) SetFloat(v float32) { panic("Unsupported operation") } +func (_ SyslogLog) SetDouble(v float64) { panic("Unsupported operation") } +func (_ SyslogLog) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ SyslogLog) SetString(v string) { panic("Unsupported operation") } +func (_ SyslogLog) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *SyslogLog) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Name} + + return w + + case 1: + w := types.String{Target: &r.Type} + + return w + + case 2: + w := types.String{Target: &r.Message} + + return w + + case 3: + w := types.String{Target: &r.Host} + + return w + + case 4: + w := types.String{Target: &r.Version} + + return w + + case 5: + w := types.String{Target: &r.Tag} + + return w + + case 6: + w := types.Int{Target: &r.Level} + + return w + + case 7: + w := types.String{Target: &r.Facility} + + return w + + case 8: + w := types.Int{Target: &r.Severity} + + return w + + case 9: + w := types.String{Target: &r.AppName} + + return w + + case 10: + w := types.String{Target: &r.RemoteAddress} + + return w + + case 11: + w := types.String{Target: &r.RawMessage} + + return w + + case 12: + w := types.String{Target: &r.ProcessId} + + return w + + case 13: + w := types.String{Target: &r.MessageId} + + return w + + case 14: + w := types.String{Target: &r.DeviceVendor} + + return w + + case 15: + w := types.String{Target: &r.DeviceProduct} + + return w + + case 16: + w := types.String{Target: &r.DeviceVersion} + + return w + + case 17: + w := types.Long{Target: &r.Ts} + + return w + + } + panic("Unknown field index") +} + +func (r *SyslogLog) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *SyslogLog) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ SyslogLog) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ SyslogLog) AppendArray() types.Field { panic("Unsupported operation") } +func (_ SyslogLog) HintSize(int) { panic("Unsupported operation") } +func (_ SyslogLog) Finalize() {} + +func (_ SyslogLog) AvroCRC64Fingerprint() []byte { + return []byte(SyslogLogAvroCRC64Fingerprint) +} + +func (r SyslogLog) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["type"], err = json.Marshal(r.Type) + if err != nil { + return nil, err + } + output["message"], err = json.Marshal(r.Message) + if err != nil { + return nil, err + } + output["host"], err = json.Marshal(r.Host) + if err != nil { + return nil, err + } + output["version"], err = json.Marshal(r.Version) + if err != nil { + return nil, err + } + output["tag"], err = json.Marshal(r.Tag) + if err != nil { + return nil, err + } + output["level"], err = json.Marshal(r.Level) + if err != nil { + return nil, err + } + output["facility"], err = json.Marshal(r.Facility) + if err != nil { + return nil, err + } + output["severity"], err = json.Marshal(r.Severity) + if err != nil { + return nil, err + } + output["appName"], err = json.Marshal(r.AppName) + if err != nil { + return nil, err + } + output["remoteAddress"], err = json.Marshal(r.RemoteAddress) + if err != nil { + return nil, err + } + output["rawMessage"], err = json.Marshal(r.RawMessage) + if err != nil { + return nil, err + } + output["processId"], err = json.Marshal(r.ProcessId) + if err != nil { + return nil, err + } + output["messageId"], err = json.Marshal(r.MessageId) + if err != nil { + return nil, err + } + output["deviceVendor"], err = json.Marshal(r.DeviceVendor) + if err != nil { + return nil, err + } + output["deviceProduct"], err = json.Marshal(r.DeviceProduct) + if err != nil { + return nil, err + } + output["deviceVersion"], err = json.Marshal(r.DeviceVersion) + if err != nil { + return nil, err + } + output["ts"], err = json.Marshal(r.Ts) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *SyslogLog) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["type"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Type); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for type") + } + val = func() json.RawMessage { + if v, ok := fields["message"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Message); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for message") + } + val = func() json.RawMessage { + if v, ok := fields["host"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Host); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for host") + } + val = func() json.RawMessage { + if v, ok := fields["version"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Version); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for version") + } + val = func() json.RawMessage { + if v, ok := fields["tag"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Tag); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for tag") + } + val = func() json.RawMessage { + if v, ok := fields["level"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Level); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for level") + } + val = func() json.RawMessage { + if v, ok := fields["facility"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Facility); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for facility") + } + val = func() json.RawMessage { + if v, ok := fields["severity"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Severity); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for severity") + } + val = func() json.RawMessage { + if v, ok := fields["appName"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.AppName); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for appName") + } + val = func() json.RawMessage { + if v, ok := fields["remoteAddress"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.RemoteAddress); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for remoteAddress") + } + val = func() json.RawMessage { + if v, ok := fields["rawMessage"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.RawMessage); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for rawMessage") + } + val = func() json.RawMessage { + if v, ok := fields["processId"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.ProcessId); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for processId") + } + val = func() json.RawMessage { + if v, ok := fields["messageId"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.MessageId); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for messageId") + } + val = func() json.RawMessage { + if v, ok := fields["deviceVendor"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.DeviceVendor); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for deviceVendor") + } + val = func() json.RawMessage { + if v, ok := fields["deviceProduct"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.DeviceProduct); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for deviceProduct") + } + val = func() json.RawMessage { + if v, ok := fields["deviceVersion"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.DeviceVersion); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for deviceVersion") + } + val = func() json.RawMessage { + if v, ok := fields["ts"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ts); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ts") + } + return nil +} diff --git a/pkg/types/user.go b/pkg/types/user.go new file mode 100644 index 00000000..f2dd0239 --- /dev/null +++ b/pkg/types/user.go @@ -0,0 +1,509 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type User struct { + Guid string `json:"guid"` + + IsActive bool `json:"isActive"` + + Balance string `json:"balance"` + + Age int32 `json:"age"` + + EyeColor string `json:"eyeColor"` + + Name string `json:"name"` + + Company string `json:"company"` + + Work_email string `json:"work_email"` + + Email string `json:"email"` + + About string `json:"about"` + + Latitude float32 `json:"latitude"` + + Longitude float32 `json:"longitude"` +} + +const UserAvroCRC64Fingerprint = "\xa3\x92\xb3ۆ\xac\xcd\xd4" + +func NewUser() User { + r := User{} + return r +} + +func DeserializeUser(r io.Reader) (User, error) { + t := NewUser() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeUserFromSchema(r io.Reader, schema string) (User, error) { + t := NewUser() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeUser(r User, w io.Writer) error { + var err error + err = vm.WriteString(r.Guid, w) + if err != nil { + return err + } + err = vm.WriteBool(r.IsActive, w) + if err != nil { + return err + } + err = vm.WriteString(r.Balance, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Age, w) + if err != nil { + return err + } + err = vm.WriteString(r.EyeColor, w) + if err != nil { + return err + } + err = vm.WriteString(r.Name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Company, w) + if err != nil { + return err + } + err = vm.WriteString(r.Work_email, w) + if err != nil { + return err + } + err = vm.WriteString(r.Email, w) + if err != nil { + return err + } + err = vm.WriteString(r.About, w) + if err != nil { + return err + } + err = vm.WriteFloat(r.Latitude, w) + if err != nil { + return err + } + err = vm.WriteFloat(r.Longitude, w) + if err != nil { + return err + } + return err +} + +func (r User) Serialize(w io.Writer) error { + return writeUser(r, w) +} + +func (r User) Schema() string { + return "{\"fields\":[{\"name\":\"guid\",\"type\":\"string\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"balance\",\"type\":\"string\"},{\"name\":\"age\",\"type\":\"int\"},{\"name\":\"eyeColor\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"company\",\"type\":\"string\"},{\"name\":\"work_email\",\"type\":\"string\"},{\"name\":\"email\",\"type\":\"string\"},{\"name\":\"about\",\"type\":\"string\"},{\"name\":\"latitude\",\"type\":\"float\"},{\"name\":\"longitude\",\"type\":\"float\"}],\"name\":\"user.User\",\"type\":\"record\"}" +} + +func (r User) SchemaName() string { + return "user.User" +} + +func (_ User) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ User) SetInt(v int32) { panic("Unsupported operation") } +func (_ User) SetLong(v int64) { panic("Unsupported operation") } +func (_ User) SetFloat(v float32) { panic("Unsupported operation") } +func (_ User) SetDouble(v float64) { panic("Unsupported operation") } +func (_ User) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ User) SetString(v string) { panic("Unsupported operation") } +func (_ User) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *User) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Guid} + + return w + + case 1: + w := types.Boolean{Target: &r.IsActive} + + return w + + case 2: + w := types.String{Target: &r.Balance} + + return w + + case 3: + w := types.Int{Target: &r.Age} + + return w + + case 4: + w := types.String{Target: &r.EyeColor} + + return w + + case 5: + w := types.String{Target: &r.Name} + + return w + + case 6: + w := types.String{Target: &r.Company} + + return w + + case 7: + w := types.String{Target: &r.Work_email} + + return w + + case 8: + w := types.String{Target: &r.Email} + + return w + + case 9: + w := types.String{Target: &r.About} + + return w + + case 10: + w := types.Float{Target: &r.Latitude} + + return w + + case 11: + w := types.Float{Target: &r.Longitude} + + return w + + } + panic("Unknown field index") +} + +func (r *User) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *User) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ User) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ User) AppendArray() types.Field { panic("Unsupported operation") } +func (_ User) HintSize(int) { panic("Unsupported operation") } +func (_ User) Finalize() {} + +func (_ User) AvroCRC64Fingerprint() []byte { + return []byte(UserAvroCRC64Fingerprint) +} + +func (r User) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["guid"], err = json.Marshal(r.Guid) + if err != nil { + return nil, err + } + output["isActive"], err = json.Marshal(r.IsActive) + if err != nil { + return nil, err + } + output["balance"], err = json.Marshal(r.Balance) + if err != nil { + return nil, err + } + output["age"], err = json.Marshal(r.Age) + if err != nil { + return nil, err + } + output["eyeColor"], err = json.Marshal(r.EyeColor) + if err != nil { + return nil, err + } + output["name"], err = json.Marshal(r.Name) + if err != nil { + return nil, err + } + output["company"], err = json.Marshal(r.Company) + if err != nil { + return nil, err + } + output["work_email"], err = json.Marshal(r.Work_email) + if err != nil { + return nil, err + } + output["email"], err = json.Marshal(r.Email) + if err != nil { + return nil, err + } + output["about"], err = json.Marshal(r.About) + if err != nil { + return nil, err + } + output["latitude"], err = json.Marshal(r.Latitude) + if err != nil { + return nil, err + } + output["longitude"], err = json.Marshal(r.Longitude) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *User) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["guid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Guid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for guid") + } + val = func() json.RawMessage { + if v, ok := fields["isActive"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.IsActive); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for isActive") + } + val = func() json.RawMessage { + if v, ok := fields["balance"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Balance); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for balance") + } + val = func() json.RawMessage { + if v, ok := fields["age"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Age); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for age") + } + val = func() json.RawMessage { + if v, ok := fields["eyeColor"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.EyeColor); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for eyeColor") + } + val = func() json.RawMessage { + if v, ok := fields["name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for name") + } + val = func() json.RawMessage { + if v, ok := fields["company"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Company); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for company") + } + val = func() json.RawMessage { + if v, ok := fields["work_email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Work_email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for work_email") + } + val = func() json.RawMessage { + if v, ok := fields["email"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Email); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for email") + } + val = func() json.RawMessage { + if v, ok := fields["about"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.About); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for about") + } + val = func() json.RawMessage { + if v, ok := fields["latitude"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Latitude); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for latitude") + } + val = func() json.RawMessage { + if v, ok := fields["longitude"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Longitude); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for longitude") + } + return nil +} diff --git a/pkg/types/users.go b/pkg/types/users.go new file mode 100644 index 00000000..1e2e5beb --- /dev/null +++ b/pkg/types/users.go @@ -0,0 +1,277 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type Users struct { + Registertime int64 `json:"registertime"` + + Userid string `json:"userid"` + + Regionid string `json:"regionid"` + + Gender string `json:"gender"` +} + +const UsersAvroCRC64Fingerprint = ".\xf0\x93:!\xbc\xa7\xc1" + +func NewUsers() Users { + r := Users{} + return r +} + +func DeserializeUsers(r io.Reader) (Users, error) { + t := NewUsers() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeUsersFromSchema(r io.Reader, schema string) (Users, error) { + t := NewUsers() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeUsers(r Users, w io.Writer) error { + var err error + err = vm.WriteLong(r.Registertime, w) + if err != nil { + return err + } + err = vm.WriteString(r.Userid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Regionid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Gender, w) + if err != nil { + return err + } + return err +} + +func (r Users) Serialize(w io.Writer) error { + return writeUsers(r, w) +} + +func (r Users) Schema() string { + return "{\"fields\":[{\"name\":\"registertime\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1519273364600,\"min\":1487715775521}},\"type\":\"long\"}},{\"name\":\"userid\",\"type\":{\"arg.properties\":{\"regex\":\"User_[1-9]\"},\"type\":\"string\"}},{\"name\":\"regionid\",\"type\":{\"arg.properties\":{\"regex\":\"Region_[1-9]\"},\"type\":\"string\"}},{\"name\":\"gender\",\"type\":{\"arg.properties\":{\"options\":[\"MALE\",\"FEMALE\",\"OTHER\"]},\"type\":\"string\"}}],\"name\":\"user.users\",\"type\":\"record\"}" +} + +func (r Users) SchemaName() string { + return "user.users" +} + +func (_ Users) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ Users) SetInt(v int32) { panic("Unsupported operation") } +func (_ Users) SetLong(v int64) { panic("Unsupported operation") } +func (_ Users) SetFloat(v float32) { panic("Unsupported operation") } +func (_ Users) SetDouble(v float64) { panic("Unsupported operation") } +func (_ Users) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ Users) SetString(v string) { panic("Unsupported operation") } +func (_ Users) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *Users) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Registertime} + + return w + + case 1: + w := types.String{Target: &r.Userid} + + return w + + case 2: + w := types.String{Target: &r.Regionid} + + return w + + case 3: + w := types.String{Target: &r.Gender} + + return w + + } + panic("Unknown field index") +} + +func (r *Users) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *Users) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ Users) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ Users) AppendArray() types.Field { panic("Unsupported operation") } +func (_ Users) HintSize(int) { panic("Unsupported operation") } +func (_ Users) Finalize() {} + +func (_ Users) AvroCRC64Fingerprint() []byte { + return []byte(UsersAvroCRC64Fingerprint) +} + +func (r Users) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["registertime"], err = json.Marshal(r.Registertime) + if err != nil { + return nil, err + } + output["userid"], err = json.Marshal(r.Userid) + if err != nil { + return nil, err + } + output["regionid"], err = json.Marshal(r.Regionid) + if err != nil { + return nil, err + } + output["gender"], err = json.Marshal(r.Gender) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *Users) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["registertime"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Registertime); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for registertime") + } + val = func() json.RawMessage { + if v, ok := fields["userid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Userid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for userid") + } + val = func() json.RawMessage { + if v, ok := fields["regionid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Regionid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for regionid") + } + val = func() json.RawMessage { + if v, ok := fields["gender"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Gender); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for gender") + } + return nil +} diff --git a/pkg/types/users_array_map.go b/pkg/types/users_array_map.go new file mode 100644 index 00000000..a1f72558 --- /dev/null +++ b/pkg/types/users_array_map.go @@ -0,0 +1,343 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type UsersArrayMap struct { + Registertime int64 `json:"registertime"` + + Userid string `json:"userid"` + + Regionid string `json:"regionid"` + + Gender string `json:"gender"` + + Interests []string `json:"interests"` + + Contactinfo map[string]string `json:"contactinfo"` +} + +const UsersArrayMapAvroCRC64Fingerprint = ">\xfa\bBZT\xc8T" + +func NewUsersArrayMap() UsersArrayMap { + r := UsersArrayMap{} + r.Interests = make([]string, 0) + + r.Contactinfo = make(map[string]string) + + return r +} + +func DeserializeUsersArrayMap(r io.Reader) (UsersArrayMap, error) { + t := NewUsersArrayMap() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeUsersArrayMapFromSchema(r io.Reader, schema string) (UsersArrayMap, error) { + t := NewUsersArrayMap() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeUsersArrayMap(r UsersArrayMap, w io.Writer) error { + var err error + err = vm.WriteLong(r.Registertime, w) + if err != nil { + return err + } + err = vm.WriteString(r.Userid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Regionid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Gender, w) + if err != nil { + return err + } + err = writeArrayString(r.Interests, w) + if err != nil { + return err + } + err = writeMapString(r.Contactinfo, w) + if err != nil { + return err + } + return err +} + +func (r UsersArrayMap) Serialize(w io.Writer) error { + return writeUsersArrayMap(r, w) +} + +func (r UsersArrayMap) Schema() string { + return "{\"fields\":[{\"name\":\"registertime\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1519273364600,\"min\":1487715775521}},\"type\":\"long\"}},{\"name\":\"userid\",\"type\":{\"arg.properties\":{\"regex\":\"User_[1-9]\"},\"type\":\"string\"}},{\"name\":\"regionid\",\"type\":{\"arg.properties\":{\"regex\":\"Region_[1-9]\"},\"type\":\"string\"}},{\"name\":\"gender\",\"type\":{\"arg.properties\":{\"options\":[\"MALE\",\"FEMALE\",\"OTHER\"]},\"type\":\"string\"}},{\"name\":\"interests\",\"type\":{\"arg.properties\":{\"options\":[[\"Game\",\"News\"],[\"Game\",\"Sport\"],[\"News\",\"Movies\"],[\"News\",\"Travel\"]]},\"items\":\"string\",\"type\":\"array\"}},{\"name\":\"contactinfo\",\"type\":{\"arg.properties\":{\"options\":[{\"city\":\"San Mateo\",\"phone\":\"6503349999\",\"state\":\"CA\",\"zipcode\":\"94403\"},{\"city\":\"Irvine\",\"phone\":\"9492229999\",\"state\":\"CA\",\"zipcode\":\"92617\"},{\"city\":\"Palo Alto\",\"phone\":\"6503889999\",\"state\":\"CA\",\"zipcode\":\"94301\"},{\"city\":\"San Jose\",\"phone\":\"4083366881\",\"state\":\"CA\",\"zipcode\":\"95112\"},{\"city\":\"San Carlos\",\"phone\":\"6502215368\",\"state\":\"CA\",\"zipcode\":\"94070\"}]},\"type\":\"map\",\"values\":\"string\"}}],\"name\":\"user.UsersArrayMap\",\"type\":\"record\"}" +} + +func (r UsersArrayMap) SchemaName() string { + return "user.UsersArrayMap" +} + +func (_ UsersArrayMap) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetInt(v int32) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetLong(v int64) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetFloat(v float32) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetDouble(v float64) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetString(v string) { panic("Unsupported operation") } +func (_ UsersArrayMap) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *UsersArrayMap) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Registertime} + + return w + + case 1: + w := types.String{Target: &r.Userid} + + return w + + case 2: + w := types.String{Target: &r.Regionid} + + return w + + case 3: + w := types.String{Target: &r.Gender} + + return w + + case 4: + r.Interests = make([]string, 0) + + w := ArrayStringWrapper{Target: &r.Interests} + + return w + + case 5: + r.Contactinfo = make(map[string]string) + + w := MapStringWrapper{Target: &r.Contactinfo} + + return &w + + } + panic("Unknown field index") +} + +func (r *UsersArrayMap) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *UsersArrayMap) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ UsersArrayMap) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ UsersArrayMap) AppendArray() types.Field { panic("Unsupported operation") } +func (_ UsersArrayMap) HintSize(int) { panic("Unsupported operation") } +func (_ UsersArrayMap) Finalize() {} + +func (_ UsersArrayMap) AvroCRC64Fingerprint() []byte { + return []byte(UsersArrayMapAvroCRC64Fingerprint) +} + +func (r UsersArrayMap) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["registertime"], err = json.Marshal(r.Registertime) + if err != nil { + return nil, err + } + output["userid"], err = json.Marshal(r.Userid) + if err != nil { + return nil, err + } + output["regionid"], err = json.Marshal(r.Regionid) + if err != nil { + return nil, err + } + output["gender"], err = json.Marshal(r.Gender) + if err != nil { + return nil, err + } + output["interests"], err = json.Marshal(r.Interests) + if err != nil { + return nil, err + } + output["contactinfo"], err = json.Marshal(r.Contactinfo) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *UsersArrayMap) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["registertime"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Registertime); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for registertime") + } + val = func() json.RawMessage { + if v, ok := fields["userid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Userid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for userid") + } + val = func() json.RawMessage { + if v, ok := fields["regionid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Regionid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for regionid") + } + val = func() json.RawMessage { + if v, ok := fields["gender"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Gender); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for gender") + } + val = func() json.RawMessage { + if v, ok := fields["interests"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Interests); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for interests") + } + val = func() json.RawMessage { + if v, ok := fields["contactinfo"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Contactinfo); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for contactinfo") + } + return nil +} diff --git a/pkg/types/webanalytics_clickstream.go b/pkg/types/webanalytics_clickstream.go new file mode 100644 index 00000000..eeebec5d --- /dev/null +++ b/pkg/types/webanalytics_clickstream.go @@ -0,0 +1,451 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type WebanalyticsClickstream struct { + Ip string `json:"ip"` + + Userid int32 `json:"userid"` + + Remote_user string `json:"remote_user"` + + Time string `json:"time"` + + Logtime int64 `json:"_logtime"` + + Request string `json:"request"` + + Status string `json:"status"` + + Bytes string `json:"bytes"` + + Referrer string `json:"referrer"` + + Agent string `json:"agent"` +} + +const WebanalyticsClickstreamAvroCRC64Fingerprint = "\xda\xddcK\xd0.\xf9z" + +func NewWebanalyticsClickstream() WebanalyticsClickstream { + r := WebanalyticsClickstream{} + return r +} + +func DeserializeWebanalyticsClickstream(r io.Reader) (WebanalyticsClickstream, error) { + t := NewWebanalyticsClickstream() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeWebanalyticsClickstreamFromSchema(r io.Reader, schema string) (WebanalyticsClickstream, error) { + t := NewWebanalyticsClickstream() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeWebanalyticsClickstream(r WebanalyticsClickstream, w io.Writer) error { + var err error + err = vm.WriteString(r.Ip, w) + if err != nil { + return err + } + err = vm.WriteInt(r.Userid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Remote_user, w) + if err != nil { + return err + } + err = vm.WriteString(r.Time, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Logtime, w) + if err != nil { + return err + } + err = vm.WriteString(r.Request, w) + if err != nil { + return err + } + err = vm.WriteString(r.Status, w) + if err != nil { + return err + } + err = vm.WriteString(r.Bytes, w) + if err != nil { + return err + } + err = vm.WriteString(r.Referrer, w) + if err != nil { + return err + } + err = vm.WriteString(r.Agent, w) + if err != nil { + return err + } + return err +} + +func (r WebanalyticsClickstream) Serialize(w io.Writer) error { + return writeWebanalyticsClickstream(r, w) +} + +func (r WebanalyticsClickstream) Schema() string { + return "{\"fields\":[{\"name\":\"ip\",\"type\":{\"arg.properties\":{\"options\":[\"111.152.45.45\",\"111.203.236.146\",\"111.168.57.122\",\"111.249.79.93\",\"111.168.57.122\",\"111.90.225.227\",\"111.173.165.103\",\"111.145.8.144\",\"111.245.174.248\",\"111.245.174.111\",\"222.152.45.45\",\"222.203.236.146\",\"222.168.57.122\",\"222.249.79.93\",\"222.168.57.122\",\"222.90.225.227\",\"222.173.165.103\",\"222.145.8.144\",\"222.245.174.248\",\"222.245.174.222\",\"122.152.45.245\",\"122.203.236.246\",\"122.168.57.222\",\"122.249.79.233\",\"122.168.57.222\",\"122.90.225.227\",\"122.173.165.203\",\"122.145.8.244\",\"122.245.174.248\",\"122.245.174.122\",\"233.152.245.45\",\"233.203.236.146\",\"233.168.257.122\",\"233.249.279.93\",\"233.168.257.122\",\"233.90.225.227\",\"233.173.215.103\",\"233.145.28.144\",\"233.245.174.248\",\"233.245.174.233\"]},\"session\":\"true\",\"type\":\"string\"}},{\"name\":\"userid\",\"type\":{\"arg.properties\":{\"range\":{\"max\":40,\"min\":-1}},\"session-sibling-int-hash\":\"true\",\"type\":\"int\"}},{\"name\":\"remote_user\",\"type\":{\"arg.properties\":{\"options\":[\"-\"]},\"type\":\"string\"}},{\"name\":\"time\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1,\"step\":10}},\"format_as_time\":\"dd/MMM/yyyy:HH:mm:ss Z\",\"type\":\"string\"}},{\"name\":\"_logtime\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1,\"step\":10}},\"format_as_time\":\"unix_long\",\"type\":\"long\"}},{\"name\":\"request\",\"type\":{\"arg.properties\":{\"options\":[\"GET /index.html HTTP/1.1\",\"GET /site/user_status.html HTTP/1.1\",\"GET /site/login.html HTTP/1.1\",\"GET /site/user_status.html HTTP/1.1\",\"GET /images/track.png HTTP/1.1\",\"GET /images/logo-small.png HTTP/1.1\"]},\"type\":\"string\"}},{\"name\":\"status\",\"type\":{\"arg.properties\":{\"options\":[\"200\",\"302\",\"404\",\"405\",\"406\",\"407\"]},\"type\":\"string\"}},{\"name\":\"bytes\",\"type\":{\"arg.properties\":{\"options\":[\"278\",\"1289\",\"2048\",\"4096\",\"4006\",\"4196\",\"14096\"]},\"type\":\"string\"}},{\"name\":\"referrer\",\"type\":{\"arg.properties\":{\"options\":[\"-\"]},\"type\":\"string\"}},{\"name\":\"agent\",\"type\":{\"arg.properties\":{\"options\":[\"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\",\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"]},\"type\":\"string\"}}],\"name\":\"webanalytics.WebanalyticsClickstream\",\"type\":\"record\"}" +} + +func (r WebanalyticsClickstream) SchemaName() string { + return "webanalytics.WebanalyticsClickstream" +} + +func (_ WebanalyticsClickstream) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetInt(v int32) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetLong(v int64) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetFloat(v float32) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetDouble(v float64) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetString(v string) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *WebanalyticsClickstream) Get(i int) types.Field { + switch i { + case 0: + w := types.String{Target: &r.Ip} + + return w + + case 1: + w := types.Int{Target: &r.Userid} + + return w + + case 2: + w := types.String{Target: &r.Remote_user} + + return w + + case 3: + w := types.String{Target: &r.Time} + + return w + + case 4: + w := types.Long{Target: &r.Logtime} + + return w + + case 5: + w := types.String{Target: &r.Request} + + return w + + case 6: + w := types.String{Target: &r.Status} + + return w + + case 7: + w := types.String{Target: &r.Bytes} + + return w + + case 8: + w := types.String{Target: &r.Referrer} + + return w + + case 9: + w := types.String{Target: &r.Agent} + + return w + + } + panic("Unknown field index") +} + +func (r *WebanalyticsClickstream) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *WebanalyticsClickstream) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ WebanalyticsClickstream) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) AppendArray() types.Field { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) HintSize(int) { panic("Unsupported operation") } +func (_ WebanalyticsClickstream) Finalize() {} + +func (_ WebanalyticsClickstream) AvroCRC64Fingerprint() []byte { + return []byte(WebanalyticsClickstreamAvroCRC64Fingerprint) +} + +func (r WebanalyticsClickstream) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["ip"], err = json.Marshal(r.Ip) + if err != nil { + return nil, err + } + output["userid"], err = json.Marshal(r.Userid) + if err != nil { + return nil, err + } + output["remote_user"], err = json.Marshal(r.Remote_user) + if err != nil { + return nil, err + } + output["time"], err = json.Marshal(r.Time) + if err != nil { + return nil, err + } + output["_logtime"], err = json.Marshal(r.Logtime) + if err != nil { + return nil, err + } + output["request"], err = json.Marshal(r.Request) + if err != nil { + return nil, err + } + output["status"], err = json.Marshal(r.Status) + if err != nil { + return nil, err + } + output["bytes"], err = json.Marshal(r.Bytes) + if err != nil { + return nil, err + } + output["referrer"], err = json.Marshal(r.Referrer) + if err != nil { + return nil, err + } + output["agent"], err = json.Marshal(r.Agent) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *WebanalyticsClickstream) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["ip"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Ip); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for ip") + } + val = func() json.RawMessage { + if v, ok := fields["userid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Userid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for userid") + } + val = func() json.RawMessage { + if v, ok := fields["remote_user"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Remote_user); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for remote_user") + } + val = func() json.RawMessage { + if v, ok := fields["time"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Time); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for time") + } + val = func() json.RawMessage { + if v, ok := fields["_logtime"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Logtime); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for _logtime") + } + val = func() json.RawMessage { + if v, ok := fields["request"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Request); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for request") + } + val = func() json.RawMessage { + if v, ok := fields["status"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Status); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for status") + } + val = func() json.RawMessage { + if v, ok := fields["bytes"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Bytes); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for bytes") + } + val = func() json.RawMessage { + if v, ok := fields["referrer"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Referrer); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for referrer") + } + val = func() json.RawMessage { + if v, ok := fields["agent"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Agent); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for agent") + } + return nil +} diff --git a/pkg/types/webanalytics_code.go b/pkg/types/webanalytics_code.go new file mode 100644 index 00000000..70732584 --- /dev/null +++ b/pkg/types/webanalytics_code.go @@ -0,0 +1,219 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type WebanalyticsCode struct { + Code int32 `json:"code"` + + Definition string `json:"definition"` +} + +const WebanalyticsCodeAvroCRC64Fingerprint = "i\xce/\xb4\xc65\xa5." + +func NewWebanalyticsCode() WebanalyticsCode { + r := WebanalyticsCode{} + return r +} + +func DeserializeWebanalyticsCode(r io.Reader) (WebanalyticsCode, error) { + t := NewWebanalyticsCode() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeWebanalyticsCodeFromSchema(r io.Reader, schema string) (WebanalyticsCode, error) { + t := NewWebanalyticsCode() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeWebanalyticsCode(r WebanalyticsCode, w io.Writer) error { + var err error + err = vm.WriteInt(r.Code, w) + if err != nil { + return err + } + err = vm.WriteString(r.Definition, w) + if err != nil { + return err + } + return err +} + +func (r WebanalyticsCode) Serialize(w io.Writer) error { + return writeWebanalyticsCode(r, w) +} + +func (r WebanalyticsCode) Schema() string { + return "{\"arg.properties\":{\"options\":[{\"code\":200,\"definition\":\"Successful\"},{\"code\":302,\"definition\":\"Redirect\"},{\"code\":404,\"definition\":\"Page not found\"},{\"code\":405,\"definition\":\"Method not allowed\"},{\"code\":406,\"definition\":\"Not acceptable\"},{\"code\":407,\"definition\":\"Proxy authentication required\"}]},\"fields\":[{\"name\":\"code\",\"type\":\"int\"},{\"name\":\"definition\",\"type\":\"string\"}],\"name\":\"webanalytics.WebanalyticsCode\",\"type\":\"record\"}" +} + +func (r WebanalyticsCode) SchemaName() string { + return "webanalytics.WebanalyticsCode" +} + +func (_ WebanalyticsCode) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetInt(v int32) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetLong(v int64) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetFloat(v float32) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetDouble(v float64) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetString(v string) { panic("Unsupported operation") } +func (_ WebanalyticsCode) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *WebanalyticsCode) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.Code} + + return w + + case 1: + w := types.String{Target: &r.Definition} + + return w + + } + panic("Unknown field index") +} + +func (r *WebanalyticsCode) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *WebanalyticsCode) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ WebanalyticsCode) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ WebanalyticsCode) AppendArray() types.Field { panic("Unsupported operation") } +func (_ WebanalyticsCode) HintSize(int) { panic("Unsupported operation") } +func (_ WebanalyticsCode) Finalize() {} + +func (_ WebanalyticsCode) AvroCRC64Fingerprint() []byte { + return []byte(WebanalyticsCodeAvroCRC64Fingerprint) +} + +func (r WebanalyticsCode) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["code"], err = json.Marshal(r.Code) + if err != nil { + return nil, err + } + output["definition"], err = json.Marshal(r.Definition) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *WebanalyticsCode) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["code"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Code); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for code") + } + val = func() json.RawMessage { + if v, ok := fields["definition"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Definition); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for definition") + } + return nil +} diff --git a/pkg/types/webanalytics_page_view.go b/pkg/types/webanalytics_page_view.go new file mode 100644 index 00000000..a910640e --- /dev/null +++ b/pkg/types/webanalytics_page_view.go @@ -0,0 +1,248 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type WebanalyticsPageView struct { + Viewtime int64 `json:"viewtime"` + + Userid string `json:"userid"` + + Pageid string `json:"pageid"` +} + +const WebanalyticsPageViewAvroCRC64Fingerprint = "\xb9ĩ}Y\xb06\xb3" + +func NewWebanalyticsPageView() WebanalyticsPageView { + r := WebanalyticsPageView{} + return r +} + +func DeserializeWebanalyticsPageView(r io.Reader) (WebanalyticsPageView, error) { + t := NewWebanalyticsPageView() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeWebanalyticsPageViewFromSchema(r io.Reader, schema string) (WebanalyticsPageView, error) { + t := NewWebanalyticsPageView() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeWebanalyticsPageView(r WebanalyticsPageView, w io.Writer) error { + var err error + err = vm.WriteLong(r.Viewtime, w) + if err != nil { + return err + } + err = vm.WriteString(r.Userid, w) + if err != nil { + return err + } + err = vm.WriteString(r.Pageid, w) + if err != nil { + return err + } + return err +} + +func (r WebanalyticsPageView) Serialize(w io.Writer) error { + return writeWebanalyticsPageView(r, w) +} + +func (r WebanalyticsPageView) Schema() string { + return "{\"fields\":[{\"name\":\"viewtime\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1,\"step\":10}},\"format_as_time\":\"unix_long\",\"type\":\"long\"}},{\"name\":\"userid\",\"type\":{\"arg.properties\":{\"regex\":\"User_[1-9]\"},\"type\":\"string\"}},{\"name\":\"pageid\",\"type\":{\"arg.properties\":{\"regex\":\"Page_[1-9][0-9]\"},\"type\":\"string\"}}],\"name\":\"webanalytics.WebanalyticsPageView\",\"type\":\"record\"}" +} + +func (r WebanalyticsPageView) SchemaName() string { + return "webanalytics.WebanalyticsPageView" +} + +func (_ WebanalyticsPageView) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetInt(v int32) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetLong(v int64) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetFloat(v float32) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetDouble(v float64) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetString(v string) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *WebanalyticsPageView) Get(i int) types.Field { + switch i { + case 0: + w := types.Long{Target: &r.Viewtime} + + return w + + case 1: + w := types.String{Target: &r.Userid} + + return w + + case 2: + w := types.String{Target: &r.Pageid} + + return w + + } + panic("Unknown field index") +} + +func (r *WebanalyticsPageView) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *WebanalyticsPageView) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ WebanalyticsPageView) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ WebanalyticsPageView) AppendArray() types.Field { panic("Unsupported operation") } +func (_ WebanalyticsPageView) HintSize(int) { panic("Unsupported operation") } +func (_ WebanalyticsPageView) Finalize() {} + +func (_ WebanalyticsPageView) AvroCRC64Fingerprint() []byte { + return []byte(WebanalyticsPageViewAvroCRC64Fingerprint) +} + +func (r WebanalyticsPageView) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["viewtime"], err = json.Marshal(r.Viewtime) + if err != nil { + return nil, err + } + output["userid"], err = json.Marshal(r.Userid) + if err != nil { + return nil, err + } + output["pageid"], err = json.Marshal(r.Pageid) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *WebanalyticsPageView) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["viewtime"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Viewtime); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for viewtime") + } + val = func() json.RawMessage { + if v, ok := fields["userid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Userid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for userid") + } + val = func() json.RawMessage { + if v, ok := fields["pageid"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Pageid); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for pageid") + } + return nil +} diff --git a/pkg/types/webanalytics_user.go b/pkg/types/webanalytics_user.go new file mode 100644 index 00000000..e1ff3944 --- /dev/null +++ b/pkg/types/webanalytics_user.go @@ -0,0 +1,364 @@ +// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT. +/* + * SOURCES: + * csv_product.avsc + * csv_user.avsc + * finance_stock_trade.avsc + * fleetmgmt_description.avsc + * fleetmgmt_location.avsc + * fleetmgmt_sensor.avsc + * gaming_game.avsc + * gaming_player.avsc + * gaming_player_activity.avsc + * genericstore_purchase.avsc + * insurance_customer.avsc + * insurance_customer_activity.avsc + * insurance_offer.avsc + * inventorymgmt_inventory.avsc + * inventorymgmt_product.avsc + * iot_device_information.avsc + * map_dumb_schema.avsc + * marketing_campaign_finance.avsc + * net_device.avsc + * payment_credit_card.avsc + * payment_transaction.avsc + * payroll_bonus.avsc + * payroll_employee.avsc + * payroll_employee_location.avsc + * pizzastore_order.avsc + * pizzastore_order_cancelled.avsc + * pizzastore_order_completed.avsc + * shoestore_clickstream.avsc + * shoestore_customer.avsc + * shoestore_order.avsc + * shoestore_shoe.avsc + * shopping_order.avsc + * shopping_rating.avsc + * siem_log.avsc + * store.avsc + * syslog_log.avsc + * user.avsc + * users.avsc + * users_array_map.avsc + * webanalytics_clickstream.avsc + * webanalytics_code.avsc + * webanalytics_page_view.avsc + * webanalytics_user.avsc + */ +package types + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/actgardner/gogen-avro/v10/compiler" + "github.com/actgardner/gogen-avro/v10/vm" + "github.com/actgardner/gogen-avro/v10/vm/types" +) + +var _ = fmt.Printf + +type WebanalyticsUser struct { + User_id int32 `json:"user_id"` + + Username string `json:"username"` + + Registered_at int64 `json:"registered_at"` + + First_name string `json:"first_name"` + + Last_name string `json:"last_name"` + + City string `json:"city"` + + Level string `json:"level"` +} + +const WebanalyticsUserAvroCRC64Fingerprint = "\xb90\xfe\xbfˀ\b\x89" + +func NewWebanalyticsUser() WebanalyticsUser { + r := WebanalyticsUser{} + return r +} + +func DeserializeWebanalyticsUser(r io.Reader) (WebanalyticsUser, error) { + t := NewWebanalyticsUser() + deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func DeserializeWebanalyticsUserFromSchema(r io.Reader, schema string) (WebanalyticsUser, error) { + t := NewWebanalyticsUser() + + deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema())) + if err != nil { + return t, err + } + + err = vm.Eval(r, deser, &t) + return t, err +} + +func writeWebanalyticsUser(r WebanalyticsUser, w io.Writer) error { + var err error + err = vm.WriteInt(r.User_id, w) + if err != nil { + return err + } + err = vm.WriteString(r.Username, w) + if err != nil { + return err + } + err = vm.WriteLong(r.Registered_at, w) + if err != nil { + return err + } + err = vm.WriteString(r.First_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.Last_name, w) + if err != nil { + return err + } + err = vm.WriteString(r.City, w) + if err != nil { + return err + } + err = vm.WriteString(r.Level, w) + if err != nil { + return err + } + return err +} + +func (r WebanalyticsUser) Serialize(w io.Writer) error { + return writeWebanalyticsUser(r, w) +} + +func (r WebanalyticsUser) Schema() string { + return "{\"fields\":[{\"name\":\"user_id\",\"type\":{\"arg.properties\":{\"iteration\":{\"start\":1}},\"type\":\"int\"}},{\"name\":\"username\",\"type\":{\"arg.properties\":{\"options\":[\"akatz1022\",\"bobk_43\",\"alison_99\",\"k_robertz_88\",\"Ferd88\",\"Reeva43\",\"Antonio_0966\",\"ArlyneW8ter\",\"DimitriSchenz88\",\"Oriana_70\",\"AbdelKable_86\",\"Roberto_123\",\"AlanGreta_GG66\",\"Nathan_126\",\"AndySims_345324\",\"GlenAlan_23344\",\"LukeWaters_23\",\"BenSteins_235\"]},\"type\":\"string\"}},{\"name\":\"registered_at\",\"type\":{\"arg.properties\":{\"range\":{\"max\":1502339792000,\"min\":1407645330000}},\"type\":\"long\"}},{\"name\":\"first_name\",\"type\":{\"arg.properties\":{\"options\":[\"Elwyn\",\"Curran\",\"Hanson\",\"Woodrow\",\"Ferd\",\"Reeva\",\"Antonio\",\"Arlyne\",\"Dimitri\",\"Oriana\",\"Abdel\",\"Greta\"]},\"type\":\"string\"}},{\"name\":\"last_name\",\"type\":{\"arg.properties\":{\"options\":[\"Vanyard\",\"Vears\",\"Garrity\",\"Trice\",\"Tomini\",\"Jushcke\",\"De Banke\",\"Pask\",\"Rockhill\",\"Romagosa\",\"Adicot\",\"Lalonde\"]},\"type\":\"string\"}},{\"name\":\"city\",\"type\":{\"arg.properties\":{\"options\":[\"Palo Alto\",\"San Francisco\",\"Raleigh\",\"London\",\"Frankfurt\",\"New York\"]},\"type\":\"string\"}},{\"name\":\"level\",\"type\":{\"arg.properties\":{\"options\":[\"Gold\",\"Silver\",\"Platinum\"]},\"type\":\"string\"}}],\"name\":\"webanalytics.WebanalyticsUser\",\"type\":\"record\"}" +} + +func (r WebanalyticsUser) SchemaName() string { + return "webanalytics.WebanalyticsUser" +} + +func (_ WebanalyticsUser) SetBoolean(v bool) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetInt(v int32) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetLong(v int64) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetFloat(v float32) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetDouble(v float64) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetBytes(v []byte) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetString(v string) { panic("Unsupported operation") } +func (_ WebanalyticsUser) SetUnionElem(v int64) { panic("Unsupported operation") } + +func (r *WebanalyticsUser) Get(i int) types.Field { + switch i { + case 0: + w := types.Int{Target: &r.User_id} + + return w + + case 1: + w := types.String{Target: &r.Username} + + return w + + case 2: + w := types.Long{Target: &r.Registered_at} + + return w + + case 3: + w := types.String{Target: &r.First_name} + + return w + + case 4: + w := types.String{Target: &r.Last_name} + + return w + + case 5: + w := types.String{Target: &r.City} + + return w + + case 6: + w := types.String{Target: &r.Level} + + return w + + } + panic("Unknown field index") +} + +func (r *WebanalyticsUser) SetDefault(i int) { + switch i { + } + panic("Unknown field index") +} + +func (r *WebanalyticsUser) NullField(i int) { + switch i { + } + panic("Not a nullable field index") +} + +func (_ WebanalyticsUser) AppendMap(key string) types.Field { panic("Unsupported operation") } +func (_ WebanalyticsUser) AppendArray() types.Field { panic("Unsupported operation") } +func (_ WebanalyticsUser) HintSize(int) { panic("Unsupported operation") } +func (_ WebanalyticsUser) Finalize() {} + +func (_ WebanalyticsUser) AvroCRC64Fingerprint() []byte { + return []byte(WebanalyticsUserAvroCRC64Fingerprint) +} + +func (r WebanalyticsUser) MarshalJSON() ([]byte, error) { + var err error + output := make(map[string]json.RawMessage) + output["user_id"], err = json.Marshal(r.User_id) + if err != nil { + return nil, err + } + output["username"], err = json.Marshal(r.Username) + if err != nil { + return nil, err + } + output["registered_at"], err = json.Marshal(r.Registered_at) + if err != nil { + return nil, err + } + output["first_name"], err = json.Marshal(r.First_name) + if err != nil { + return nil, err + } + output["last_name"], err = json.Marshal(r.Last_name) + if err != nil { + return nil, err + } + output["city"], err = json.Marshal(r.City) + if err != nil { + return nil, err + } + output["level"], err = json.Marshal(r.Level) + if err != nil { + return nil, err + } + return json.Marshal(output) +} + +func (r *WebanalyticsUser) UnmarshalJSON(data []byte) error { + var fields map[string]json.RawMessage + if err := json.Unmarshal(data, &fields); err != nil { + return err + } + + var val json.RawMessage + val = func() json.RawMessage { + if v, ok := fields["user_id"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.User_id); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for user_id") + } + val = func() json.RawMessage { + if v, ok := fields["username"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Username); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for username") + } + val = func() json.RawMessage { + if v, ok := fields["registered_at"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Registered_at); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for registered_at") + } + val = func() json.RawMessage { + if v, ok := fields["first_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.First_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for first_name") + } + val = func() json.RawMessage { + if v, ok := fields["last_name"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Last_name); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for last_name") + } + val = func() json.RawMessage { + if v, ok := fields["city"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.City); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for city") + } + val = func() json.RawMessage { + if v, ok := fields["level"]; ok { + return v + } + return nil + }() + + if val != nil { + if err := json.Unmarshal([]byte(val), &r.Level); err != nil { + return err + } + } else { + return fmt.Errorf("no value specified for level") + } + return nil +}