go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

[Feature request] generate api

Open gaoyusongcn opened this issue 2 years ago • 2 comments

About the goctl api to generate [2]float64

some code snippets as below:

my.api

type (
	MyPointResp {
		Coords  [2]float64  `json:"coords"`
	}
)

Current Behavior

types/types.go:

type MyPointResp struct {
	Coords  []float64  `json:"coords"`
}

Expected Behavior

types/types.go:

type MyPointResp struct {
	Coords  [2]float64  `json:"coords"`
}

gaoyusongcn avatar Sep 01 '22 14:09 gaoyusongcn

Got it, I'll fix it!

kesonan avatar Sep 01 '22 15:09 kesonan

@wonderfate zero-api only supported slice, so you will never get

type MyPointResp struct {
	Coords  []float64  `json:"coords"`
}

from

type (
	MyPointResp {
		Coords  [2]float64  `json:"coords"`
	}
)

kesonan avatar Sep 05 '22 14:09 kesonan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 06 '23 01:09 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Mar 15 '24 01:03 github-actions[bot]