Begin process of getting text responses from an LLM.
This commit is contained in:
parent
c276cbac0b
commit
6070d50a58
18 changed files with 639 additions and 22 deletions
135
db/sql/texts_by_senders.bob.go
Normal file
135
db/sql/texts_by_senders.bob.go
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
// Code generated by BobGen psql v0.42.1. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package sql
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"io"
|
||||
"iter"
|
||||
"time"
|
||||
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/stephenafamo/bob"
|
||||
"github.com/stephenafamo/bob/dialect/psql"
|
||||
"github.com/stephenafamo/bob/dialect/psql/dialect"
|
||||
"github.com/stephenafamo/bob/orm"
|
||||
"github.com/stephenafamo/scan"
|
||||
)
|
||||
|
||||
//go:embed texts_by_senders.bob.sql
|
||||
var formattedQueries_texts_by_senders string
|
||||
|
||||
var textsBySendersSQL = formattedQueries_texts_by_senders[152:393]
|
||||
|
||||
type TextsBySendersQuery = orm.ModQuery[*dialect.SelectQuery, textsBySenders, TextsBySendersRow, []TextsBySendersRow, textsBySendersTransformer]
|
||||
|
||||
func TextsBySenders(Destination string, Source string) *TextsBySendersQuery {
|
||||
var expressionTypArgs textsBySenders
|
||||
|
||||
expressionTypArgs.Destination = psql.Arg(Destination)
|
||||
expressionTypArgs.Source = psql.Arg(Source)
|
||||
|
||||
return &TextsBySendersQuery{
|
||||
Query: orm.Query[textsBySenders, TextsBySendersRow, []TextsBySendersRow, textsBySendersTransformer]{
|
||||
ExecQuery: orm.ExecQuery[textsBySenders]{
|
||||
BaseQuery: bob.BaseQuery[textsBySenders]{
|
||||
Expression: expressionTypArgs,
|
||||
Dialect: dialect.Dialect,
|
||||
QueryType: bob.QueryTypeSelect,
|
||||
},
|
||||
},
|
||||
Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (TextsBySendersRow, error)) {
|
||||
return func(row *scan.Row) (any, error) {
|
||||
var t TextsBySendersRow
|
||||
row.ScheduleScanByIndex(0, &t.ID)
|
||||
row.ScheduleScanByIndex(1, &t.Content)
|
||||
row.ScheduleScanByIndex(2, &t.Created)
|
||||
row.ScheduleScanByIndex(3, &t.Source)
|
||||
row.ScheduleScanByIndex(4, &t.Destination)
|
||||
row.ScheduleScanByIndex(5, &t.IsWelcome)
|
||||
row.ScheduleScanByIndex(6, &t.Origin)
|
||||
return &t, nil
|
||||
}, func(v any) (TextsBySendersRow, error) {
|
||||
return *(v.(*TextsBySendersRow)), nil
|
||||
}
|
||||
},
|
||||
},
|
||||
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
|
||||
q.AppendSelect(expressionTypArgs.subExpr(12, 97))
|
||||
q.SetTable(expressionTypArgs.subExpr(108, 122))
|
||||
q.AppendWhere(expressionTypArgs.subExpr(135, 214))
|
||||
q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(230, 241))
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type TextsBySendersRow = struct {
|
||||
ID int32 `db:"id"`
|
||||
Content string `db:"content"`
|
||||
Created time.Time `db:"created"`
|
||||
Source string `db:"source"`
|
||||
Destination string `db:"destination"`
|
||||
IsWelcome bool `db:"is_welcome"`
|
||||
Origin enums.CommsTextorigin `db:"origin"`
|
||||
}
|
||||
|
||||
type textsBySendersTransformer = bob.SliceTransformer[TextsBySendersRow, []TextsBySendersRow]
|
||||
|
||||
type textsBySenders struct {
|
||||
Destination bob.Expression
|
||||
Source bob.Expression
|
||||
}
|
||||
|
||||
func (o textsBySenders) args() iter.Seq[orm.ArgWithPosition] {
|
||||
return func(yield func(arg orm.ArgWithPosition) bool) {
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "destination",
|
||||
Start: 144,
|
||||
Stop: 146,
|
||||
Expression: o.Destination,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "source",
|
||||
Start: 165,
|
||||
Stop: 167,
|
||||
Expression: o.Source,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "source",
|
||||
Start: 191,
|
||||
Stop: 193,
|
||||
Expression: o.Source,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "destination",
|
||||
Start: 212,
|
||||
Stop: 214,
|
||||
Expression: o.Destination,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o textsBySenders) raw(from, to int) string {
|
||||
return textsBySendersSQL[from:to]
|
||||
}
|
||||
|
||||
func (o textsBySenders) subExpr(from, to int) bob.Expression {
|
||||
return orm.ArgsToExpression(textsBySendersSQL, from, to, o.args())
|
||||
}
|
||||
|
||||
func (o textsBySenders) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return o.subExpr(0, len(textsBySendersSQL)).WriteSQL(ctx, w, d, start)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue