nidus-sync/db/factory/comms.text_log.bob.go
Eli Ribble a68b8781e7
Add ability to make LLM agent forget the conversation history
This is extremely useful for testing.

In order to do this I needed to actually deploy the migration to a bob
fork so I could start to add support for behaviors I really want.
Specifically the ability to search for ids in a slice.
2026-01-27 18:44:02 +00:00

803 lines
23 KiB
Go

// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package factory
import (
"context"
"testing"
"time"
"github.com/Gleipnir-Technology/bob"
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"
)
type CommsTextLogMod interface {
Apply(context.Context, *CommsTextLogTemplate)
}
type CommsTextLogModFunc func(context.Context, *CommsTextLogTemplate)
func (f CommsTextLogModFunc) Apply(ctx context.Context, n *CommsTextLogTemplate) {
f(ctx, n)
}
type CommsTextLogModSlice []CommsTextLogMod
func (mods CommsTextLogModSlice) Apply(ctx context.Context, n *CommsTextLogTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// 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
TwilioSid func() null.Val[string]
TwilioStatus func() string
IsVisibleToLLM func() bool
r commsTextLogR
f *Factory
alreadyPersisted bool
}
type commsTextLogR struct {
DestinationPhone *commsTextLogRDestinationPhoneR
SourcePhone *commsTextLogRSourcePhoneR
}
type commsTextLogRDestinationPhoneR struct {
o *CommsPhoneTemplate
}
type commsTextLogRSourcePhoneR struct {
o *CommsPhoneTemplate
}
// Apply mods to the CommsTextLogTemplate
func (o *CommsTextLogTemplate) Apply(ctx context.Context, mods ...CommsTextLogMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.CommsTextLog
// according to the relationships in the template. Nothing is inserted into the db
func (t CommsTextLogTemplate) setModelRels(o *models.CommsTextLog) {
if t.r.DestinationPhone != nil {
rel := t.r.DestinationPhone.o.Build()
rel.R.DestinationTextLogs = append(rel.R.DestinationTextLogs, o)
o.Destination = rel.E164 // h2
o.R.DestinationPhone = rel
}
if t.r.SourcePhone != nil {
rel := t.r.SourcePhone.o.Build()
rel.R.SourceTextLogs = append(rel.R.SourceTextLogs, o)
o.Source = rel.E164 // h2
o.R.SourcePhone = rel
}
}
// BuildSetter returns an *models.CommsTextLogSetter
// this does nothing with the relationship templates
func (o CommsTextLogTemplate) BuildSetter() *models.CommsTextLogSetter {
m := &models.CommsTextLogSetter{}
if o.Content != nil {
val := o.Content()
m.Content = omit.From(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omit.From(val)
}
if o.Destination != nil {
val := o.Destination()
m.Destination = omit.From(val)
}
if o.ID != nil {
val := o.ID()
m.ID = omit.From(val)
}
if o.IsWelcome != nil {
val := o.IsWelcome()
m.IsWelcome = omit.From(val)
}
if o.Origin != nil {
val := o.Origin()
m.Origin = omit.From(val)
}
if o.Source != nil {
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)
}
if o.IsVisibleToLLM != nil {
val := o.IsVisibleToLLM()
m.IsVisibleToLLM = omit.From(val)
}
return m
}
// BuildManySetter returns an []*models.CommsTextLogSetter
// this does nothing with the relationship templates
func (o CommsTextLogTemplate) BuildManySetter(number int) []*models.CommsTextLogSetter {
m := make([]*models.CommsTextLogSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.CommsTextLog
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use CommsTextLogTemplate.Create
func (o CommsTextLogTemplate) Build() *models.CommsTextLog {
m := &models.CommsTextLog{}
if o.Content != nil {
m.Content = o.Content()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.Destination != nil {
m.Destination = o.Destination()
}
if o.ID != nil {
m.ID = o.ID()
}
if o.IsWelcome != nil {
m.IsWelcome = o.IsWelcome()
}
if o.Origin != nil {
m.Origin = o.Origin()
}
if o.Source != nil {
m.Source = o.Source()
}
if o.TwilioSid != nil {
m.TwilioSid = o.TwilioSid()
}
if o.TwilioStatus != nil {
m.TwilioStatus = o.TwilioStatus()
}
if o.IsVisibleToLLM != nil {
m.IsVisibleToLLM = o.IsVisibleToLLM()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.CommsTextLogSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use CommsTextLogTemplate.CreateMany
func (o CommsTextLogTemplate) BuildMany(number int) models.CommsTextLogSlice {
m := make(models.CommsTextLogSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableCommsTextLog(m *models.CommsTextLogSetter) {
if !(m.Content.IsValue()) {
val := random_string(nil)
m.Content = omit.From(val)
}
if !(m.Created.IsValue()) {
val := random_time_Time(nil)
m.Created = omit.From(val)
}
if !(m.Destination.IsValue()) {
val := random_string(nil)
m.Destination = omit.From(val)
}
if !(m.IsWelcome.IsValue()) {
val := random_bool(nil)
m.IsWelcome = omit.From(val)
}
if !(m.Origin.IsValue()) {
val := random_enums_CommsTextorigin(nil)
m.Origin = omit.From(val)
}
if !(m.Source.IsValue()) {
val := random_string(nil)
m.Source = omit.From(val)
}
if !(m.TwilioStatus.IsValue()) {
val := random_string(nil)
m.TwilioStatus = omit.From(val)
}
if !(m.IsVisibleToLLM.IsValue()) {
val := random_bool(nil)
m.IsVisibleToLLM = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.CommsTextLog
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *CommsTextLogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsTextLog) error {
var err error
return err
}
// Create builds a commsTextLog and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *CommsTextLogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsTextLog, error) {
var err error
opt := o.BuildSetter()
ensureCreatableCommsTextLog(opt)
if o.r.DestinationPhone == nil {
CommsTextLogMods.WithNewDestinationPhone().Apply(ctx, o)
}
var rel0 *models.CommsPhone
if o.r.DestinationPhone.o.alreadyPersisted {
rel0 = o.r.DestinationPhone.o.Build()
} else {
rel0, err = o.r.DestinationPhone.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.Destination = omit.From(rel0.E164)
if o.r.SourcePhone == nil {
CommsTextLogMods.WithNewSourcePhone().Apply(ctx, o)
}
var rel1 *models.CommsPhone
if o.r.SourcePhone.o.alreadyPersisted {
rel1 = o.r.SourcePhone.o.Build()
} else {
rel1, err = o.r.SourcePhone.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.Source = omit.From(rel1.E164)
m, err := models.CommsTextLogs.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.DestinationPhone = rel0
m.R.SourcePhone = rel1
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
return m, err
}
// MustCreate builds a commsTextLog and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *CommsTextLogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsTextLog {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a commsTextLog and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o *CommsTextLogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsTextLog {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple commsTextLogs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o CommsTextLogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsTextLogSlice, error) {
var err error
m := make(models.CommsTextLogSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple commsTextLogs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o CommsTextLogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsTextLogSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple commsTextLogs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o CommsTextLogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsTextLogSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CommsTextLog has methods that act as mods for the CommsTextLogTemplate
var CommsTextLogMods commsTextLogMods
type commsTextLogMods struct{}
func (m commsTextLogMods) RandomizeAllColumns(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModSlice{
CommsTextLogMods.RandomContent(f),
CommsTextLogMods.RandomCreated(f),
CommsTextLogMods.RandomDestination(f),
CommsTextLogMods.RandomID(f),
CommsTextLogMods.RandomIsWelcome(f),
CommsTextLogMods.RandomOrigin(f),
CommsTextLogMods.RandomSource(f),
CommsTextLogMods.RandomTwilioSid(f),
CommsTextLogMods.RandomTwilioStatus(f),
CommsTextLogMods.RandomIsVisibleToLLM(f),
}
}
// Set the model columns to this value
func (m commsTextLogMods) Content(val string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Content = func() string { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) ContentFunc(f func() string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Content = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetContent() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Content = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomContent(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Content = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) Created(val time.Time) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Created = func() time.Time { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) CreatedFunc(f func() time.Time) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetCreated() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomCreated(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Created = func() time.Time {
return random_time_Time(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) Destination(val string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Destination = func() string { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) DestinationFunc(f func() string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Destination = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetDestination() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Destination = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomDestination(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Destination = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) ID(val int32) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.ID = func() int32 { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) IDFunc(f func() int32) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.ID = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetID() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.ID = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomID(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.ID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) IsWelcome(val bool) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsWelcome = func() bool { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) IsWelcomeFunc(f func() bool) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsWelcome = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetIsWelcome() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsWelcome = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomIsWelcome(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsWelcome = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) Origin(val enums.CommsTextorigin) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Origin = func() enums.CommsTextorigin { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) OriginFunc(f func() enums.CommsTextorigin) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Origin = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetOrigin() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Origin = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomOrigin(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Origin = func() enums.CommsTextorigin {
return random_enums_CommsTextorigin(f)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) Source(val string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Source = func() string { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) SourceFunc(f func() string) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Source = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetSource() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Source = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomSource(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.Source = func() string {
return random_string(f)
}
})
}
// 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)
}
})
}
// Set the model columns to this value
func (m commsTextLogMods) IsVisibleToLLM(val bool) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsVisibleToLLM = func() bool { return val }
})
}
// Set the Column from the function
func (m commsTextLogMods) IsVisibleToLLMFunc(f func() bool) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsVisibleToLLM = f
})
}
// Clear any values for the column
func (m commsTextLogMods) UnsetIsVisibleToLLM() CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsVisibleToLLM = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m commsTextLogMods) RandomIsVisibleToLLM(f *faker.Faker) CommsTextLogMod {
return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) {
o.IsVisibleToLLM = func() bool {
return random_bool(f)
}
})
}
func (m commsTextLogMods) WithParentsCascading() CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
if isDone, _ := commsTextLogWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = commsTextLogWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading())
m.WithDestinationPhone(related).Apply(ctx, o)
}
{
related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading())
m.WithSourcePhone(related).Apply(ctx, o)
}
})
}
func (m commsTextLogMods) WithDestinationPhone(rel *CommsPhoneTemplate) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.DestinationPhone = &commsTextLogRDestinationPhoneR{
o: rel,
}
})
}
func (m commsTextLogMods) WithNewDestinationPhone(mods ...CommsPhoneMod) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
related := o.f.NewCommsPhoneWithContext(ctx, mods...)
m.WithDestinationPhone(related).Apply(ctx, o)
})
}
func (m commsTextLogMods) WithExistingDestinationPhone(em *models.CommsPhone) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.DestinationPhone = &commsTextLogRDestinationPhoneR{
o: o.f.FromExistingCommsPhone(em),
}
})
}
func (m commsTextLogMods) WithoutDestinationPhone() CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.DestinationPhone = nil
})
}
func (m commsTextLogMods) WithSourcePhone(rel *CommsPhoneTemplate) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.SourcePhone = &commsTextLogRSourcePhoneR{
o: rel,
}
})
}
func (m commsTextLogMods) WithNewSourcePhone(mods ...CommsPhoneMod) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
related := o.f.NewCommsPhoneWithContext(ctx, mods...)
m.WithSourcePhone(related).Apply(ctx, o)
})
}
func (m commsTextLogMods) WithExistingSourcePhone(em *models.CommsPhone) CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.SourcePhone = &commsTextLogRSourcePhoneR{
o: o.f.FromExistingCommsPhone(em),
}
})
}
func (m commsTextLogMods) WithoutSourcePhone() CommsTextLogMod {
return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) {
o.r.SourcePhone = nil
})
}