| // 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 demodb |
| |
| 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/x/ref/cmd/sb51/internal/demodb.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 demodb.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/x/ref/cmd/sb51/internal/demodb.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 demodb.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/x/ref/cmd/sb51/internal/demodb.ExperianRating"` |
| Enum struct{ Good, Bad string } |
| }) { |
| } |
| |
| type EquifaxCreditReport struct { |
| Rating byte |
| } |
| |
| func (EquifaxCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.EquifaxCreditReport"` |
| }) { |
| } |
| |
| type ExperianCreditReport struct { |
| Rating ExperianRating |
| } |
| |
| func (ExperianCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.ExperianCreditReport"` |
| }) { |
| } |
| |
| type TransUnionCreditReport struct { |
| Rating int16 |
| } |
| |
| func (TransUnionCreditReport) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.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/x/ref/cmd/sb51/internal/demodb.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/x/ref/cmd/sb51/internal/demodb.CreditReport"` |
| }) { |
| } |
| |
| type Customer struct { |
| Name string |
| Id int64 |
| Active bool |
| Address AddressInfo |
| Credit CreditReport |
| } |
| |
| func (Customer) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.Customer"` |
| }) { |
| } |
| |
| type Invoice struct { |
| CustId int64 |
| InvoiceNum int64 |
| Amount int64 |
| ShipTo AddressInfo |
| } |
| |
| func (Invoice) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.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/x/ref/cmd/sb51/internal/demodb.Numbers"` |
| }) { |
| } |
| |
| type FooType struct { |
| Bar BarType |
| } |
| |
| func (FooType) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.FooType"` |
| }) { |
| } |
| |
| type BarType struct { |
| Baz BazType |
| } |
| |
| func (BarType) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.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/x/ref/cmd/sb51/internal/demodb.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/x/ref/cmd/sb51/internal/demodb.BazType"` |
| }) { |
| } |
| |
| type Array2String [2]string |
| |
| func (Array2String) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.Array2String"` |
| }) { |
| } |
| |
| type Composite struct { |
| Arr Array2String |
| ListInt []int32 |
| MySet map[int32]struct{} |
| Map map[string]int32 |
| } |
| |
| func (Composite) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.Composite"` |
| }) { |
| } |
| |
| type Times struct { |
| Stamp time.Time |
| Interval time.Duration |
| } |
| |
| func (Times) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.Times"` |
| }) { |
| } |
| |
| type Recursive struct { |
| Any *vdl.Value |
| Maybe *Times |
| Rec map[Array2String]Recursive |
| } |
| |
| func (Recursive) __VDLReflect(struct { |
| Name string `vdl:"v.io/x/ref/cmd/sb51/internal/demodb.Recursive"` |
| }) { |
| } |
| |
| func init() { |
| 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((*FooType)(nil)) |
| vdl.Register((*BarType)(nil)) |
| vdl.Register((*TitleOrValueType)(nil)) |
| vdl.Register((*BazType)(nil)) |
| vdl.Register((*Array2String)(nil)) |
| vdl.Register((*Composite)(nil)) |
| vdl.Register((*Times)(nil)) |
| vdl.Register((*Recursive)(nil)) |
| } |