name = "" ft = gorma.String gorma.GormaDesign = nil InitDesign() RandomPayload = Type("UserPayload", func() { Attribute("first_name", String) Attribute("last_name", String) }) }) JustBeforeEach(func() { gdsl.StorageGroup(sgname, func() { gdsl.Store(storename, gorma.MySQL, func() { gdsl.Model(modelname, func() { gdsl.BuiltFrom(RandomPayload) gdsl.Field(name, ft, dsl) gdsl.Field("id", gorma.PKInteger, dsl) // use lowercase "id" to test sanitizer gdsl.Field("CreatedAt", gorma.Timestamp) gdsl.Field("UpdatedAt", gorma.Timestamp) gdsl.Field("DeletedAt", gorma.NullableTimestamp) }) }) }) Run() }) Context("with no DSL", func() { BeforeEach(func() { name = "FirstName"
Attribute("last_name", String) }) HasManyPayload = Type("HasManyPayload", func() { Attribute("first_name", String) Attribute("last_name", String) }) }) JustBeforeEach(func() { gdsl.StorageGroup(sgname, func() { gdsl.Store(storename, gorma.MySQL, func() { gdsl.Model(name, dsl) gdsl.Model("Child", func() { gdsl.BuiltFrom(ChildPayload) gdsl.BelongsTo(name) }) gdsl.Model("One", func() { gdsl.BuiltFrom(HasOnePayload) gdsl.HasOne("Child") }) gdsl.Model("Many", func() { gdsl.BuiltFrom(HasManyPayload) gdsl.HasMany("Children", "Child") }) }) }) Run()