blob: d77a46ad1fab253a7b9c9fdccd70921b0abf4b05 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Package: testdata
package testdata
import (
"fmt"
"reflect"
"time"
"v.io/v23/vdl"
time_2 "v.io/v23/vdlroot/time"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Type definitions
type AddressInfo struct {
Street string
City string
State string
Zip string
}
func (AddressInfo) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.AddressInfo"`
}) {
}
func (m *AddressInfo) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Street")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromString(string(m.Street), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("City")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget5.FromString(string(m.City), tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
keyTarget6, fieldTarget7, err := fieldsTarget1.StartField("State")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget7.FromString(string(m.State), tt.NonOptional().Field(2).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget6, fieldTarget7); err != nil {
return err
}
}
keyTarget8, fieldTarget9, err := fieldsTarget1.StartField("Zip")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget9.FromString(string(m.Zip), tt.NonOptional().Field(3).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget8, fieldTarget9); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *AddressInfo) MakeVDLTarget() vdl.Target {
return &AddressInfoTarget{Value: m}
}
type AddressInfoTarget struct {
Value *AddressInfo
streetTarget vdl.StringTarget
cityTarget vdl.StringTarget
stateTarget vdl.StringTarget
zipTarget vdl.StringTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *AddressInfoTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*AddressInfo)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *AddressInfoTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Street":
t.streetTarget.Value = &t.Value.Street
target, err := &t.streetTarget, error(nil)
return nil, target, err
case "City":
t.cityTarget.Value = &t.Value.City
target, err := &t.cityTarget, error(nil)
return nil, target, err
case "State":
t.stateTarget.Value = &t.Value.State
target, err := &t.stateTarget, error(nil)
return nil, target, err
case "Zip":
t.zipTarget.Value = &t.Value.Zip
target, err := &t.zipTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.AddressInfo", name)
}
}
func (t *AddressInfoTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *AddressInfoTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type CreditAgency int
const (
CreditAgencyEquifax CreditAgency = iota
CreditAgencyExperian
CreditAgencyTransUnion
)
// CreditAgencyAll holds all labels for CreditAgency.
var CreditAgencyAll = [...]CreditAgency{CreditAgencyEquifax, CreditAgencyExperian, CreditAgencyTransUnion}
// CreditAgencyFromString creates a CreditAgency from a string label.
func CreditAgencyFromString(label string) (x CreditAgency, err error) {
err = x.Set(label)
return
}
// Set assigns label to x.
func (x *CreditAgency) Set(label string) error {
switch label {
case "Equifax", "equifax":
*x = CreditAgencyEquifax
return nil
case "Experian", "experian":
*x = CreditAgencyExperian
return nil
case "TransUnion", "transunion":
*x = CreditAgencyTransUnion
return nil
}
*x = -1
return fmt.Errorf("unknown label %q in testdata.CreditAgency", label)
}
// String returns the string label of x.
func (x CreditAgency) String() string {
switch x {
case CreditAgencyEquifax:
return "Equifax"
case CreditAgencyExperian:
return "Experian"
case CreditAgencyTransUnion:
return "TransUnion"
}
return ""
}
func (CreditAgency) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.CreditAgency"`
Enum struct{ Equifax, Experian, TransUnion string }
}) {
}
func (m *CreditAgency) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
if err := t.FromEnumLabel((*m).String(), tt); err != nil {
return err
}
return nil
}
func (m *CreditAgency) MakeVDLTarget() vdl.Target {
return &CreditAgencyTarget{Value: m}
}
type CreditAgencyTarget struct {
Value *CreditAgency
vdl.TargetBase
}
func (t *CreditAgencyTarget) FromEnumLabel(src string, tt *vdl.Type) error {
if ttWant := vdl.TypeOf((*CreditAgency)(nil)); !vdl.Compatible(tt, ttWant) {
return fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
switch src {
case "Equifax":
*t.Value = 0
case "Experian":
*t.Value = 1
case "TransUnion":
*t.Value = 2
default:
return fmt.Errorf("label %s not in enum v.io/v23/syncbase/nosql/testdata.CreditAgency", src)
}
return nil
}
type ExperianRating int
const (
ExperianRatingGood ExperianRating = iota
ExperianRatingBad
)
// ExperianRatingAll holds all labels for ExperianRating.
var ExperianRatingAll = [...]ExperianRating{ExperianRatingGood, ExperianRatingBad}
// ExperianRatingFromString creates a ExperianRating from a string label.
func ExperianRatingFromString(label string) (x ExperianRating, err error) {
err = x.Set(label)
return
}
// Set assigns label to x.
func (x *ExperianRating) Set(label string) error {
switch label {
case "Good", "good":
*x = ExperianRatingGood
return nil
case "Bad", "bad":
*x = ExperianRatingBad
return nil
}
*x = -1
return fmt.Errorf("unknown label %q in testdata.ExperianRating", label)
}
// String returns the string label of x.
func (x ExperianRating) String() string {
switch x {
case ExperianRatingGood:
return "Good"
case ExperianRatingBad:
return "Bad"
}
return ""
}
func (ExperianRating) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.ExperianRating"`
Enum struct{ Good, Bad string }
}) {
}
func (m *ExperianRating) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
if err := t.FromEnumLabel((*m).String(), tt); err != nil {
return err
}
return nil
}
func (m *ExperianRating) MakeVDLTarget() vdl.Target {
return &ExperianRatingTarget{Value: m}
}
type ExperianRatingTarget struct {
Value *ExperianRating
vdl.TargetBase
}
func (t *ExperianRatingTarget) FromEnumLabel(src string, tt *vdl.Type) error {
if ttWant := vdl.TypeOf((*ExperianRating)(nil)); !vdl.Compatible(tt, ttWant) {
return fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
switch src {
case "Good":
*t.Value = 0
case "Bad":
*t.Value = 1
default:
return fmt.Errorf("label %s not in enum v.io/v23/syncbase/nosql/testdata.ExperianRating", src)
}
return nil
}
type EquifaxCreditReport struct {
Rating byte
}
func (EquifaxCreditReport) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.EquifaxCreditReport"`
}) {
}
func (m *EquifaxCreditReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Rating")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromUint(uint64(m.Rating), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *EquifaxCreditReport) MakeVDLTarget() vdl.Target {
return &EquifaxCreditReportTarget{Value: m}
}
type EquifaxCreditReportTarget struct {
Value *EquifaxCreditReport
ratingTarget vdl.ByteTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *EquifaxCreditReportTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*EquifaxCreditReport)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *EquifaxCreditReportTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Rating":
t.ratingTarget.Value = &t.Value.Rating
target, err := &t.ratingTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.EquifaxCreditReport", name)
}
}
func (t *EquifaxCreditReportTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *EquifaxCreditReportTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type ExperianCreditReport struct {
Rating ExperianRating
}
func (ExperianCreditReport) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.ExperianCreditReport"`
}) {
}
func (m *ExperianCreditReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Rating")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Rating.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *ExperianCreditReport) MakeVDLTarget() vdl.Target {
return &ExperianCreditReportTarget{Value: m}
}
type ExperianCreditReportTarget struct {
Value *ExperianCreditReport
ratingTarget ExperianRatingTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *ExperianCreditReportTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*ExperianCreditReport)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *ExperianCreditReportTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Rating":
t.ratingTarget.Value = &t.Value.Rating
target, err := &t.ratingTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.ExperianCreditReport", name)
}
}
func (t *ExperianCreditReportTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *ExperianCreditReportTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type TransUnionCreditReport struct {
Rating int16
}
func (TransUnionCreditReport) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.TransUnionCreditReport"`
}) {
}
func (m *TransUnionCreditReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Rating")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromInt(int64(m.Rating), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *TransUnionCreditReport) MakeVDLTarget() vdl.Target {
return &TransUnionCreditReportTarget{Value: m}
}
type TransUnionCreditReportTarget struct {
Value *TransUnionCreditReport
ratingTarget vdl.Int16Target
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *TransUnionCreditReportTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*TransUnionCreditReport)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *TransUnionCreditReportTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Rating":
t.ratingTarget.Value = &t.Value.Rating
target, err := &t.ratingTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.TransUnionCreditReport", name)
}
}
func (t *TransUnionCreditReportTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *TransUnionCreditReportTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type (
// AgencyReport represents any single field of the AgencyReport union type.
AgencyReport interface {
// Index returns the field index.
Index() int
// Interface returns the field value as an interface.
Interface() interface{}
// Name returns the field name.
Name() string
// __VDLReflect describes the AgencyReport union type.
__VDLReflect(__AgencyReportReflect)
FillVDLTarget(vdl.Target, *vdl.Type) error
}
// AgencyReportEquifaxReport represents field EquifaxReport of the AgencyReport union type.
AgencyReportEquifaxReport struct{ Value EquifaxCreditReport }
// AgencyReportExperianReport represents field ExperianReport of the AgencyReport union type.
AgencyReportExperianReport struct{ Value ExperianCreditReport }
// AgencyReportTransUnionReport represents field TransUnionReport of the AgencyReport union type.
AgencyReportTransUnionReport struct{ Value TransUnionCreditReport }
// __AgencyReportReflect describes the AgencyReport union type.
__AgencyReportReflect struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.AgencyReport"`
Type AgencyReport
Union struct {
EquifaxReport AgencyReportEquifaxReport
ExperianReport AgencyReportExperianReport
TransUnionReport AgencyReportTransUnionReport
}
}
)
func (x AgencyReportEquifaxReport) Index() int { return 0 }
func (x AgencyReportEquifaxReport) Interface() interface{} { return x.Value }
func (x AgencyReportEquifaxReport) Name() string { return "EquifaxReport" }
func (x AgencyReportEquifaxReport) __VDLReflect(__AgencyReportReflect) {}
func (m AgencyReportEquifaxReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("EquifaxReport")
if err != nil {
return err
}
if err := m.Value.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m AgencyReportEquifaxReport) MakeVDLTarget() vdl.Target {
return nil
}
func (x AgencyReportExperianReport) Index() int { return 1 }
func (x AgencyReportExperianReport) Interface() interface{} { return x.Value }
func (x AgencyReportExperianReport) Name() string { return "ExperianReport" }
func (x AgencyReportExperianReport) __VDLReflect(__AgencyReportReflect) {}
func (m AgencyReportExperianReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("ExperianReport")
if err != nil {
return err
}
if err := m.Value.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m AgencyReportExperianReport) MakeVDLTarget() vdl.Target {
return nil
}
func (x AgencyReportTransUnionReport) Index() int { return 2 }
func (x AgencyReportTransUnionReport) Interface() interface{} { return x.Value }
func (x AgencyReportTransUnionReport) Name() string { return "TransUnionReport" }
func (x AgencyReportTransUnionReport) __VDLReflect(__AgencyReportReflect) {}
func (m AgencyReportTransUnionReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("TransUnionReport")
if err != nil {
return err
}
if err := m.Value.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(2).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m AgencyReportTransUnionReport) MakeVDLTarget() vdl.Target {
return nil
}
type CreditReport struct {
Agency CreditAgency
Report AgencyReport
}
func (CreditReport) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.CreditReport"`
}) {
}
func (m *CreditReport) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Agency")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Agency.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("Report")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
unionValue6 := m.Report
if unionValue6 == nil {
unionValue6 = AgencyReportEquifaxReport{}
}
if err := unionValue6.FillVDLTarget(fieldTarget5, tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *CreditReport) MakeVDLTarget() vdl.Target {
return &CreditReportTarget{Value: m}
}
type CreditReportTarget struct {
Value *CreditReport
agencyTarget CreditAgencyTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *CreditReportTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*CreditReport)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *CreditReportTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Agency":
t.agencyTarget.Value = &t.Value.Agency
target, err := &t.agencyTarget, error(nil)
return nil, target, err
case "Report":
target, err := vdl.ReflectTarget(reflect.ValueOf(&t.Value.Report))
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.CreditReport", name)
}
}
func (t *CreditReportTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *CreditReportTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type Customer struct {
Name string
Id int64
Active bool
Address AddressInfo
Credit CreditReport
}
func (Customer) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.Customer"`
}) {
}
func (m *Customer) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Name")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromString(string(m.Name), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("Id")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget5.FromInt(int64(m.Id), tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
keyTarget6, fieldTarget7, err := fieldsTarget1.StartField("Active")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget7.FromBool(bool(m.Active), tt.NonOptional().Field(2).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget6, fieldTarget7); err != nil {
return err
}
}
keyTarget8, fieldTarget9, err := fieldsTarget1.StartField("Address")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Address.FillVDLTarget(fieldTarget9, tt.NonOptional().Field(3).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget8, fieldTarget9); err != nil {
return err
}
}
keyTarget10, fieldTarget11, err := fieldsTarget1.StartField("Credit")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Credit.FillVDLTarget(fieldTarget11, tt.NonOptional().Field(4).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget10, fieldTarget11); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *Customer) MakeVDLTarget() vdl.Target {
return &CustomerTarget{Value: m}
}
type CustomerTarget struct {
Value *Customer
nameTarget vdl.StringTarget
idTarget vdl.Int64Target
activeTarget vdl.BoolTarget
addressTarget AddressInfoTarget
creditTarget CreditReportTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *CustomerTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*Customer)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *CustomerTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Name":
t.nameTarget.Value = &t.Value.Name
target, err := &t.nameTarget, error(nil)
return nil, target, err
case "Id":
t.idTarget.Value = &t.Value.Id
target, err := &t.idTarget, error(nil)
return nil, target, err
case "Active":
t.activeTarget.Value = &t.Value.Active
target, err := &t.activeTarget, error(nil)
return nil, target, err
case "Address":
t.addressTarget.Value = &t.Value.Address
target, err := &t.addressTarget, error(nil)
return nil, target, err
case "Credit":
t.creditTarget.Value = &t.Value.Credit
target, err := &t.creditTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.Customer", name)
}
}
func (t *CustomerTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *CustomerTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type Invoice struct {
CustId int64
InvoiceNum int64
InvoiceDate time.Time
Amount int64
ShipTo AddressInfo
}
func (Invoice) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.Invoice"`
}) {
}
func (m *Invoice) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("CustId")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromInt(int64(m.CustId), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("InvoiceNum")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget5.FromInt(int64(m.InvoiceNum), tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
var wireValue6 time_2.Time
if err := time_2.TimeFromNative(&wireValue6, m.InvoiceDate); err != nil {
return err
}
keyTarget7, fieldTarget8, err := fieldsTarget1.StartField("InvoiceDate")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := wireValue6.FillVDLTarget(fieldTarget8, tt.NonOptional().Field(2).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget7, fieldTarget8); err != nil {
return err
}
}
keyTarget9, fieldTarget10, err := fieldsTarget1.StartField("Amount")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget10.FromInt(int64(m.Amount), tt.NonOptional().Field(3).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget9, fieldTarget10); err != nil {
return err
}
}
keyTarget11, fieldTarget12, err := fieldsTarget1.StartField("ShipTo")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.ShipTo.FillVDLTarget(fieldTarget12, tt.NonOptional().Field(4).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget11, fieldTarget12); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *Invoice) MakeVDLTarget() vdl.Target {
return &InvoiceTarget{Value: m}
}
type InvoiceTarget struct {
Value *Invoice
custIdTarget vdl.Int64Target
invoiceNumTarget vdl.Int64Target
invoiceDateTarget time_2.TimeTarget
amountTarget vdl.Int64Target
shipToTarget AddressInfoTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *InvoiceTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*Invoice)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *InvoiceTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "CustId":
t.custIdTarget.Value = &t.Value.CustId
target, err := &t.custIdTarget, error(nil)
return nil, target, err
case "InvoiceNum":
t.invoiceNumTarget.Value = &t.Value.InvoiceNum
target, err := &t.invoiceNumTarget, error(nil)
return nil, target, err
case "InvoiceDate":
t.invoiceDateTarget.Value = &t.Value.InvoiceDate
target, err := &t.invoiceDateTarget, error(nil)
return nil, target, err
case "Amount":
t.amountTarget.Value = &t.Value.Amount
target, err := &t.amountTarget, error(nil)
return nil, target, err
case "ShipTo":
t.shipToTarget.Value = &t.Value.ShipTo
target, err := &t.shipToTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.Invoice", name)
}
}
func (t *InvoiceTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *InvoiceTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type Numbers struct {
B byte
Ui16 uint16
Ui32 uint32
Ui64 uint64
I16 int16
I32 int32
I64 int64
F32 float32
F64 float64
C64 complex64
C128 complex128
}
func (Numbers) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.Numbers"`
}) {
}
func (m *Numbers) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("B")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromUint(uint64(m.B), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("Ui16")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget5.FromUint(uint64(m.Ui16), tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
keyTarget6, fieldTarget7, err := fieldsTarget1.StartField("Ui32")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget7.FromUint(uint64(m.Ui32), tt.NonOptional().Field(2).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget6, fieldTarget7); err != nil {
return err
}
}
keyTarget8, fieldTarget9, err := fieldsTarget1.StartField("Ui64")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget9.FromUint(uint64(m.Ui64), tt.NonOptional().Field(3).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget8, fieldTarget9); err != nil {
return err
}
}
keyTarget10, fieldTarget11, err := fieldsTarget1.StartField("I16")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget11.FromInt(int64(m.I16), tt.NonOptional().Field(4).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget10, fieldTarget11); err != nil {
return err
}
}
keyTarget12, fieldTarget13, err := fieldsTarget1.StartField("I32")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget13.FromInt(int64(m.I32), tt.NonOptional().Field(5).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget12, fieldTarget13); err != nil {
return err
}
}
keyTarget14, fieldTarget15, err := fieldsTarget1.StartField("I64")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget15.FromInt(int64(m.I64), tt.NonOptional().Field(6).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget14, fieldTarget15); err != nil {
return err
}
}
keyTarget16, fieldTarget17, err := fieldsTarget1.StartField("F32")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget17.FromFloat(float64(m.F32), tt.NonOptional().Field(7).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget16, fieldTarget17); err != nil {
return err
}
}
keyTarget18, fieldTarget19, err := fieldsTarget1.StartField("F64")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget19.FromFloat(float64(m.F64), tt.NonOptional().Field(8).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget18, fieldTarget19); err != nil {
return err
}
}
keyTarget20, fieldTarget21, err := fieldsTarget1.StartField("C64")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget21.FromComplex(complex128(m.C64), tt.NonOptional().Field(9).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget20, fieldTarget21); err != nil {
return err
}
}
keyTarget22, fieldTarget23, err := fieldsTarget1.StartField("C128")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget23.FromComplex(complex128(m.C128), tt.NonOptional().Field(10).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget22, fieldTarget23); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *Numbers) MakeVDLTarget() vdl.Target {
return &NumbersTarget{Value: m}
}
type NumbersTarget struct {
Value *Numbers
bTarget vdl.ByteTarget
ui16Target vdl.Uint16Target
ui32Target vdl.Uint32Target
ui64Target vdl.Uint64Target
i16Target vdl.Int16Target
i32Target vdl.Int32Target
i64Target vdl.Int64Target
f32Target vdl.Float32Target
f64Target vdl.Float64Target
c64Target vdl.Complex64Target
c128Target vdl.Complex128Target
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *NumbersTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*Numbers)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *NumbersTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "B":
t.bTarget.Value = &t.Value.B
target, err := &t.bTarget, error(nil)
return nil, target, err
case "Ui16":
t.ui16Target.Value = &t.Value.Ui16
target, err := &t.ui16Target, error(nil)
return nil, target, err
case "Ui32":
t.ui32Target.Value = &t.Value.Ui32
target, err := &t.ui32Target, error(nil)
return nil, target, err
case "Ui64":
t.ui64Target.Value = &t.Value.Ui64
target, err := &t.ui64Target, error(nil)
return nil, target, err
case "I16":
t.i16Target.Value = &t.Value.I16
target, err := &t.i16Target, error(nil)
return nil, target, err
case "I32":
t.i32Target.Value = &t.Value.I32
target, err := &t.i32Target, error(nil)
return nil, target, err
case "I64":
t.i64Target.Value = &t.Value.I64
target, err := &t.i64Target, error(nil)
return nil, target, err
case "F32":
t.f32Target.Value = &t.Value.F32
target, err := &t.f32Target, error(nil)
return nil, target, err
case "F64":
t.f64Target.Value = &t.Value.F64
target, err := &t.f64Target, error(nil)
return nil, target, err
case "C64":
t.c64Target.Value = &t.Value.C64
target, err := &t.c64Target, error(nil)
return nil, target, err
case "C128":
t.c128Target.Value = &t.Value.C128
target, err := &t.c128Target, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.Numbers", name)
}
}
func (t *NumbersTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *NumbersTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type (
// TitleOrValueType represents any single field of the TitleOrValueType union type.
TitleOrValueType interface {
// Index returns the field index.
Index() int
// Interface returns the field value as an interface.
Interface() interface{}
// Name returns the field name.
Name() string
// __VDLReflect describes the TitleOrValueType union type.
__VDLReflect(__TitleOrValueTypeReflect)
FillVDLTarget(vdl.Target, *vdl.Type) error
}
// TitleOrValueTypeTitle represents field Title of the TitleOrValueType union type.
TitleOrValueTypeTitle struct{ Value string }
// TitleOrValueTypeValue represents field Value of the TitleOrValueType union type.
TitleOrValueTypeValue struct{ Value int64 }
// __TitleOrValueTypeReflect describes the TitleOrValueType union type.
__TitleOrValueTypeReflect struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.TitleOrValueType"`
Type TitleOrValueType
Union struct {
Title TitleOrValueTypeTitle
Value TitleOrValueTypeValue
}
}
)
func (x TitleOrValueTypeTitle) Index() int { return 0 }
func (x TitleOrValueTypeTitle) Interface() interface{} { return x.Value }
func (x TitleOrValueTypeTitle) Name() string { return "Title" }
func (x TitleOrValueTypeTitle) __VDLReflect(__TitleOrValueTypeReflect) {}
func (m TitleOrValueTypeTitle) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Title")
if err != nil {
return err
}
if err := fieldTarget3.FromString(string(m.Value), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m TitleOrValueTypeTitle) MakeVDLTarget() vdl.Target {
return nil
}
func (x TitleOrValueTypeValue) Index() int { return 1 }
func (x TitleOrValueTypeValue) Interface() interface{} { return x.Value }
func (x TitleOrValueTypeValue) Name() string { return "Value" }
func (x TitleOrValueTypeValue) __VDLReflect(__TitleOrValueTypeReflect) {}
func (m TitleOrValueTypeValue) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Value")
if err != nil {
return err
}
if err := fieldTarget3.FromInt(int64(m.Value), tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m TitleOrValueTypeValue) MakeVDLTarget() vdl.Target {
return nil
}
type BazType struct {
Name string
TitleOrValue TitleOrValueType
}
func (BazType) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.BazType"`
}) {
}
func (m *BazType) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Name")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromString(string(m.Name), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("TitleOrValue")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
unionValue6 := m.TitleOrValue
if unionValue6 == nil {
unionValue6 = TitleOrValueTypeTitle{}
}
if err := unionValue6.FillVDLTarget(fieldTarget5, tt.NonOptional().Field(1).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *BazType) MakeVDLTarget() vdl.Target {
return &BazTypeTarget{Value: m}
}
type BazTypeTarget struct {
Value *BazType
nameTarget vdl.StringTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *BazTypeTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*BazType)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *BazTypeTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Name":
t.nameTarget.Value = &t.Value.Name
target, err := &t.nameTarget, error(nil)
return nil, target, err
case "TitleOrValue":
target, err := vdl.ReflectTarget(reflect.ValueOf(&t.Value.TitleOrValue))
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.BazType", name)
}
}
func (t *BazTypeTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *BazTypeTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type BarType struct {
Baz BazType
}
func (BarType) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.BarType"`
}) {
}
func (m *BarType) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Baz")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Baz.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *BarType) MakeVDLTarget() vdl.Target {
return &BarTypeTarget{Value: m}
}
type BarTypeTarget struct {
Value *BarType
bazTarget BazTypeTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *BarTypeTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*BarType)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *BarTypeTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Baz":
t.bazTarget.Value = &t.Value.Baz
target, err := &t.bazTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.BarType", name)
}
}
func (t *BarTypeTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *BarTypeTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type FooType struct {
Bar BarType
}
func (FooType) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.FooType"`
}) {
}
func (m *FooType) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Bar")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.Bar.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *FooType) MakeVDLTarget() vdl.Target {
return &FooTypeTarget{Value: m}
}
type FooTypeTarget struct {
Value *FooType
barTarget BarTypeTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *FooTypeTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*FooType)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *FooTypeTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Bar":
t.barTarget.Value = &t.Value.Bar
target, err := &t.barTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.FooType", name)
}
}
func (t *FooTypeTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *FooTypeTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
type ArrayOfFour [4]string
func (ArrayOfFour) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.ArrayOfFour"`
}) {
}
func (m *ArrayOfFour) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
listTarget1, err := t.StartList(tt, 4)
if err != nil {
return err
}
for i, elem3 := range *m {
elemTarget2, err := listTarget1.StartElem(i)
if err != nil {
return err
}
if err := elemTarget2.FromString(string(elem3), tt.NonOptional().Elem()); err != nil {
return err
}
if err := listTarget1.FinishElem(elemTarget2); err != nil {
return err
}
}
if err := t.FinishList(listTarget1); err != nil {
return err
}
return nil
}
func (m *ArrayOfFour) MakeVDLTarget() vdl.Target {
return &ArrayOfFourTarget{Value: m}
}
// ArrayOfFour
type ArrayOfFourTarget struct {
Value *ArrayOfFour
elemTarget vdl.StringTarget
vdl.TargetBase
vdl.ListTargetBase
}
func (t *ArrayOfFourTarget) StartList(tt *vdl.Type, len int) (vdl.ListTarget, error) {
if ttWant := vdl.TypeOf((*ArrayOfFour)(nil)); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *ArrayOfFourTarget) StartElem(index int) (elem vdl.Target, _ error) {
t.elemTarget.Value = &(*t.Value)[index]
target, err := &t.elemTarget, error(nil)
return target, err
}
func (t *ArrayOfFourTarget) FinishElem(elem vdl.Target) error {
return nil
}
func (t *ArrayOfFourTarget) FinishList(elem vdl.ListTarget) error {
return nil
}
type KeyIndexData struct {
A ArrayOfFour
L []string
M map[complex128]string
S map[string]struct{}
}
func (KeyIndexData) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.KeyIndexData"`
}) {
}
func (m *KeyIndexData) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("A")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := m.A.FillVDLTarget(fieldTarget3, tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
keyTarget4, fieldTarget5, err := fieldsTarget1.StartField("L")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
listTarget6, err := fieldTarget5.StartList(tt.NonOptional().Field(1).Type, len(m.L))
if err != nil {
return err
}
for i, elem8 := range m.L {
elemTarget7, err := listTarget6.StartElem(i)
if err != nil {
return err
}
if err := elemTarget7.FromString(string(elem8), tt.NonOptional().Field(1).Type.Elem()); err != nil {
return err
}
if err := listTarget6.FinishElem(elemTarget7); err != nil {
return err
}
}
if err := fieldTarget5.FinishList(listTarget6); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget4, fieldTarget5); err != nil {
return err
}
}
keyTarget9, fieldTarget10, err := fieldsTarget1.StartField("M")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
mapTarget11, err := fieldTarget10.StartMap(tt.NonOptional().Field(2).Type, len(m.M))
if err != nil {
return err
}
for key13, value15 := range m.M {
keyTarget12, err := mapTarget11.StartKey()
if err != nil {
return err
}
if err := keyTarget12.FromComplex(complex128(key13), tt.NonOptional().Field(2).Type.Key()); err != nil {
return err
}
valueTarget14, err := mapTarget11.FinishKeyStartField(keyTarget12)
if err != nil {
return err
}
if err := valueTarget14.FromString(string(value15), tt.NonOptional().Field(2).Type.Elem()); err != nil {
return err
}
if err := mapTarget11.FinishField(keyTarget12, valueTarget14); err != nil {
return err
}
}
if err := fieldTarget10.FinishMap(mapTarget11); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget9, fieldTarget10); err != nil {
return err
}
}
keyTarget16, fieldTarget17, err := fieldsTarget1.StartField("S")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
setTarget18, err := fieldTarget17.StartSet(tt.NonOptional().Field(3).Type, len(m.S))
if err != nil {
return err
}
for key20 := range m.S {
keyTarget19, err := setTarget18.StartKey()
if err != nil {
return err
}
if err := keyTarget19.FromString(string(key20), tt.NonOptional().Field(3).Type.Key()); err != nil {
return err
}
if err := setTarget18.FinishKey(keyTarget19); err != nil {
return err
}
}
if err := fieldTarget17.FinishSet(setTarget18); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget16, fieldTarget17); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *KeyIndexData) MakeVDLTarget() vdl.Target {
return &KeyIndexDataTarget{Value: m}
}
type KeyIndexDataTarget struct {
Value *KeyIndexData
aTarget ArrayOfFourTarget
lTarget vdl.StringSliceTarget
mTarget unnamed_6d61705b636f6d706c65783132385d737472696e67Target
sTarget unnamed_7365745b737472696e675dTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *KeyIndexDataTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*KeyIndexData)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *KeyIndexDataTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "A":
t.aTarget.Value = &t.Value.A
target, err := &t.aTarget, error(nil)
return nil, target, err
case "L":
t.lTarget.Value = &t.Value.L
target, err := &t.lTarget, error(nil)
return nil, target, err
case "M":
t.mTarget.Value = &t.Value.M
target, err := &t.mTarget, error(nil)
return nil, target, err
case "S":
t.sTarget.Value = &t.Value.S
target, err := &t.sTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.KeyIndexData", name)
}
}
func (t *KeyIndexDataTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *KeyIndexDataTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
// map[complex128]string
type unnamed_6d61705b636f6d706c65783132385d737472696e67Target struct {
Value *map[complex128]string
currKey complex128
currElem string
keyTarget vdl.Complex128Target
elemTarget vdl.StringTarget
vdl.TargetBase
vdl.MapTargetBase
}
func (t *unnamed_6d61705b636f6d706c65783132385d737472696e67Target) StartMap(tt *vdl.Type, len int) (vdl.MapTarget, error) {
if ttWant := vdl.TypeOf((*map[complex128]string)(nil)); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
*t.Value = make(map[complex128]string)
return t, nil
}
func (t *unnamed_6d61705b636f6d706c65783132385d737472696e67Target) StartKey() (key vdl.Target, _ error) {
t.currKey = complex128(0)
t.keyTarget.Value = &t.currKey
target, err := &t.keyTarget, error(nil)
return target, err
}
func (t *unnamed_6d61705b636f6d706c65783132385d737472696e67Target) FinishKeyStartField(key vdl.Target) (field vdl.Target, _ error) {
t.currElem = ""
t.elemTarget.Value = &t.currElem
target, err := &t.elemTarget, error(nil)
return target, err
}
func (t *unnamed_6d61705b636f6d706c65783132385d737472696e67Target) FinishField(key, field vdl.Target) error {
(*t.Value)[t.currKey] = t.currElem
return nil
}
func (t *unnamed_6d61705b636f6d706c65783132385d737472696e67Target) FinishMap(elem vdl.MapTarget) error {
if len(*t.Value) == 0 {
*t.Value = nil
}
return nil
}
// map[string]struct{}
type unnamed_7365745b737472696e675dTarget struct {
Value *map[string]struct{}
currKey string
keyTarget vdl.StringTarget
vdl.TargetBase
vdl.SetTargetBase
}
func (t *unnamed_7365745b737472696e675dTarget) StartSet(tt *vdl.Type, len int) (vdl.SetTarget, error) {
if ttWant := vdl.TypeOf((*map[string]struct{})(nil)); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
*t.Value = make(map[string]struct{})
return t, nil
}
func (t *unnamed_7365745b737472696e675dTarget) StartKey() (key vdl.Target, _ error) {
t.currKey = ""
t.keyTarget.Value = &t.currKey
target, err := &t.keyTarget, error(nil)
return target, err
}
func (t *unnamed_7365745b737472696e675dTarget) FinishKey(key vdl.Target) error {
(*t.Value)[t.currKey] = struct{}{}
return nil
}
func (t *unnamed_7365745b737472696e675dTarget) FinishSet(list vdl.SetTarget) error {
if len(*t.Value) == 0 {
*t.Value = nil
}
return nil
}
type BigData struct {
Key string // A dup of the key stored in the value.
}
func (BigData) __VDLReflect(struct {
Name string `vdl:"v.io/v23/syncbase/nosql/testdata.BigData"`
}) {
}
func (m *BigData) FillVDLTarget(t vdl.Target, tt *vdl.Type) error {
fieldsTarget1, err := t.StartFields(tt)
if err != nil {
return err
}
keyTarget2, fieldTarget3, err := fieldsTarget1.StartField("Key")
if err != vdl.ErrFieldNoExist && err != nil {
return err
}
if err != vdl.ErrFieldNoExist {
if err := fieldTarget3.FromString(string(m.Key), tt.NonOptional().Field(0).Type); err != nil {
return err
}
if err := fieldsTarget1.FinishField(keyTarget2, fieldTarget3); err != nil {
return err
}
}
if err := t.FinishFields(fieldsTarget1); err != nil {
return err
}
return nil
}
func (m *BigData) MakeVDLTarget() vdl.Target {
return &BigDataTarget{Value: m}
}
type BigDataTarget struct {
Value *BigData
keyTarget vdl.StringTarget
vdl.TargetBase
vdl.FieldsTargetBase
}
func (t *BigDataTarget) StartFields(tt *vdl.Type) (vdl.FieldsTarget, error) {
if ttWant := vdl.TypeOf((*BigData)(nil)).Elem(); !vdl.Compatible(tt, ttWant) {
return nil, fmt.Errorf("type %v incompatible with %v", tt, ttWant)
}
return t, nil
}
func (t *BigDataTarget) StartField(name string) (key, field vdl.Target, _ error) {
switch name {
case "Key":
t.keyTarget.Value = &t.Value.Key
target, err := &t.keyTarget, error(nil)
return nil, target, err
default:
return nil, nil, fmt.Errorf("field %s not in struct v.io/v23/syncbase/nosql/testdata.BigData", name)
}
}
func (t *BigDataTarget) FinishField(_, _ vdl.Target) error {
return nil
}
func (t *BigDataTarget) FinishFields(_ vdl.FieldsTarget) error {
return nil
}
var __VDLInitCalled bool
// __VDLInit performs vdl initialization. It is safe to call multiple times.
// If you have an init ordering issue, just insert the following line verbatim
// into your source files in this package, right after the "package foo" clause:
//
// var _ = __VDLInit()
//
// The purpose of this function is to ensure that vdl initialization occurs in
// the right order, and very early in the init sequence. In particular, vdl
// registration and package variable initialization needs to occur before
// functions like vdl.TypeOf will work properly.
//
// This function returns a dummy value, so that it can be used to initialize the
// first var in the file, to take advantage of Go's defined init order.
func __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
// Register types.
vdl.Register((*AddressInfo)(nil))
vdl.Register((*CreditAgency)(nil))
vdl.Register((*ExperianRating)(nil))
vdl.Register((*EquifaxCreditReport)(nil))
vdl.Register((*ExperianCreditReport)(nil))
vdl.Register((*TransUnionCreditReport)(nil))
vdl.Register((*AgencyReport)(nil))
vdl.Register((*CreditReport)(nil))
vdl.Register((*Customer)(nil))
vdl.Register((*Invoice)(nil))
vdl.Register((*Numbers)(nil))
vdl.Register((*TitleOrValueType)(nil))
vdl.Register((*BazType)(nil))
vdl.Register((*BarType)(nil))
vdl.Register((*FooType)(nil))
vdl.Register((*ArrayOfFour)(nil))
vdl.Register((*KeyIndexData)(nil))
vdl.Register((*BigData)(nil))
return struct{}{}
}