| // 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. |
| // Source: db_objects.vdl |
| |
| package test |
| |
| import ( |
| // VDL system imports |
| "fmt" |
| "v.io/v23/vdl" |
| |
| // VDL user imports |
| "time" |
| _ "v.io/v23/vdlroot/time" |
| ) |
| |
| type AddressInfo struct { |
| Street string |
| City string |
| State string |
| Zip string |
| } |
| |
| func (AddressInfo) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.AddressInfo"` |
| }) { |
| } |
| |
| 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 test.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/syncbase/v23/syncbase/nosql/internal/query/test.CreditAgency"` |
| Enum struct{ Equifax, Experian, TransUnion string } |
| }) { |
| } |
| |
| 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 test.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/syncbase/v23/syncbase/nosql/internal/query/test.ExperianRating"` |
| Enum struct{ Good, Bad string } |
| }) { |
| } |
| |
| type RatingsArray [4]int16 |
| |
| func (RatingsArray) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.RatingsArray"` |
| }) { |
| } |
| |
| type EquifaxCreditReport struct { |
| Rating byte |
| FourScoreRatings RatingsArray |
| } |
| |
| func (EquifaxCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.EquifaxCreditReport"` |
| }) { |
| } |
| |
| type Tdh int |
| |
| const ( |
| TdhTom Tdh = iota |
| TdhDick |
| TdhHarry |
| ) |
| |
| // TdhAll holds all labels for Tdh. |
| var TdhAll = [...]Tdh{TdhTom, TdhDick, TdhHarry} |
| |
| // TdhFromString creates a Tdh from a string label. |
| func TdhFromString(label string) (x Tdh, err error) { |
| err = x.Set(label) |
| return |
| } |
| |
| // Set assigns label to x. |
| func (x *Tdh) Set(label string) error { |
| switch label { |
| case "Tom", "tom": |
| *x = TdhTom |
| return nil |
| case "Dick", "dick": |
| *x = TdhDick |
| return nil |
| case "Harry", "harry": |
| *x = TdhHarry |
| return nil |
| } |
| *x = -1 |
| return fmt.Errorf("unknown label %q in test.Tdh", label) |
| } |
| |
| // String returns the string label of x. |
| func (x Tdh) String() string { |
| switch x { |
| case TdhTom: |
| return "Tom" |
| case TdhDick: |
| return "Dick" |
| case TdhHarry: |
| return "Harry" |
| } |
| return "" |
| } |
| |
| func (Tdh) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.Tdh"` |
| Enum struct{ Tom, Dick, Harry string } |
| }) { |
| } |
| |
| type ExperianCreditReport struct { |
| Rating ExperianRating |
| TdhApprovals map[Tdh]struct{} |
| Auditor Tdh |
| } |
| |
| func (ExperianCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.ExperianCreditReport"` |
| }) { |
| } |
| |
| type TransUnionCreditReport struct { |
| Rating int16 |
| PreviousRatings map[string]int16 |
| } |
| |
| func (TransUnionCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.TransUnionCreditReport"` |
| }) { |
| } |
| |
| 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) |
| } |
| // 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/syncbase/v23/syncbase/nosql/internal/query/test.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 (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 (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) {} |
| |
| type CreditReport struct { |
| Agency CreditAgency |
| Report AgencyReport |
| } |
| |
| func (CreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.CreditReport"` |
| }) { |
| } |
| |
| type Customer struct { |
| Name string |
| Id int64 |
| Active bool |
| Address AddressInfo |
| PreviousAddresses []AddressInfo |
| Credit CreditReport |
| } |
| |
| func (Customer) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.Customer"` |
| }) { |
| } |
| |
| type Invoice struct { |
| CustId int64 |
| InvoiceNum int64 |
| InvoiceDate time.Time |
| Amount int64 |
| ShipTo AddressInfo |
| } |
| |
| func (Invoice) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.Invoice"` |
| }) { |
| } |
| |
| 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/syncbase/v23/syncbase/nosql/internal/query/test.Numbers"` |
| }) { |
| } |
| |
| type FooType struct { |
| Bar BarType |
| } |
| |
| func (FooType) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.FooType"` |
| }) { |
| } |
| |
| type BarType struct { |
| Baz BazType |
| } |
| |
| func (BarType) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.BarType"` |
| }) { |
| } |
| |
| 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) |
| } |
| // 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/syncbase/v23/syncbase/nosql/internal/query/test.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 (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) {} |
| |
| type BazType struct { |
| Name string |
| TitleOrValue TitleOrValueType |
| } |
| |
| func (BazType) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.BazType"` |
| }) { |
| } |
| |
| type K struct { |
| A byte |
| B string |
| } |
| |
| func (K) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.K"` |
| }) { |
| } |
| |
| type V struct { |
| A string |
| B float32 |
| } |
| |
| func (V) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.V"` |
| }) { |
| } |
| |
| type FunWithMaps struct { |
| Key K |
| Map map[K]V |
| Confusing map[int16][]map[string]struct{} |
| } |
| |
| func (FunWithMaps) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.FunWithMaps"` |
| }) { |
| } |
| |
| type ManyMaps struct { |
| B map[bool]string |
| By map[byte]string |
| U16 map[uint16]string |
| U32 map[uint32]string |
| U64 map[uint64]string |
| I16 map[int16]string |
| I32 map[int32]string |
| I64 map[int64]string |
| F32 map[float32]string |
| F64 map[float64]string |
| C64 map[complex64]string |
| C128 map[complex128]string |
| S map[string]string |
| Ms map[string]map[string]string |
| T map[time.Time]string |
| } |
| |
| func (ManyMaps) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.ManyMaps"` |
| }) { |
| } |
| |
| type ManySets struct { |
| B map[bool]struct{} |
| By map[byte]struct{} |
| U16 map[uint16]struct{} |
| U32 map[uint32]struct{} |
| U64 map[uint64]struct{} |
| I16 map[int16]struct{} |
| I32 map[int32]struct{} |
| I64 map[int64]struct{} |
| F32 map[float32]struct{} |
| F64 map[float64]struct{} |
| C64 map[complex64]struct{} |
| C128 map[complex128]struct{} |
| S map[string]struct{} |
| T map[time.Time]struct{} |
| } |
| |
| func (ManySets) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.ManySets"` |
| }) { |
| } |
| |
| type BigData struct { |
| Key string // A dup of the key stored in the value. |
| } |
| |
| func (BigData) __VDLReflect(struct { |
| Name string `vdl:"v.io/syncbase/v23/syncbase/nosql/internal/query/test.BigData"` |
| }) { |
| } |
| |
| func init() { |
| vdl.Register((*AddressInfo)(nil)) |
| vdl.Register((*CreditAgency)(nil)) |
| vdl.Register((*ExperianRating)(nil)) |
| vdl.Register((*RatingsArray)(nil)) |
| vdl.Register((*EquifaxCreditReport)(nil)) |
| vdl.Register((*Tdh)(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((*FooType)(nil)) |
| vdl.Register((*BarType)(nil)) |
| vdl.Register((*TitleOrValueType)(nil)) |
| vdl.Register((*BazType)(nil)) |
| vdl.Register((*K)(nil)) |
| vdl.Register((*V)(nil)) |
| vdl.Register((*FunWithMaps)(nil)) |
| vdl.Register((*ManyMaps)(nil)) |
| vdl.Register((*ManySets)(nil)) |
| vdl.Register((*BigData)(nil)) |
| } |