response

package
v1.2.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PlainResponseTemplate = `package response

type {{.Name}}Response struct {
}`
View Source
var ResponseTemplate = `package response

import (
	"{{.ModelPath}}/model"
	"time"
)

type {{.Name}}Response struct {
	ID uint ` + "`json:\"id\"`" + `
	CreatedAt time.Time ` + "`json:\"created_at\"`" + `
	UpdatedAt time.Time ` + "`json:\"updated_at\"`" + `
}

func (r *{{.Name}}Response) MakeOne({{.CamelCaseName}} model.{{.ModelName}}) {{.Name}}Response {
	return {{.Name}}Response{}
}

func (r *{{.Name}}Response) Make({{.CamelCaseName}} []model.{{.ModelName}}) []{{.Name}}Response {
	{{.CamelCaseName}}Responses := make([]{{.Name}}Response, len({{.CamelCaseName}}))
	for k, v := range {{.CamelCaseName}} {
		{{.CamelCaseName}}Responses[k] = r.MakeOne(v)
	}
	return {{.CamelCaseName}}Responses
}
`

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL