restructuring of files. added 2 new methods(Asc, Desc) to field
This commit is contained in:
@@ -12,29 +12,33 @@ import (
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
type insertQry struct {
|
||||
returing *string
|
||||
onConflict *string
|
||||
|
||||
table string
|
||||
conflictAction string
|
||||
|
||||
fields []string
|
||||
vals []string
|
||||
args []any
|
||||
debug bool
|
||||
}
|
||||
|
||||
func (t *Table) Insert() Insert {
|
||||
qb := &insertQry{
|
||||
table: t.Name,
|
||||
fields: make([]string, 0, t.FieldCount),
|
||||
vals: make([]string, 0, t.FieldCount),
|
||||
args: make([]any, 0, t.FieldCount),
|
||||
debug: t.debug,
|
||||
type (
|
||||
InsertClause interface {
|
||||
Insert
|
||||
Returning(field Field) First
|
||||
OnConflict(fields ...Field) Do
|
||||
Execute
|
||||
Stringer
|
||||
}
|
||||
return qb
|
||||
}
|
||||
|
||||
Insert interface {
|
||||
Set(field Field, val any) InsertClause
|
||||
SetMap(fields map[Field]any) InsertClause
|
||||
}
|
||||
|
||||
insertQry struct {
|
||||
returing *string
|
||||
onConflict *string
|
||||
|
||||
table string
|
||||
conflictAction string
|
||||
|
||||
fields []string
|
||||
vals []string
|
||||
args []any
|
||||
debug bool
|
||||
}
|
||||
)
|
||||
|
||||
func (q *insertQry) Set(field Field, val any) InsertClause {
|
||||
q.fields = append(q.fields, field.Name())
|
||||
|
||||
Reference in New Issue
Block a user