entc/gen/template: add goland-annotation for template data-types

This commit is contained in:
Ariel Mashraki
2021-04-09 13:03:04 +03:00
committed by Ariel Mashraki
parent d7b683c0d3
commit 34aabc0eb1
56 changed files with 221 additions and 111 deletions

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{ define "dialect/sql/order/signature" -}}
// OrderFunc applies an ordering on the sql selector.
type OrderFunc func(*sql.Selector)

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/create" }}
{{ $builder := pascal $.Scope.Builder }}
{{ $receiver := receiver $builder }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/decode/one" }}
{{ $receiver := $.Receiver }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/delete" }}
{{ $builder := pascal $.Scope.Builder }}
{{ $receiver := receiver $builder }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{/* Additional fields for the generated model for holding the foreign-keys */}}
{{ define "dialect/sql/model/fields" }}
{{- range $fk := $.UnexportedForeignKeys }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{ define "dialect/sql/entql" }}
{{ $pkg := base $.Config.Package }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{/* custom errors and errors handlers for sql dialects */}}
{{ define "dialect/sql/errors" }}
func isSQLConstraintError(err error) (*ConstraintError, bool) {

View File

@@ -4,5 +4,7 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{/* custom globals and helpers for sql dialects */}}
{{ define "dialect/sql/globals" }}{{ end }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/group" }}
{{ $builder := pascal $.Scope.Builder }}
{{ $receiver := receiver $builder }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Type */}}
{{/* constants needed for sql dialects. */}}
{{ define "dialect/sql/meta/constants" }}
{{- range $t := $.RelatedTypes }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{ define "dialect/sql/client/open" }}
drv, err := sql.Open(driverName, dataSourceName)
if err != nil {

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/predicate/id" -}}
func(s *sql.Selector) {
s.Where(sql.EQ(s.C({{ $.ID.Constant }}), id))

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{/* Additional fields for the builder. */}}
{{ define "dialect/sql/query/fields" }}
{{- with $.UnexportedForeignKeys }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/select" }}
{{ $builder := pascal $.Scope.Builder }}
{{ $receiver := receiver $builder }}

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
{{ define "dialect/sql/txoptions" }}
// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {

View File

@@ -4,6 +4,8 @@ This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
*/}}
{{/* gotype: entgo.io/ent/entc/gen.typeScope */}}
{{ define "dialect/sql/update" }}
{{ $pkg := $.Scope.Package }}
{{ $builder := pascal $.Scope.Builder }}