template

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Imports defines a import template for model in cache case
	Imports = `` /* 329-byte string literal not displayed */

	// ImportsNoCache defines a import template for model in normal case
	ImportsNoCache = `` /* 279-byte string literal not displayed */

)
View Source
var Delete = `` /* 709-byte string literal not displayed */

Delete defines a delete template

View Source
var DeleteMethod = `Delete({{.lowerStartCamelPrimaryKey}} {{.dataType}}) error`

DeleteMethod defines a delete template for interface method

View Source
var Error = `package {{.pkg}}

import "github.com/melonwool/go-zero/core/stores/sqlx"

var ErrNotFound = sqlx.ErrNotFound
`

Error defines an error template

View Source
var Field = `{{.name}} {{.type}} {{.tag}} {{if .hasComment}}// {{.comment}}{{end}}`

Field defines a filed template for types

View Source
var FindOne = `` /* 1005-byte string literal not displayed */

FindOne defines find row by id.

View Source
var FindOneByField = `` /* 1110-byte string literal not displayed */

FindOneByField defines find row by field.

View Source
var FindOneByFieldExtraMethod = `` /* 440-byte string literal not displayed */

FindOneByFieldExtraMethod defines find row by field with extras.

View Source
var FindOneByFieldMethod = `FindOneBy{{.upperField}}({{.in}}) (*{{.upperStartCamelObject}}, error) `

FindOneByFieldMethod defines find row by field method.

View Source
var FindOneMethod = `FindOne({{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error)`

FindOneMethod defines find row method.

View Source
var Insert = `` /* 845-byte string literal not displayed */

Insert defines a template for insert code in model

View Source
var InsertMethod = `Insert(data {{.upperStartCamelObject}}) (sql.Result,error)`

InsertMethod defines a interface method template for insert code in model

View Source
var Model = `package {{.pkg}}
{{.imports}}
{{.vars}}
{{.types}}
{{.new}}
{{.insert}}
{{.find}}
{{.update}}
{{.delete}}
{{.extraMethod}}
`

Model defines a template for model

View Source
var New = `` /* 297-byte string literal not displayed */

New defines an template for creating model instance

View Source
var Tag = "`db:\"{{.field}}\"`"

Tag defines a tag template text

View Source
var Types = `` /* 261-byte string literal not displayed */

Types defines a template for types in model

View Source
var Update = `` /* 638-byte string literal not displayed */

Update defines a template for generating update codes

View Source
var UpdateMethod = `Update(data {{.upperStartCamelObject}}) error`

UpdateMethod defines an interface method template for generating update codes

View Source
var Vars = fmt.Sprintf(`
var (
	{{.lowerStartCamelObject}}FieldNames          = builderx.RawFieldNames(&{{.upperStartCamelObject}}{})
	{{.lowerStartCamelObject}}Rows                = strings.Join({{.lowerStartCamelObject}}FieldNames, ",")
	{{.lowerStartCamelObject}}RowsExpectAutoSet   = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "%screate_time%s", "%supdate_time%s"), ",")
	{{.lowerStartCamelObject}}RowsWithPlaceHolder = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "%screate_time%s", "%supdate_time%s"), "=?,") + "=?"

	{{if .withCache}}{{.cacheKeys}}{{end}}
)
`, "`", "`", "`", "`", "`", "`", "`", "`")

Vars defines a template for var block in model

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