draft.go 566 Bytes
Newer Older
1 2 3 4
package typed

var (
	// Prelude types
Eric Myhre's avatar
Eric Myhre committed
5 6
	tString = TypeString{
		Name: "String",
7 8
	}
	// User's types
Eric Myhre's avatar
Eric Myhre committed
9 10 11 12 13 14 15 16 17 18 19 20
	/*
		struct Foo {
			f1 String
			f2 [nullable String]
			f3 optional String
		}
	*/
	tFoo = TypeObject{
		Name: "Foo",
		Fields: []ObjectField{
			{"f1", tString, false, true},
			{"f2", TypeList{
21
				Name:          "", // "[nullable String]" can be calculated.
Eric Myhre's avatar
Eric Myhre committed
22 23 24 25 26
				Anon:          true,
				ValueType:     tString,
				ValueNullable: true,
			}, false, false},
			{"f3", tString, true, false},
27 28 29 30 31 32 33
		},
	}
	// The Universe
	example = Universe{
		tFoo.Name: tFoo,
	}
)