We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IsAutoGenerated to Column
IsAutoGenerated
The text was updated successfully, but these errors were encountered:
func Insert(db {{$rootPkg}}.DB, r *Row) error { const sqlstr = `INSERT INTO {{ $table }} ( {{$insertCols}} ) VALUES ( {{ template "values" $numNonPKs }} ) RETURNING id;` err := db.QueryRow(sqlstr, {{join ((.Table.Columns.Names.Except .Table.PrimaryKeys.Names).Sprintf "r.%s") ", "}}).Scan( {{join (.Table.PrimaryKeys.Names.Sprintf "&r.%s") ", "}}) return errors.Wrap(err, "insert {{.Table.Name}}") }
Is there a better solution? id SERIAL PRIMARY KEY
id SERIAL PRIMARY KEY
Sorry, something went wrong.
// Insert inserts the row into the database. func Insert(db models.DB, r *Row) error { const sqlstr = `INSERT INTO sys_user ( username, password, salt, avatar, created_at, updated_at ) VALUES ( $1, $2, $3, $4, $5, $6 ) RETURNING id;` err := db.QueryRow(sqlstr, r.Username, r.Password, r.Salt, r.Avatar, r.CreatedAt,r.UpdatedAt).Scan(&r.ID) return errors.Wrap(err, "insert SysUser") }
No branches or pull requests
Add
IsAutoGenerated
to ColumnThe text was updated successfully, but these errors were encountered: