This requires a bunch of changes since the types on these tables are much closer to the underlying types of the Fieldseeker data we are getting back from the API. I now need to use proper UUID types everywhere, which means I had to modify the bob gen config to consistently use google UUID, my UUID library of choice. I also had to add the organization_id to all the fieldseeker tables since we rely on them existing for some of our compound queries. There were some changes to the API type signatures to get things to build. I may yet regret those.
101 lines
2 KiB
Go
101 lines
2 KiB
Go
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package sql
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
|
|
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
|
"github.com/google/uuid"
|
|
"github.com/jaswdr/faker/v2"
|
|
"github.com/stephenafamo/bob"
|
|
pg_query "github.com/wasilibs/go-pgquery"
|
|
)
|
|
|
|
// Set the testDB to enable tests that use the database
|
|
var testDB bob.Transactor[bob.Tx]
|
|
|
|
func formatQuery(s string) (string, error) {
|
|
aTree, err := pg_query.Parse(s)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return pg_query.Deparse(aTree)
|
|
}
|
|
|
|
var defaultFaker = faker.New()
|
|
|
|
func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcgislicensetype {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
var e enums.Arcgislicensetype
|
|
all := e.All()
|
|
return all[f.IntBetween(0, len(all)-1)]
|
|
}
|
|
|
|
func random_enums_Hashtype(f *faker.Faker, limits ...string) enums.Hashtype {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
var e enums.Hashtype
|
|
all := e.All()
|
|
return all[f.IntBetween(0, len(all)-1)]
|
|
}
|
|
|
|
func random_int32(f *faker.Faker, limits ...string) int32 {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
return f.Int32()
|
|
}
|
|
|
|
func random_int64(f *faker.Faker, limits ...string) int64 {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
return f.Int64()
|
|
}
|
|
|
|
func random_string(f *faker.Faker, limits ...string) string {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := strings.Join(f.Lorem().Words(f.IntBetween(1, 5)), " ")
|
|
if len(limits) == 0 {
|
|
return val
|
|
}
|
|
limitInt, _ := strconv.Atoi(limits[0])
|
|
if limitInt > 0 && limitInt < len(val) {
|
|
val = val[:limitInt]
|
|
}
|
|
return val
|
|
}
|
|
|
|
func random_time_Time(f *faker.Faker, limits ...string) time.Time {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
year := time.Hour * 24 * 365
|
|
min := time.Now().Add(-year)
|
|
max := time.Now().Add(year)
|
|
return f.Time().TimeBetween(min, max)
|
|
}
|
|
|
|
func random_uuid_UUID(f *faker.Faker, limits ...string) uuid.UUID {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
return uuid.New()
|
|
}
|