mirror of https://github.com/rocboss/paopao-ce
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.
66 lines
2.1 KiB
66 lines
2.1 KiB
// Code generated by Yesql. DO NOT EDIT.
|
|
// versions:
|
|
// - Yesql v1.9.0
|
|
|
|
package pg
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/alimy/yesql"
|
|
"github.com/bitbus/sqlx"
|
|
)
|
|
|
|
var (
|
|
_ = fmt.Errorf("error for placeholder")
|
|
)
|
|
|
|
const (
|
|
_TweetManage_AddPost = `INSERT INTO @post (user_id, tags, ip, ip_loc, attachment_price, visibility, latest_replied_on, created_on) VALUES (:user_id, :tags, :ip, :ip_loc, :attachment_price, :visibility, :latest_replied_on, :created_on) RETURNING id`
|
|
_TweetManage_AddPostContent = `INSERT INTO @post_content (post_id, user_id, content, type, sort, created_on) VALUES (:post_id, :user_id, :content, :type, :sort, :created_on) 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 TweetManage struct {
|
|
yesql.Namespace `yesql:"tweet_manage"`
|
|
AddPost *sqlx.NamedStmt `yesql:"add_post"`
|
|
AddPostContent *sqlx.NamedStmt `yesql:"add_post_content"`
|
|
}
|
|
|
|
func BuildTweetManage(p PreparexBuilder, ctx ...context.Context) (obj *TweetManage, err error) {
|
|
var c context.Context
|
|
if len(ctx) > 0 && ctx[0] != nil {
|
|
c = ctx[0]
|
|
} else {
|
|
c = context.Background()
|
|
}
|
|
obj = &TweetManage{}
|
|
if obj.AddPost, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPost))); err != nil {
|
|
return nil, fmt.Errorf("prepare _TweetManage_AddPost error: %w", err)
|
|
}
|
|
if obj.AddPostContent, err = p.PrepareNamedContext(c, p.Rebind(p.QueryHook(_TweetManage_AddPostContent))); err != nil {
|
|
return nil, fmt.Errorf("prepare _TweetManage_AddPostContent error: %w", err)
|
|
}
|
|
return
|
|
}
|