Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported type: 0x8 array in unnamed BuildSource #155

Open
tpoxa opened this issue Jul 20, 2017 · 2 comments
Open

Unsupported type: 0x8 array in unnamed BuildSource #155

tpoxa opened this issue Jul 20, 2017 · 2 comments

Comments

@tpoxa
Copy link

tpoxa commented Jul 20, 2017

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
@tpoxa
Copy link
Author

tpoxa commented Jul 20, 2017

Is there any possibility ignore some fields from Payload() or set a list of useful ones

What could be a temporary solution?
Thank you in advance.

@JermineHu
Copy link

@tpoxa You can try this https://github.com/jirfag/go-queryset to generate some code ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants