goadesign / goadesign/gorma

Unsupported type: 0x8 array in unnamed BuildSource

Open
#155 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
141
Forks
35
PR merge metrics
No merged PRs in 30d

Description

I do use Array and Hash in my payload for resource

Payload
```

var CreateUpdateCampaignPayload = Type("CreateUpdateCampaignPayload", func() {

Attribute("description", String, func() {
Example("Campaign description")
})

Attribute("urlTemplate", String, func() {
Example("http://offers.com/offer1")
Format("uri")
})

Attribute("defaultBid", Number, func() {
Example(0.00150)
})

Attribute("dailyBalance", Number, func() {
Example(100)
})

Attribute("countryBids", HashOf(String, String), func() {
var m = make(map[string]string);
m["UK"] = "0.01";
Example(m)
})

Attribute("dateFrom", String, func() {
Example("2017-01-01")
})

Attribute("dateTo", String, func() {
Example("2018-01-01")
})

Attribute("maxClicksPerIpPer24h", Integer, func() {
Example(5)
})

Attribute("adult", String, func() {
Enum("adult", "noadult", "both")
Example("both")
})

Attribute("timeRange", ArrayOf(String), func() {
Example([]string{"Mon08-24","Tue00-05","Tue08-24"})
})

Attribute("bidScheme", String, func() {
Example("smart")
})

Attribute("sourcesWhiteList", ArrayOf(String), func() {
Example([]string{"a", "b"})
})

Attribute("sourcesBlackList", ArrayOf(String), func() {
Example([]string{"c", "d"})
})

Attribute("countries", ArrayOf(String), func() {
Example([]string{"uk", "de"})
})

Attribute("osWhiteList", ArrayOf(String), func() {
Example([]string{"MacOS", "Windows"})
})

Attribute("browsersWhiteList", ArrayOf(String), func() {
Example([]string{"Chrome", "Safari"})
})

Attribute("categoriesWhiteList", ArrayOf(String), func() {
Example([]string{"caregory1", "caregory2"})
})
})
```

Resource

```
var _ = Resource("campaign", func() {
DefaultMedia(Account)
BasePath("/campaign")

Action("create", func() {
Routing(
POST("/details"),
)
Payload(CreateUpdateCampaignPayload, func(){
Required("description")
Required("urlTemplate")
Required("defaultBid")
Required("dailyBalance")
})
Description("Creates new campaign")

Response(OK, CommonResponse)
Response(BadRequest, ErrorMedia)

})
})
```

Model

```

var _ = StorageGroup("Storage", func() {
Description("This is the global storage group")
Store("mysql", gorma.MySQL, func() {
Model("CampaignModel", func() {

BuildsFrom(func() {
Payload("campaign", "create")
})
RendersTo(CampaignMediaType) // a Media Type definition
Description("Campaign model")

Field("ID", gorma.Integer, func() { // Required for CRUD getters to take a PK argument!
PrimaryKey()
Description("This is the ID PK field")
})

Field("CreatedAt", gorma.Timestamp)
Field("UpdatedAt", gorma.Timestamp) // Shown for demonstration
Field("DeletedAt", gorma.NullableTimestamp) // These are added by default
})
})
})
```

An error

```
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0xa hash in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.