entc/gen: fix grammar and language usage in function comments (#1126)

* fix grammar and english usage in templates

* bindata gen

* codegen

* go generate ./again...
This commit is contained in:
Nathaniel Peiffer
2021-01-04 23:34:40 +11:00
committed by GitHub
parent 7afc24826b
commit b8b82f80a4
633 changed files with 15512 additions and 15072 deletions

View File

@@ -140,7 +140,7 @@ func ({{ $receiver }} *{{ $builder }}) Save(ctx context.Context) ([]*{{ $.Name }
return nodes, nil
}
// SaveX calls Save and panics if Save returns an error.
// SaveX is like Save, but panics if an error occurs.
func ({{ $receiver }} *{{ $builder }}) SaveX(ctx context.Context) []*{{ $.Name }} {
v, err := {{ $receiver }}.Save(ctx)
if err != nil {

View File

@@ -27,7 +27,7 @@ func isSQLConstraintError(err error) (*ConstraintError, bool) {
return nil, false
}
// rollback calls to tx.Rollback and wraps the given error with the rollback error if occurred.
// rollback calls tx.Rollback and wraps the given error with the rollback error if present.
func rollback(tx dialect.Tx, err error) error {
if rerr := tx.Rollback(); rerr != nil {
err = fmt.Errorf("%s: %v", err.Error(), rerr)

View File

@@ -8,7 +8,7 @@ in the LICENSE file in the root directory of this source tree.
{{ define "dialect/sql/meta/constants" }}
{{- range $t := $.RelatedTypes }}
{{- if ne $t.ID.StorageKey $.ID.StorageKey }}
// {{ $t.Name }}FieldID holds the string denoting the id field of the {{ $t.Name }}.
// {{ $t.Name }}FieldID holds the string denoting the ID field of the {{ $t.Name }}.
{{ $t.Name }}FieldID = "{{ $t.ID.StorageKey }}"
{{- end }}
{{- end }}

View File

@@ -5,7 +5,7 @@ in the LICENSE file in the root directory of this source tree.
*/}}
{{ define "dialect/sql/txoptions" }}
// BeginTx returns a transactional client with options.
// BeginTx returns a transactional client with specified options.
func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
if _, ok := c.driver.(*txDriver); ok {
return nil, fmt.Errorf("ent: cannot start a transaction within a transaction")