You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/internal/dao/sakila/auto/pg/pg.go

59 lines
1.4 KiB

// Code generated by Yesql. DO NOT EDIT.
// versions:
// - Yesql v1.9.0
package pg
import (
"context"
"fmt"
"github.com/bitbus/sqlx"
)
var (
_ = fmt.Errorf("error for placeholder")
)
const (
_InsertTag = `INSERT INTO @tag (user_id, tag, created_on, modified_on, quote_num) VALUES (?, ?, ?, ?, 1) RETURNING id`
)
// PreparexContext enhances the Conn interface with context.
type PreparexContext interface {
// PrepareContext prepares a statement.
// The provided context is used for the preparation of the statement, not for
// the execution of the statement.
PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error)
// PrepareNamedContext returns an sqlx.NamedStmt
PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
// Rebind rebind query to adapte SQL Driver
Rebind(query string) string
}
// PreparexBuilder preparex builder interface for sqlx
type PreparexBuilder interface {
PreparexContext
QueryHook(query string) string
}
type Yesql struct {
InsertTag *sqlx.Stmt `yesql:"insert_tag"`
}
func BuildYesql(p PreparexBuilder, ctx ...context.Context) (obj *Yesql, err error) {
var c context.Context
if len(ctx) > 0 && ctx[0] != nil {
c = ctx[0]
} else {
c = context.Background()
}
obj = &Yesql{}
if obj.InsertTag, err = p.PreparexContext(c, p.Rebind(p.QueryHook(_InsertTag))); err != nil {
return nil, fmt.Errorf("prepare _InsertTag error: %w", err)
}
return
}