Working LLM responses and Twilio status tracking
The responses aren't good, but they do exist.
This commit is contained in:
parent
407b478637
commit
b8e7b9b7fd
13 changed files with 497 additions and 287 deletions
|
|
@ -10,8 +10,17 @@ var CommsTextLogErrors = &commsTextLogErrors{
|
|||
columns: []string{"id"},
|
||||
s: "text_log_pkey",
|
||||
},
|
||||
|
||||
ErrUniqueTextLogTwilioSidKey: &UniqueConstraintError{
|
||||
schema: "comms",
|
||||
table: "text_log",
|
||||
columns: []string{"twilio_sid"},
|
||||
s: "text_log_twilio_sid_key",
|
||||
},
|
||||
}
|
||||
|
||||
type commsTextLogErrors struct {
|
||||
ErrUniqueTextLogPkey *UniqueConstraintError
|
||||
|
||||
ErrUniqueTextLogTwilioSidKey *UniqueConstraintError
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,24 @@ var CommsTextLogs = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
TwilioSid: column{
|
||||
Name: "twilio_sid",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
TwilioStatus: column{
|
||||
Name: "twilio_status",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: commsTextLogIndexes{
|
||||
TextLogPkey: index{
|
||||
|
|
@ -97,6 +115,23 @@ var CommsTextLogs = Table[
|
|||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
TextLogTwilioSidKey: index{
|
||||
Type: "btree",
|
||||
Name: "text_log_twilio_sid_key",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "twilio_sid",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "text_log_pkey",
|
||||
|
|
@ -123,33 +158,43 @@ var CommsTextLogs = Table[
|
|||
ForeignColumns: []string{"e164"},
|
||||
},
|
||||
},
|
||||
Uniques: commsTextLogUniques{
|
||||
TextLogTwilioSidKey: constraint{
|
||||
Name: "text_log_twilio_sid_key",
|
||||
Columns: []string{"twilio_sid"},
|
||||
Comment: "",
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "Used to track text messages that were sent.",
|
||||
}
|
||||
|
||||
type commsTextLogColumns struct {
|
||||
Content column
|
||||
Created column
|
||||
Destination column
|
||||
ID column
|
||||
IsWelcome column
|
||||
Origin column
|
||||
Source column
|
||||
Content column
|
||||
Created column
|
||||
Destination column
|
||||
ID column
|
||||
IsWelcome column
|
||||
Origin column
|
||||
Source column
|
||||
TwilioSid column
|
||||
TwilioStatus column
|
||||
}
|
||||
|
||||
func (c commsTextLogColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.Content, c.Created, c.Destination, c.ID, c.IsWelcome, c.Origin, c.Source,
|
||||
c.Content, c.Created, c.Destination, c.ID, c.IsWelcome, c.Origin, c.Source, c.TwilioSid, c.TwilioStatus,
|
||||
}
|
||||
}
|
||||
|
||||
type commsTextLogIndexes struct {
|
||||
TextLogPkey index
|
||||
TextLogPkey index
|
||||
TextLogTwilioSidKey index
|
||||
}
|
||||
|
||||
func (i commsTextLogIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.TextLogPkey,
|
||||
i.TextLogPkey, i.TextLogTwilioSidKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,10 +209,14 @@ func (f commsTextLogForeignKeys) AsSlice() []foreignKey {
|
|||
}
|
||||
}
|
||||
|
||||
type commsTextLogUniques struct{}
|
||||
type commsTextLogUniques struct {
|
||||
TextLogTwilioSidKey constraint
|
||||
}
|
||||
|
||||
func (u commsTextLogUniques) AsSlice() []constraint {
|
||||
return []constraint{}
|
||||
return []constraint{
|
||||
u.TextLogTwilioSidKey,
|
||||
}
|
||||
}
|
||||
|
||||
type commsTextLogChecks struct{}
|
||||
|
|
|
|||
|
|
@ -347,6 +347,8 @@ const (
|
|||
CommsTextoriginDistrict CommsTextorigin = "district"
|
||||
CommsTextoriginLLM CommsTextorigin = "llm"
|
||||
CommsTextoriginWebsiteAction CommsTextorigin = "website-action"
|
||||
CommsTextoriginCustomer CommsTextorigin = "customer"
|
||||
CommsTextoriginReiteration CommsTextorigin = "reiteration"
|
||||
)
|
||||
|
||||
func AllCommsTextorigin() []CommsTextorigin {
|
||||
|
|
@ -354,6 +356,8 @@ func AllCommsTextorigin() []CommsTextorigin {
|
|||
CommsTextoriginDistrict,
|
||||
CommsTextoriginLLM,
|
||||
CommsTextoriginWebsiteAction,
|
||||
CommsTextoriginCustomer,
|
||||
CommsTextoriginReiteration,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +371,9 @@ func (e CommsTextorigin) Valid() bool {
|
|||
switch e {
|
||||
case CommsTextoriginDistrict,
|
||||
CommsTextoriginLLM,
|
||||
CommsTextoriginWebsiteAction:
|
||||
CommsTextoriginWebsiteAction,
|
||||
CommsTextoriginCustomer,
|
||||
CommsTextoriginReiteration:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -368,6 +368,8 @@ func (f *Factory) FromExistingCommsTextLog(m *models.CommsTextLog) *CommsTextLog
|
|||
o.IsWelcome = func() bool { return m.IsWelcome }
|
||||
o.Origin = func() enums.CommsTextorigin { return m.Origin }
|
||||
o.Source = func() string { return m.Source }
|
||||
o.TwilioSid = func() null.Val[string] { return m.TwilioSid }
|
||||
o.TwilioStatus = func() string { return m.TwilioStatus }
|
||||
|
||||
ctx := context.Background()
|
||||
if m.R.DestinationPhone != nil {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import (
|
|||
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
"github.com/jaswdr/faker/v2"
|
||||
"github.com/stephenafamo/bob"
|
||||
)
|
||||
|
|
@ -36,13 +38,15 @@ func (mods CommsTextLogModSlice) Apply(ctx context.Context, n *CommsTextLogTempl
|
|||
// CommsTextLogTemplate is an object representing the database table.
|
||||
// all columns are optional and should be set by mods
|
||||
type CommsTextLogTemplate struct {
|
||||
Content func() string
|
||||
Created func() time.Time
|
||||
Destination func() string
|
||||
ID func() int32
|
||||
IsWelcome func() bool
|
||||
Origin func() enums.CommsTextorigin
|
||||
Source func() string
|
||||
Content func() string
|
||||
Created func() time.Time
|
||||
Destination func() string
|
||||
ID func() int32
|
||||
IsWelcome func() bool
|
||||
Origin func() enums.CommsTextorigin
|
||||
Source func() string
|
||||
TwilioSid func() null.Val[string]
|
||||
TwilioStatus func() string
|
||||
|
||||
r commsTextLogR
|
||||
f *Factory
|
||||
|
|
@ -120,6 +124,14 @@ func (o CommsTextLogTemplate) BuildSetter() *models.CommsTextLogSetter {
|
|||
val := o.Source()
|
||||
m.Source = omit.From(val)
|
||||
}
|
||||
if o.TwilioSid != nil {
|
||||
val := o.TwilioSid()
|
||||
m.TwilioSid = omitnull.FromNull(val)
|
||||
}
|
||||
if o.TwilioStatus != nil {
|
||||
val := o.TwilioStatus()
|
||||
m.TwilioStatus = omit.From(val)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
@ -163,6 +175,12 @@ func (o CommsTextLogTemplate) Build() *models.CommsTextLog {
|
|||
if o.Source != nil {
|
||||
m.Source = o.Source()
|
||||
}
|
||||
if o.TwilioSid != nil {
|
||||
m.TwilioSid = o.TwilioSid()
|
||||
}
|
||||
if o.TwilioStatus != nil {
|
||||
m.TwilioStatus = o.TwilioStatus()
|
||||
}
|
||||
|
||||
o.setModelRels(m)
|
||||
|
||||
|
|
@ -207,6 +225,10 @@ func ensureCreatableCommsTextLog(m *models.CommsTextLogSetter) {
|
|||
val := random_string(nil)
|
||||
m.Source = omit.From(val)
|
||||
}
|
||||
if !(m.TwilioStatus.IsValue()) {
|
||||
val := random_string(nil)
|
||||
m.TwilioStatus = omit.From(val)
|
||||
}
|
||||
}
|
||||
|
||||
// insertOptRels creates and inserts any optional the relationships on *models.CommsTextLog
|
||||
|
|
@ -351,6 +373,8 @@ func (m commsTextLogMods) RandomizeAllColumns(f *faker.Faker) CommsTextLogMod {
|
|||
CommsTextLogMods.RandomIsWelcome(f),
|
||||
CommsTextLogMods.RandomOrigin(f),
|
||||
CommsTextLogMods.RandomSource(f),
|
||||
CommsTextLogMods.RandomTwilioSid(f),
|
||||
CommsTextLogMods.RandomTwilioStatus(f),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -571,6 +595,90 @@ func (m commsTextLogMods) RandomSource(f *faker.Faker) CommsTextLogMod {
|
|||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m commsTextLogMods) TwilioSid(val null.Val[string]) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioSid = func() null.Val[string] { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m commsTextLogMods) TwilioSidFunc(f func() null.Val[string]) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioSid = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m commsTextLogMods) UnsetTwilioSid() CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioSid = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
// The generated value is sometimes null
|
||||
func (m commsTextLogMods) RandomTwilioSid(f *faker.Faker) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioSid = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_string(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
// The generated value is never null
|
||||
func (m commsTextLogMods) RandomTwilioSidNotNull(f *faker.Faker) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioSid = func() null.Val[string] {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
val := random_string(f)
|
||||
return null.From(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m commsTextLogMods) TwilioStatus(val string) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioStatus = func() string { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m commsTextLogMods) TwilioStatusFunc(f func() string) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioStatus = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m commsTextLogMods) UnsetTwilioStatus() CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioStatus = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m commsTextLogMods) RandomTwilioStatus(f *faker.Faker) CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
|
||||
o.TwilioStatus = func() string {
|
||||
return random_string(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m commsTextLogMods) WithParentsCascading() CommsTextLogMod {
|
||||
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
|
||||
if isDone, _ := commsTextLogWithParentsCascadingCtx.Value(ctx); isDone {
|
||||
|
|
|
|||
6
db/migrations/00044_comms_text_origin_user.sql
Normal file
6
db/migrations/00044_comms_text_origin_user.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-- +goose Up
|
||||
ALTER TYPE comms.TextOrigin ADD VALUE 'customer';
|
||||
ALTER TYPE comms.TextOrigin ADD VALUE 'reiteration';
|
||||
-- +goose Down
|
||||
ALTER TYPE comms.TextOrigin DROP VALUE 'reiteration';
|
||||
ALTER TYPE comms.TextOrigin DROP VALUE 'customer';
|
||||
8
db/migrations/00045_comms_text_sid.sql
Normal file
8
db/migrations/00045_comms_text_sid.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- +goose Up
|
||||
ALTER TABLE comms.text_log ADD COLUMN twilio_sid TEXT UNIQUE;
|
||||
ALTER TABLE comms.text_log ADD COLUMN twilio_status TEXT;
|
||||
UPDATE comms.text_log SET twilio_status = '';
|
||||
ALTER TABLE comms.text_log ALTER COLUMN twilio_status SET NOT NULL;
|
||||
-- +goose Down
|
||||
ALTER TABLE comms.text_log DROP COLUMN twilio_status;
|
||||
ALTER TABLE comms.text_log DROP COLUMN twilio_sid;
|
||||
|
|
@ -10,7 +10,9 @@ import (
|
|||
"time"
|
||||
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
"github.com/stephenafamo/bob"
|
||||
"github.com/stephenafamo/bob/dialect/psql"
|
||||
"github.com/stephenafamo/bob/dialect/psql/dialect"
|
||||
|
|
@ -25,13 +27,15 @@ import (
|
|||
|
||||
// CommsTextLog is an object representing the database table.
|
||||
type CommsTextLog struct {
|
||||
Content string `db:"content" `
|
||||
Created time.Time `db:"created" `
|
||||
Destination string `db:"destination" `
|
||||
ID int32 `db:"id,pk" `
|
||||
IsWelcome bool `db:"is_welcome" `
|
||||
Origin enums.CommsTextorigin `db:"origin" `
|
||||
Source string `db:"source" `
|
||||
Content string `db:"content" `
|
||||
Created time.Time `db:"created" `
|
||||
Destination string `db:"destination" `
|
||||
ID int32 `db:"id,pk" `
|
||||
IsWelcome bool `db:"is_welcome" `
|
||||
Origin enums.CommsTextorigin `db:"origin" `
|
||||
Source string `db:"source" `
|
||||
TwilioSid null.Val[string] `db:"twilio_sid" `
|
||||
TwilioStatus string `db:"twilio_status" `
|
||||
|
||||
R commsTextLogR `db:"-" `
|
||||
}
|
||||
|
|
@ -55,29 +59,33 @@ type commsTextLogR struct {
|
|||
func buildCommsTextLogColumns(alias string) commsTextLogColumns {
|
||||
return commsTextLogColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"content", "created", "destination", "id", "is_welcome", "origin", "source",
|
||||
"content", "created", "destination", "id", "is_welcome", "origin", "source", "twilio_sid", "twilio_status",
|
||||
).WithParent("comms.text_log"),
|
||||
tableAlias: alias,
|
||||
Content: psql.Quote(alias, "content"),
|
||||
Created: psql.Quote(alias, "created"),
|
||||
Destination: psql.Quote(alias, "destination"),
|
||||
ID: psql.Quote(alias, "id"),
|
||||
IsWelcome: psql.Quote(alias, "is_welcome"),
|
||||
Origin: psql.Quote(alias, "origin"),
|
||||
Source: psql.Quote(alias, "source"),
|
||||
tableAlias: alias,
|
||||
Content: psql.Quote(alias, "content"),
|
||||
Created: psql.Quote(alias, "created"),
|
||||
Destination: psql.Quote(alias, "destination"),
|
||||
ID: psql.Quote(alias, "id"),
|
||||
IsWelcome: psql.Quote(alias, "is_welcome"),
|
||||
Origin: psql.Quote(alias, "origin"),
|
||||
Source: psql.Quote(alias, "source"),
|
||||
TwilioSid: psql.Quote(alias, "twilio_sid"),
|
||||
TwilioStatus: psql.Quote(alias, "twilio_status"),
|
||||
}
|
||||
}
|
||||
|
||||
type commsTextLogColumns struct {
|
||||
expr.ColumnsExpr
|
||||
tableAlias string
|
||||
Content psql.Expression
|
||||
Created psql.Expression
|
||||
Destination psql.Expression
|
||||
ID psql.Expression
|
||||
IsWelcome psql.Expression
|
||||
Origin psql.Expression
|
||||
Source psql.Expression
|
||||
tableAlias string
|
||||
Content psql.Expression
|
||||
Created psql.Expression
|
||||
Destination psql.Expression
|
||||
ID psql.Expression
|
||||
IsWelcome psql.Expression
|
||||
Origin psql.Expression
|
||||
Source psql.Expression
|
||||
TwilioSid psql.Expression
|
||||
TwilioStatus psql.Expression
|
||||
}
|
||||
|
||||
func (c commsTextLogColumns) Alias() string {
|
||||
|
|
@ -92,17 +100,19 @@ func (commsTextLogColumns) AliasedAs(alias string) commsTextLogColumns {
|
|||
// All values are optional, and do not have to be set
|
||||
// Generated columns are not included
|
||||
type CommsTextLogSetter struct {
|
||||
Content omit.Val[string] `db:"content" `
|
||||
Created omit.Val[time.Time] `db:"created" `
|
||||
Destination omit.Val[string] `db:"destination" `
|
||||
ID omit.Val[int32] `db:"id,pk" `
|
||||
IsWelcome omit.Val[bool] `db:"is_welcome" `
|
||||
Origin omit.Val[enums.CommsTextorigin] `db:"origin" `
|
||||
Source omit.Val[string] `db:"source" `
|
||||
Content omit.Val[string] `db:"content" `
|
||||
Created omit.Val[time.Time] `db:"created" `
|
||||
Destination omit.Val[string] `db:"destination" `
|
||||
ID omit.Val[int32] `db:"id,pk" `
|
||||
IsWelcome omit.Val[bool] `db:"is_welcome" `
|
||||
Origin omit.Val[enums.CommsTextorigin] `db:"origin" `
|
||||
Source omit.Val[string] `db:"source" `
|
||||
TwilioSid omitnull.Val[string] `db:"twilio_sid" `
|
||||
TwilioStatus omit.Val[string] `db:"twilio_status" `
|
||||
}
|
||||
|
||||
func (s CommsTextLogSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 7)
|
||||
vals := make([]string, 0, 9)
|
||||
if s.Content.IsValue() {
|
||||
vals = append(vals, "content")
|
||||
}
|
||||
|
|
@ -124,6 +134,12 @@ func (s CommsTextLogSetter) SetColumns() []string {
|
|||
if s.Source.IsValue() {
|
||||
vals = append(vals, "source")
|
||||
}
|
||||
if !s.TwilioSid.IsUnset() {
|
||||
vals = append(vals, "twilio_sid")
|
||||
}
|
||||
if s.TwilioStatus.IsValue() {
|
||||
vals = append(vals, "twilio_status")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +165,12 @@ func (s CommsTextLogSetter) Overwrite(t *CommsTextLog) {
|
|||
if s.Source.IsValue() {
|
||||
t.Source = s.Source.MustGet()
|
||||
}
|
||||
if !s.TwilioSid.IsUnset() {
|
||||
t.TwilioSid = s.TwilioSid.MustGetNull()
|
||||
}
|
||||
if s.TwilioStatus.IsValue() {
|
||||
t.TwilioStatus = s.TwilioStatus.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *CommsTextLogSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -157,7 +179,7 @@ func (s *CommsTextLogSetter) Apply(q *dialect.InsertQuery) {
|
|||
})
|
||||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 7)
|
||||
vals := make([]bob.Expression, 9)
|
||||
if s.Content.IsValue() {
|
||||
vals[0] = psql.Arg(s.Content.MustGet())
|
||||
} else {
|
||||
|
|
@ -200,6 +222,18 @@ func (s *CommsTextLogSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[6] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if !s.TwilioSid.IsUnset() {
|
||||
vals[7] = psql.Arg(s.TwilioSid.MustGetNull())
|
||||
} else {
|
||||
vals[7] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.TwilioStatus.IsValue() {
|
||||
vals[8] = psql.Arg(s.TwilioStatus.MustGet())
|
||||
} else {
|
||||
vals[8] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -209,7 +243,7 @@ func (s CommsTextLogSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s CommsTextLogSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 7)
|
||||
exprs := make([]bob.Expression, 0, 9)
|
||||
|
||||
if s.Content.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -260,6 +294,20 @@ func (s CommsTextLogSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if !s.TwilioSid.IsUnset() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "twilio_sid")...),
|
||||
psql.Arg(s.TwilioSid),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.TwilioStatus.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "twilio_status")...),
|
||||
psql.Arg(s.TwilioStatus),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
|
|
@ -631,13 +679,15 @@ func (commsTextLog0 *CommsTextLog) AttachSourcePhone(ctx context.Context, exec b
|
|||
}
|
||||
|
||||
type commsTextLogWhere[Q psql.Filterable] struct {
|
||||
Content psql.WhereMod[Q, string]
|
||||
Created psql.WhereMod[Q, time.Time]
|
||||
Destination psql.WhereMod[Q, string]
|
||||
ID psql.WhereMod[Q, int32]
|
||||
IsWelcome psql.WhereMod[Q, bool]
|
||||
Origin psql.WhereMod[Q, enums.CommsTextorigin]
|
||||
Source psql.WhereMod[Q, string]
|
||||
Content psql.WhereMod[Q, string]
|
||||
Created psql.WhereMod[Q, time.Time]
|
||||
Destination psql.WhereMod[Q, string]
|
||||
ID psql.WhereMod[Q, int32]
|
||||
IsWelcome psql.WhereMod[Q, bool]
|
||||
Origin psql.WhereMod[Q, enums.CommsTextorigin]
|
||||
Source psql.WhereMod[Q, string]
|
||||
TwilioSid psql.WhereNullMod[Q, string]
|
||||
TwilioStatus psql.WhereMod[Q, string]
|
||||
}
|
||||
|
||||
func (commsTextLogWhere[Q]) AliasedAs(alias string) commsTextLogWhere[Q] {
|
||||
|
|
@ -646,13 +696,15 @@ func (commsTextLogWhere[Q]) AliasedAs(alias string) commsTextLogWhere[Q] {
|
|||
|
||||
func buildCommsTextLogWhere[Q psql.Filterable](cols commsTextLogColumns) commsTextLogWhere[Q] {
|
||||
return commsTextLogWhere[Q]{
|
||||
Content: psql.Where[Q, string](cols.Content),
|
||||
Created: psql.Where[Q, time.Time](cols.Created),
|
||||
Destination: psql.Where[Q, string](cols.Destination),
|
||||
ID: psql.Where[Q, int32](cols.ID),
|
||||
IsWelcome: psql.Where[Q, bool](cols.IsWelcome),
|
||||
Origin: psql.Where[Q, enums.CommsTextorigin](cols.Origin),
|
||||
Source: psql.Where[Q, string](cols.Source),
|
||||
Content: psql.Where[Q, string](cols.Content),
|
||||
Created: psql.Where[Q, time.Time](cols.Created),
|
||||
Destination: psql.Where[Q, string](cols.Destination),
|
||||
ID: psql.Where[Q, int32](cols.ID),
|
||||
IsWelcome: psql.Where[Q, bool](cols.IsWelcome),
|
||||
Origin: psql.Where[Q, enums.CommsTextorigin](cols.Origin),
|
||||
Source: psql.Where[Q, string](cols.Source),
|
||||
TwilioSid: psql.WhereNull[Q, string](cols.TwilioSid),
|
||||
TwilioStatus: psql.Where[Q, string](cols.TwilioStatus),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue