Update storage and display of nuisance report

This commit is contained in:
Eli Ribble 2026-02-05 16:56:36 +00:00
parent ee7d99bc4c
commit 5fc0f9fa3d
No known key found for this signature in database
11 changed files with 1877 additions and 607 deletions

View file

@ -51,15 +51,6 @@ var PublicreportNuisances = Table[
Generated: false,
AutoIncr: false,
},
SourceLocation: column{
Name: "source_location",
DBType: "publicreport.nuisancelocationtype",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
SourceContainer: column{
Name: "source_container",
DBType: "boolean",
@ -177,6 +168,159 @@ var PublicreportNuisances = Table[
Generated: false,
AutoIncr: false,
},
AddressCountry: column{
Name: "address_country",
DBType: "text",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
AddressPlace: column{
Name: "address_place",
DBType: "text",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
AddressPostcode: column{
Name: "address_postcode",
DBType: "text",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
AddressRegion: column{
Name: "address_region",
DBType: "text",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
AddressStreet: column{
Name: "address_street",
DBType: "text",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
IsLocationBackyard: column{
Name: "is_location_backyard",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
IsLocationFrontyard: column{
Name: "is_location_frontyard",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
IsLocationGarden: column{
Name: "is_location_garden",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
IsLocationOther: column{
Name: "is_location_other",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
IsLocationPool: column{
Name: "is_location_pool",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
MapZoom: column{
Name: "map_zoom",
DBType: "real",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
TodEarly: column{
Name: "tod_early",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
TodDay: column{
Name: "tod_day",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
TodEvening: column{
Name: "tod_evening",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
TodNight: column{
Name: "tod_night",
DBType: "boolean",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
LatlngAccuracyType: column{
Name: "latlng_accuracy_type",
DBType: "publicreport.accuracytype",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
LatlngAccuracyValue: column{
Name: "latlng_accuracy_value",
DBType: "real",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
},
Indexes: publicreportNuisanceIndexes{
NuisancePkey: index{
@ -242,29 +386,45 @@ var PublicreportNuisances = Table[
}
type publicreportNuisanceColumns struct {
ID column
AdditionalInfo column
Created column
Duration column
SourceLocation column
SourceContainer column
SourceDescription column
SourceStagnant column
PublicID column
ReporterEmail column
ReporterName column
ReporterPhone column
Address column
Location column
Status column
OrganizationID column
SourceGutter column
H3cell column
ID column
AdditionalInfo column
Created column
Duration column
SourceContainer column
SourceDescription column
SourceStagnant column
PublicID column
ReporterEmail column
ReporterName column
ReporterPhone column
Address column
Location column
Status column
OrganizationID column
SourceGutter column
H3cell column
AddressCountry column
AddressPlace column
AddressPostcode column
AddressRegion column
AddressStreet column
IsLocationBackyard column
IsLocationFrontyard column
IsLocationGarden column
IsLocationOther column
IsLocationPool column
MapZoom column
TodEarly column
TodDay column
TodEvening column
TodNight column
LatlngAccuracyType column
LatlngAccuracyValue column
}
func (c publicreportNuisanceColumns) AsSlice() []column {
return []column{
c.ID, c.AdditionalInfo, c.Created, c.Duration, c.SourceLocation, c.SourceContainer, c.SourceDescription, c.SourceStagnant, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Location, c.Status, c.OrganizationID, c.SourceGutter, c.H3cell,
c.ID, c.AdditionalInfo, c.Created, c.Duration, c.SourceContainer, c.SourceDescription, c.SourceStagnant, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Address, c.Location, c.Status, c.OrganizationID, c.SourceGutter, c.H3cell, c.AddressCountry, c.AddressPlace, c.AddressPostcode, c.AddressRegion, c.AddressStreet, c.IsLocationBackyard, c.IsLocationFrontyard, c.IsLocationGarden, c.IsLocationOther, c.IsLocationPool, c.MapZoom, c.TodEarly, c.TodDay, c.TodEvening, c.TodNight, c.LatlngAccuracyType, c.LatlngAccuracyValue,
}
}

View file

@ -867,6 +867,97 @@ func (e *Notificationtype) Scan(value any) error {
return nil
}
// Enum values for PublicreportAccuracytype
const (
PublicreportAccuracytypeRooftop PublicreportAccuracytype = "rooftop"
PublicreportAccuracytypeParcel PublicreportAccuracytype = "parcel"
PublicreportAccuracytypePoint PublicreportAccuracytype = "point"
PublicreportAccuracytypeInterpolated PublicreportAccuracytype = "interpolated"
PublicreportAccuracytypeApproximate PublicreportAccuracytype = "approximate"
PublicreportAccuracytypeIntersection PublicreportAccuracytype = "intersection"
PublicreportAccuracytypeBrowser PublicreportAccuracytype = "browser"
PublicreportAccuracytypeNone PublicreportAccuracytype = "none"
)
func AllPublicreportAccuracytype() []PublicreportAccuracytype {
return []PublicreportAccuracytype{
PublicreportAccuracytypeRooftop,
PublicreportAccuracytypeParcel,
PublicreportAccuracytypePoint,
PublicreportAccuracytypeInterpolated,
PublicreportAccuracytypeApproximate,
PublicreportAccuracytypeIntersection,
PublicreportAccuracytypeBrowser,
PublicreportAccuracytypeNone,
}
}
type PublicreportAccuracytype string
func (e PublicreportAccuracytype) String() string {
return string(e)
}
func (e PublicreportAccuracytype) Valid() bool {
switch e {
case PublicreportAccuracytypeRooftop,
PublicreportAccuracytypeParcel,
PublicreportAccuracytypePoint,
PublicreportAccuracytypeInterpolated,
PublicreportAccuracytypeApproximate,
PublicreportAccuracytypeIntersection,
PublicreportAccuracytypeBrowser,
PublicreportAccuracytypeNone:
return true
default:
return false
}
}
// useful when testing in other packages
func (e PublicreportAccuracytype) All() []PublicreportAccuracytype {
return AllPublicreportAccuracytype()
}
func (e PublicreportAccuracytype) MarshalText() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportAccuracytype) UnmarshalText(text []byte) error {
return e.Scan(text)
}
func (e PublicreportAccuracytype) MarshalBinary() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportAccuracytype) UnmarshalBinary(data []byte) error {
return e.Scan(data)
}
func (e PublicreportAccuracytype) Value() (driver.Value, error) {
return string(e), nil
}
func (e *PublicreportAccuracytype) Scan(value any) error {
switch x := value.(type) {
case string:
*e = PublicreportAccuracytype(x)
case []byte:
*e = PublicreportAccuracytype(x)
case nil:
return fmt.Errorf("cannot nil into PublicreportAccuracytype")
default:
return fmt.Errorf("cannot scan type %T: %v", value, value)
}
if !e.Valid() {
return fmt.Errorf("invalid PublicreportAccuracytype value: %s", *e)
}
return nil
}
// Enum values for PublicreportNuisancedurationtype
const (
PublicreportNuisancedurationtypeNone PublicreportNuisancedurationtype = "none"
@ -955,331 +1046,6 @@ func (e *PublicreportNuisancedurationtype) Scan(value any) error {
return nil
}
// Enum values for PublicreportNuisanceinspectiontype
const (
PublicreportNuisanceinspectiontypeNeighborhood PublicreportNuisanceinspectiontype = "neighborhood"
PublicreportNuisanceinspectiontypeProperty PublicreportNuisanceinspectiontype = "property"
)
func AllPublicreportNuisanceinspectiontype() []PublicreportNuisanceinspectiontype {
return []PublicreportNuisanceinspectiontype{
PublicreportNuisanceinspectiontypeNeighborhood,
PublicreportNuisanceinspectiontypeProperty,
}
}
type PublicreportNuisanceinspectiontype string
func (e PublicreportNuisanceinspectiontype) String() string {
return string(e)
}
func (e PublicreportNuisanceinspectiontype) Valid() bool {
switch e {
case PublicreportNuisanceinspectiontypeNeighborhood,
PublicreportNuisanceinspectiontypeProperty:
return true
default:
return false
}
}
// useful when testing in other packages
func (e PublicreportNuisanceinspectiontype) All() []PublicreportNuisanceinspectiontype {
return AllPublicreportNuisanceinspectiontype()
}
func (e PublicreportNuisanceinspectiontype) MarshalText() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisanceinspectiontype) UnmarshalText(text []byte) error {
return e.Scan(text)
}
func (e PublicreportNuisanceinspectiontype) MarshalBinary() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisanceinspectiontype) UnmarshalBinary(data []byte) error {
return e.Scan(data)
}
func (e PublicreportNuisanceinspectiontype) Value() (driver.Value, error) {
return string(e), nil
}
func (e *PublicreportNuisanceinspectiontype) Scan(value any) error {
switch x := value.(type) {
case string:
*e = PublicreportNuisanceinspectiontype(x)
case []byte:
*e = PublicreportNuisanceinspectiontype(x)
case nil:
return fmt.Errorf("cannot nil into PublicreportNuisanceinspectiontype")
default:
return fmt.Errorf("cannot scan type %T: %v", value, value)
}
if !e.Valid() {
return fmt.Errorf("invalid PublicreportNuisanceinspectiontype value: %s", *e)
}
return nil
}
// Enum values for PublicreportNuisancelocationtype
const (
PublicreportNuisancelocationtypeNone PublicreportNuisancelocationtype = "none"
PublicreportNuisancelocationtypeFrontYard PublicreportNuisancelocationtype = "front-yard"
PublicreportNuisancelocationtypeBackyard PublicreportNuisancelocationtype = "backyard"
PublicreportNuisancelocationtypePatio PublicreportNuisancelocationtype = "patio"
PublicreportNuisancelocationtypeGarden PublicreportNuisancelocationtype = "garden"
PublicreportNuisancelocationtypePoolArea PublicreportNuisancelocationtype = "pool-area"
PublicreportNuisancelocationtypeThroughout PublicreportNuisancelocationtype = "throughout"
PublicreportNuisancelocationtypeIndoors PublicreportNuisancelocationtype = "indoors"
PublicreportNuisancelocationtypeOther PublicreportNuisancelocationtype = "other"
)
func AllPublicreportNuisancelocationtype() []PublicreportNuisancelocationtype {
return []PublicreportNuisancelocationtype{
PublicreportNuisancelocationtypeNone,
PublicreportNuisancelocationtypeFrontYard,
PublicreportNuisancelocationtypeBackyard,
PublicreportNuisancelocationtypePatio,
PublicreportNuisancelocationtypeGarden,
PublicreportNuisancelocationtypePoolArea,
PublicreportNuisancelocationtypeThroughout,
PublicreportNuisancelocationtypeIndoors,
PublicreportNuisancelocationtypeOther,
}
}
type PublicreportNuisancelocationtype string
func (e PublicreportNuisancelocationtype) String() string {
return string(e)
}
func (e PublicreportNuisancelocationtype) Valid() bool {
switch e {
case PublicreportNuisancelocationtypeNone,
PublicreportNuisancelocationtypeFrontYard,
PublicreportNuisancelocationtypeBackyard,
PublicreportNuisancelocationtypePatio,
PublicreportNuisancelocationtypeGarden,
PublicreportNuisancelocationtypePoolArea,
PublicreportNuisancelocationtypeThroughout,
PublicreportNuisancelocationtypeIndoors,
PublicreportNuisancelocationtypeOther:
return true
default:
return false
}
}
// useful when testing in other packages
func (e PublicreportNuisancelocationtype) All() []PublicreportNuisancelocationtype {
return AllPublicreportNuisancelocationtype()
}
func (e PublicreportNuisancelocationtype) MarshalText() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancelocationtype) UnmarshalText(text []byte) error {
return e.Scan(text)
}
func (e PublicreportNuisancelocationtype) MarshalBinary() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancelocationtype) UnmarshalBinary(data []byte) error {
return e.Scan(data)
}
func (e PublicreportNuisancelocationtype) Value() (driver.Value, error) {
return string(e), nil
}
func (e *PublicreportNuisancelocationtype) Scan(value any) error {
switch x := value.(type) {
case string:
*e = PublicreportNuisancelocationtype(x)
case []byte:
*e = PublicreportNuisancelocationtype(x)
case nil:
return fmt.Errorf("cannot nil into PublicreportNuisancelocationtype")
default:
return fmt.Errorf("cannot scan type %T: %v", value, value)
}
if !e.Valid() {
return fmt.Errorf("invalid PublicreportNuisancelocationtype value: %s", *e)
}
return nil
}
// Enum values for PublicreportNuisancepreferreddaterangetype
const (
PublicreportNuisancepreferreddaterangetypeNone PublicreportNuisancepreferreddaterangetype = "none"
PublicreportNuisancepreferreddaterangetypeAnyTime PublicreportNuisancepreferreddaterangetype = "any-time"
PublicreportNuisancepreferreddaterangetypeInTwoWeeks PublicreportNuisancepreferreddaterangetype = "in-two-weeks"
PublicreportNuisancepreferreddaterangetypeNextWeek PublicreportNuisancepreferreddaterangetype = "next-week"
)
func AllPublicreportNuisancepreferreddaterangetype() []PublicreportNuisancepreferreddaterangetype {
return []PublicreportNuisancepreferreddaterangetype{
PublicreportNuisancepreferreddaterangetypeNone,
PublicreportNuisancepreferreddaterangetypeAnyTime,
PublicreportNuisancepreferreddaterangetypeInTwoWeeks,
PublicreportNuisancepreferreddaterangetypeNextWeek,
}
}
type PublicreportNuisancepreferreddaterangetype string
func (e PublicreportNuisancepreferreddaterangetype) String() string {
return string(e)
}
func (e PublicreportNuisancepreferreddaterangetype) Valid() bool {
switch e {
case PublicreportNuisancepreferreddaterangetypeNone,
PublicreportNuisancepreferreddaterangetypeAnyTime,
PublicreportNuisancepreferreddaterangetypeInTwoWeeks,
PublicreportNuisancepreferreddaterangetypeNextWeek:
return true
default:
return false
}
}
// useful when testing in other packages
func (e PublicreportNuisancepreferreddaterangetype) All() []PublicreportNuisancepreferreddaterangetype {
return AllPublicreportNuisancepreferreddaterangetype()
}
func (e PublicreportNuisancepreferreddaterangetype) MarshalText() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancepreferreddaterangetype) UnmarshalText(text []byte) error {
return e.Scan(text)
}
func (e PublicreportNuisancepreferreddaterangetype) MarshalBinary() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancepreferreddaterangetype) UnmarshalBinary(data []byte) error {
return e.Scan(data)
}
func (e PublicreportNuisancepreferreddaterangetype) Value() (driver.Value, error) {
return string(e), nil
}
func (e *PublicreportNuisancepreferreddaterangetype) Scan(value any) error {
switch x := value.(type) {
case string:
*e = PublicreportNuisancepreferreddaterangetype(x)
case []byte:
*e = PublicreportNuisancepreferreddaterangetype(x)
case nil:
return fmt.Errorf("cannot nil into PublicreportNuisancepreferreddaterangetype")
default:
return fmt.Errorf("cannot scan type %T: %v", value, value)
}
if !e.Valid() {
return fmt.Errorf("invalid PublicreportNuisancepreferreddaterangetype value: %s", *e)
}
return nil
}
// Enum values for PublicreportNuisancepreferredtimetype
const (
PublicreportNuisancepreferredtimetypeNone PublicreportNuisancepreferredtimetype = "none"
PublicreportNuisancepreferredtimetypeAfternoon PublicreportNuisancepreferredtimetype = "afternoon"
PublicreportNuisancepreferredtimetypeAnyTime PublicreportNuisancepreferredtimetype = "any-time"
PublicreportNuisancepreferredtimetypeMorning PublicreportNuisancepreferredtimetype = "morning"
)
func AllPublicreportNuisancepreferredtimetype() []PublicreportNuisancepreferredtimetype {
return []PublicreportNuisancepreferredtimetype{
PublicreportNuisancepreferredtimetypeNone,
PublicreportNuisancepreferredtimetypeAfternoon,
PublicreportNuisancepreferredtimetypeAnyTime,
PublicreportNuisancepreferredtimetypeMorning,
}
}
type PublicreportNuisancepreferredtimetype string
func (e PublicreportNuisancepreferredtimetype) String() string {
return string(e)
}
func (e PublicreportNuisancepreferredtimetype) Valid() bool {
switch e {
case PublicreportNuisancepreferredtimetypeNone,
PublicreportNuisancepreferredtimetypeAfternoon,
PublicreportNuisancepreferredtimetypeAnyTime,
PublicreportNuisancepreferredtimetypeMorning:
return true
default:
return false
}
}
// useful when testing in other packages
func (e PublicreportNuisancepreferredtimetype) All() []PublicreportNuisancepreferredtimetype {
return AllPublicreportNuisancepreferredtimetype()
}
func (e PublicreportNuisancepreferredtimetype) MarshalText() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancepreferredtimetype) UnmarshalText(text []byte) error {
return e.Scan(text)
}
func (e PublicreportNuisancepreferredtimetype) MarshalBinary() ([]byte, error) {
return []byte(e), nil
}
func (e *PublicreportNuisancepreferredtimetype) UnmarshalBinary(data []byte) error {
return e.Scan(data)
}
func (e PublicreportNuisancepreferredtimetype) Value() (driver.Value, error) {
return string(e), nil
}
func (e *PublicreportNuisancepreferredtimetype) Scan(value any) error {
switch x := value.(type) {
case string:
*e = PublicreportNuisancepreferredtimetype(x)
case []byte:
*e = PublicreportNuisancepreferredtimetype(x)
case nil:
return fmt.Errorf("cannot nil into PublicreportNuisancepreferredtimetype")
default:
return fmt.Errorf("cannot scan type %T: %v", value, value)
}
if !e.Valid() {
return fmt.Errorf("invalid PublicreportNuisancepreferredtimetype value: %s", *e)
}
return nil
}
// Enum values for PublicreportPoolsourceduration
const (
PublicreportPoolsourcedurationNone PublicreportPoolsourceduration = "none"

View file

@ -2936,7 +2936,6 @@ func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisanc
o.AdditionalInfo = func() string { return m.AdditionalInfo }
o.Created = func() time.Time { return m.Created }
o.Duration = func() enums.PublicreportNuisancedurationtype { return m.Duration }
o.SourceLocation = func() enums.PublicreportNuisancelocationtype { return m.SourceLocation }
o.SourceContainer = func() bool { return m.SourceContainer }
o.SourceDescription = func() string { return m.SourceDescription }
o.SourceStagnant = func() bool { return m.SourceStagnant }
@ -2950,6 +2949,23 @@ func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisanc
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.SourceGutter = func() bool { return m.SourceGutter }
o.H3cell = func() null.Val[string] { return m.H3cell }
o.AddressCountry = func() string { return m.AddressCountry }
o.AddressPlace = func() string { return m.AddressPlace }
o.AddressPostcode = func() string { return m.AddressPostcode }
o.AddressRegion = func() string { return m.AddressRegion }
o.AddressStreet = func() string { return m.AddressStreet }
o.IsLocationBackyard = func() bool { return m.IsLocationBackyard }
o.IsLocationFrontyard = func() bool { return m.IsLocationFrontyard }
o.IsLocationGarden = func() bool { return m.IsLocationGarden }
o.IsLocationOther = func() bool { return m.IsLocationOther }
o.IsLocationPool = func() bool { return m.IsLocationPool }
o.MapZoom = func() float32 { return m.MapZoom }
o.TodEarly = func() bool { return m.TodEarly }
o.TodDay = func() bool { return m.TodDay }
o.TodEvening = func() bool { return m.TodEvening }
o.TodNight = func() bool { return m.TodNight }
o.LatlngAccuracyType = func() enums.PublicreportAccuracytype { return m.LatlngAccuracyType }
o.LatlngAccuracyValue = func() float32 { return m.LatlngAccuracyValue }
ctx := context.Background()
if m.R.Organization != nil {

View file

@ -171,6 +171,16 @@ func random_enums_Notificationtype(f *faker.Faker, limits ...string) enums.Notif
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_PublicreportAccuracytype(f *faker.Faker, limits ...string) enums.PublicreportAccuracytype {
if f == nil {
f = &defaultFaker
}
var e enums.PublicreportAccuracytype
all := e.All()
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_PublicreportNuisancedurationtype(f *faker.Faker, limits ...string) enums.PublicreportNuisancedurationtype {
if f == nil {
f = &defaultFaker
@ -181,16 +191,6 @@ func random_enums_PublicreportNuisancedurationtype(f *faker.Faker, limits ...str
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_PublicreportNuisancelocationtype(f *faker.Faker, limits ...string) enums.PublicreportNuisancelocationtype {
if f == nil {
f = &defaultFaker
}
var e enums.PublicreportNuisancelocationtype
all := e.All()
return all[f.IntBetween(0, len(all)-1)]
}
func random_enums_PublicreportReportstatustype(f *faker.Faker, limits ...string) enums.PublicreportReportstatustype {
if f == nil {
f = &defaultFaker

View file

@ -38,24 +38,40 @@ func (mods PublicreportNuisanceModSlice) Apply(ctx context.Context, n *Publicrep
// PublicreportNuisanceTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type PublicreportNuisanceTemplate struct {
ID func() int32
AdditionalInfo func() string
Created func() time.Time
Duration func() enums.PublicreportNuisancedurationtype
SourceLocation func() enums.PublicreportNuisancelocationtype
SourceContainer func() bool
SourceDescription func() string
SourceStagnant func() bool
PublicID func() string
ReporterEmail func() null.Val[string]
ReporterName func() null.Val[string]
ReporterPhone func() null.Val[string]
Address func() string
Location func() null.Val[string]
Status func() enums.PublicreportReportstatustype
OrganizationID func() null.Val[int32]
SourceGutter func() bool
H3cell func() null.Val[string]
ID func() int32
AdditionalInfo func() string
Created func() time.Time
Duration func() enums.PublicreportNuisancedurationtype
SourceContainer func() bool
SourceDescription func() string
SourceStagnant func() bool
PublicID func() string
ReporterEmail func() null.Val[string]
ReporterName func() null.Val[string]
ReporterPhone func() null.Val[string]
Address func() string
Location func() null.Val[string]
Status func() enums.PublicreportReportstatustype
OrganizationID func() null.Val[int32]
SourceGutter func() bool
H3cell func() null.Val[string]
AddressCountry func() string
AddressPlace func() string
AddressPostcode func() string
AddressRegion func() string
AddressStreet func() string
IsLocationBackyard func() bool
IsLocationFrontyard func() bool
IsLocationGarden func() bool
IsLocationOther func() bool
IsLocationPool func() bool
MapZoom func() float32
TodEarly func() bool
TodDay func() bool
TodEvening func() bool
TodNight func() bool
LatlngAccuracyType func() enums.PublicreportAccuracytype
LatlngAccuracyValue func() float32
r publicreportNuisanceR
f *Factory
@ -127,10 +143,6 @@ func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisance
val := o.Duration()
m.Duration = omit.From(val)
}
if o.SourceLocation != nil {
val := o.SourceLocation()
m.SourceLocation = omit.From(val)
}
if o.SourceContainer != nil {
val := o.SourceContainer()
m.SourceContainer = omit.From(val)
@ -183,6 +195,74 @@ func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisance
val := o.H3cell()
m.H3cell = omitnull.FromNull(val)
}
if o.AddressCountry != nil {
val := o.AddressCountry()
m.AddressCountry = omit.From(val)
}
if o.AddressPlace != nil {
val := o.AddressPlace()
m.AddressPlace = omit.From(val)
}
if o.AddressPostcode != nil {
val := o.AddressPostcode()
m.AddressPostcode = omit.From(val)
}
if o.AddressRegion != nil {
val := o.AddressRegion()
m.AddressRegion = omit.From(val)
}
if o.AddressStreet != nil {
val := o.AddressStreet()
m.AddressStreet = omit.From(val)
}
if o.IsLocationBackyard != nil {
val := o.IsLocationBackyard()
m.IsLocationBackyard = omit.From(val)
}
if o.IsLocationFrontyard != nil {
val := o.IsLocationFrontyard()
m.IsLocationFrontyard = omit.From(val)
}
if o.IsLocationGarden != nil {
val := o.IsLocationGarden()
m.IsLocationGarden = omit.From(val)
}
if o.IsLocationOther != nil {
val := o.IsLocationOther()
m.IsLocationOther = omit.From(val)
}
if o.IsLocationPool != nil {
val := o.IsLocationPool()
m.IsLocationPool = omit.From(val)
}
if o.MapZoom != nil {
val := o.MapZoom()
m.MapZoom = omit.From(val)
}
if o.TodEarly != nil {
val := o.TodEarly()
m.TodEarly = omit.From(val)
}
if o.TodDay != nil {
val := o.TodDay()
m.TodDay = omit.From(val)
}
if o.TodEvening != nil {
val := o.TodEvening()
m.TodEvening = omit.From(val)
}
if o.TodNight != nil {
val := o.TodNight()
m.TodNight = omit.From(val)
}
if o.LatlngAccuracyType != nil {
val := o.LatlngAccuracyType()
m.LatlngAccuracyType = omit.From(val)
}
if o.LatlngAccuracyValue != nil {
val := o.LatlngAccuracyValue()
m.LatlngAccuracyValue = omit.From(val)
}
return m
}
@ -217,9 +297,6 @@ func (o PublicreportNuisanceTemplate) Build() *models.PublicreportNuisance {
if o.Duration != nil {
m.Duration = o.Duration()
}
if o.SourceLocation != nil {
m.SourceLocation = o.SourceLocation()
}
if o.SourceContainer != nil {
m.SourceContainer = o.SourceContainer()
}
@ -259,6 +336,57 @@ func (o PublicreportNuisanceTemplate) Build() *models.PublicreportNuisance {
if o.H3cell != nil {
m.H3cell = o.H3cell()
}
if o.AddressCountry != nil {
m.AddressCountry = o.AddressCountry()
}
if o.AddressPlace != nil {
m.AddressPlace = o.AddressPlace()
}
if o.AddressPostcode != nil {
m.AddressPostcode = o.AddressPostcode()
}
if o.AddressRegion != nil {
m.AddressRegion = o.AddressRegion()
}
if o.AddressStreet != nil {
m.AddressStreet = o.AddressStreet()
}
if o.IsLocationBackyard != nil {
m.IsLocationBackyard = o.IsLocationBackyard()
}
if o.IsLocationFrontyard != nil {
m.IsLocationFrontyard = o.IsLocationFrontyard()
}
if o.IsLocationGarden != nil {
m.IsLocationGarden = o.IsLocationGarden()
}
if o.IsLocationOther != nil {
m.IsLocationOther = o.IsLocationOther()
}
if o.IsLocationPool != nil {
m.IsLocationPool = o.IsLocationPool()
}
if o.MapZoom != nil {
m.MapZoom = o.MapZoom()
}
if o.TodEarly != nil {
m.TodEarly = o.TodEarly()
}
if o.TodDay != nil {
m.TodDay = o.TodDay()
}
if o.TodEvening != nil {
m.TodEvening = o.TodEvening()
}
if o.TodNight != nil {
m.TodNight = o.TodNight()
}
if o.LatlngAccuracyType != nil {
m.LatlngAccuracyType = o.LatlngAccuracyType()
}
if o.LatlngAccuracyValue != nil {
m.LatlngAccuracyValue = o.LatlngAccuracyValue()
}
o.setModelRels(m)
@ -291,10 +419,6 @@ func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) {
val := random_enums_PublicreportNuisancedurationtype(nil)
m.Duration = omit.From(val)
}
if !(m.SourceLocation.IsValue()) {
val := random_enums_PublicreportNuisancelocationtype(nil)
m.SourceLocation = omit.From(val)
}
if !(m.SourceContainer.IsValue()) {
val := random_bool(nil)
m.SourceContainer = omit.From(val)
@ -323,6 +447,74 @@ func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) {
val := random_bool(nil)
m.SourceGutter = omit.From(val)
}
if !(m.AddressCountry.IsValue()) {
val := random_string(nil)
m.AddressCountry = omit.From(val)
}
if !(m.AddressPlace.IsValue()) {
val := random_string(nil)
m.AddressPlace = omit.From(val)
}
if !(m.AddressPostcode.IsValue()) {
val := random_string(nil)
m.AddressPostcode = omit.From(val)
}
if !(m.AddressRegion.IsValue()) {
val := random_string(nil)
m.AddressRegion = omit.From(val)
}
if !(m.AddressStreet.IsValue()) {
val := random_string(nil)
m.AddressStreet = omit.From(val)
}
if !(m.IsLocationBackyard.IsValue()) {
val := random_bool(nil)
m.IsLocationBackyard = omit.From(val)
}
if !(m.IsLocationFrontyard.IsValue()) {
val := random_bool(nil)
m.IsLocationFrontyard = omit.From(val)
}
if !(m.IsLocationGarden.IsValue()) {
val := random_bool(nil)
m.IsLocationGarden = omit.From(val)
}
if !(m.IsLocationOther.IsValue()) {
val := random_bool(nil)
m.IsLocationOther = omit.From(val)
}
if !(m.IsLocationPool.IsValue()) {
val := random_bool(nil)
m.IsLocationPool = omit.From(val)
}
if !(m.MapZoom.IsValue()) {
val := random_float32(nil)
m.MapZoom = omit.From(val)
}
if !(m.TodEarly.IsValue()) {
val := random_bool(nil)
m.TodEarly = omit.From(val)
}
if !(m.TodDay.IsValue()) {
val := random_bool(nil)
m.TodDay = omit.From(val)
}
if !(m.TodEvening.IsValue()) {
val := random_bool(nil)
m.TodEvening = omit.From(val)
}
if !(m.TodNight.IsValue()) {
val := random_bool(nil)
m.TodNight = omit.From(val)
}
if !(m.LatlngAccuracyType.IsValue()) {
val := random_enums_PublicreportAccuracytype(nil)
m.LatlngAccuracyType = omit.From(val)
}
if !(m.LatlngAccuracyValue.IsValue()) {
val := random_float32(nil)
m.LatlngAccuracyValue = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNuisance
@ -466,7 +658,6 @@ func (m publicreportNuisanceMods) RandomizeAllColumns(f *faker.Faker) Publicrepo
PublicreportNuisanceMods.RandomAdditionalInfo(f),
PublicreportNuisanceMods.RandomCreated(f),
PublicreportNuisanceMods.RandomDuration(f),
PublicreportNuisanceMods.RandomSourceLocation(f),
PublicreportNuisanceMods.RandomSourceContainer(f),
PublicreportNuisanceMods.RandomSourceDescription(f),
PublicreportNuisanceMods.RandomSourceStagnant(f),
@ -480,6 +671,23 @@ func (m publicreportNuisanceMods) RandomizeAllColumns(f *faker.Faker) Publicrepo
PublicreportNuisanceMods.RandomOrganizationID(f),
PublicreportNuisanceMods.RandomSourceGutter(f),
PublicreportNuisanceMods.RandomH3cell(f),
PublicreportNuisanceMods.RandomAddressCountry(f),
PublicreportNuisanceMods.RandomAddressPlace(f),
PublicreportNuisanceMods.RandomAddressPostcode(f),
PublicreportNuisanceMods.RandomAddressRegion(f),
PublicreportNuisanceMods.RandomAddressStreet(f),
PublicreportNuisanceMods.RandomIsLocationBackyard(f),
PublicreportNuisanceMods.RandomIsLocationFrontyard(f),
PublicreportNuisanceMods.RandomIsLocationGarden(f),
PublicreportNuisanceMods.RandomIsLocationOther(f),
PublicreportNuisanceMods.RandomIsLocationPool(f),
PublicreportNuisanceMods.RandomMapZoom(f),
PublicreportNuisanceMods.RandomTodEarly(f),
PublicreportNuisanceMods.RandomTodDay(f),
PublicreportNuisanceMods.RandomTodEvening(f),
PublicreportNuisanceMods.RandomTodNight(f),
PublicreportNuisanceMods.RandomLatlngAccuracyType(f),
PublicreportNuisanceMods.RandomLatlngAccuracyValue(f),
}
}
@ -607,37 +815,6 @@ func (m publicreportNuisanceMods) RandomDuration(f *faker.Faker) PublicreportNui
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) SourceLocation(val enums.PublicreportNuisancelocationtype) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.SourceLocation = func() enums.PublicreportNuisancelocationtype { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) SourceLocationFunc(f func() enums.PublicreportNuisancelocationtype) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.SourceLocation = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetSourceLocation() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.SourceLocation = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomSourceLocation(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.SourceLocation = func() enums.PublicreportNuisancelocationtype {
return random_enums_PublicreportNuisancelocationtype(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) SourceContainer(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
@ -1173,6 +1350,533 @@ func (m publicreportNuisanceMods) RandomH3cellNotNull(f *faker.Faker) Publicrepo
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) AddressCountry(val string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressCountry = func() string { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) AddressCountryFunc(f func() string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressCountry = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetAddressCountry() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressCountry = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomAddressCountry(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressCountry = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) AddressPlace(val string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPlace = func() string { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) AddressPlaceFunc(f func() string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPlace = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetAddressPlace() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPlace = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomAddressPlace(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPlace = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) AddressPostcode(val string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPostcode = func() string { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) AddressPostcodeFunc(f func() string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPostcode = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetAddressPostcode() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPostcode = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomAddressPostcode(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressPostcode = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) AddressRegion(val string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressRegion = func() string { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) AddressRegionFunc(f func() string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressRegion = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetAddressRegion() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressRegion = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomAddressRegion(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressRegion = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) AddressStreet(val string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressStreet = func() string { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) AddressStreetFunc(f func() string) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressStreet = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetAddressStreet() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressStreet = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomAddressStreet(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.AddressStreet = func() string {
return random_string(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) IsLocationBackyard(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationBackyard = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) IsLocationBackyardFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationBackyard = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetIsLocationBackyard() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationBackyard = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomIsLocationBackyard(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationBackyard = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) IsLocationFrontyard(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationFrontyard = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) IsLocationFrontyardFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationFrontyard = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetIsLocationFrontyard() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationFrontyard = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomIsLocationFrontyard(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationFrontyard = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) IsLocationGarden(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationGarden = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) IsLocationGardenFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationGarden = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetIsLocationGarden() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationGarden = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomIsLocationGarden(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationGarden = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) IsLocationOther(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationOther = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) IsLocationOtherFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationOther = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetIsLocationOther() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationOther = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomIsLocationOther(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationOther = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) IsLocationPool(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationPool = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) IsLocationPoolFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationPool = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetIsLocationPool() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationPool = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomIsLocationPool(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.IsLocationPool = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) MapZoom(val float32) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.MapZoom = func() float32 { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) MapZoomFunc(f func() float32) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.MapZoom = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetMapZoom() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.MapZoom = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomMapZoom(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.MapZoom = func() float32 {
return random_float32(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) TodEarly(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEarly = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) TodEarlyFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEarly = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetTodEarly() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEarly = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomTodEarly(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEarly = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) TodDay(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodDay = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) TodDayFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodDay = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetTodDay() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodDay = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomTodDay(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodDay = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) TodEvening(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEvening = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) TodEveningFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEvening = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetTodEvening() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEvening = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomTodEvening(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodEvening = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) TodNight(val bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodNight = func() bool { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) TodNightFunc(f func() bool) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodNight = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetTodNight() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodNight = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomTodNight(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.TodNight = func() bool {
return random_bool(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) LatlngAccuracyType(val enums.PublicreportAccuracytype) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyType = func() enums.PublicreportAccuracytype { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) LatlngAccuracyTypeFunc(f func() enums.PublicreportAccuracytype) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyType = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetLatlngAccuracyType() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyType = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomLatlngAccuracyType(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyType = func() enums.PublicreportAccuracytype {
return random_enums_PublicreportAccuracytype(f)
}
})
}
// Set the model columns to this value
func (m publicreportNuisanceMods) LatlngAccuracyValue(val float32) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyValue = func() float32 { return val }
})
}
// Set the Column from the function
func (m publicreportNuisanceMods) LatlngAccuracyValueFunc(f func() float32) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyValue = f
})
}
// Clear any values for the column
func (m publicreportNuisanceMods) UnsetLatlngAccuracyValue() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyValue = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m publicreportNuisanceMods) RandomLatlngAccuracyValue(f *faker.Faker) PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) {
o.LatlngAccuracyValue = func() float32 {
return random_float32(f)
}
})
}
func (m publicreportNuisanceMods) WithParentsCascading() PublicreportNuisanceMod {
return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) {
if isDone, _ := publicreportNuisanceWithParentsCascadingCtx.Value(ctx); isDone {

View file

@ -0,0 +1,124 @@
-- +goose Up
CREATE TYPE publicreport.AccuracyType AS ENUM (
'rooftop', -- Result intersects a known building/entrance.
'parcel', -- Result is associated with one or more address within a specified polygonal boundary
'point', -- Result is a known address point but does not intersect a known rooftop/parcel.
'interpolated', -- Result position and existence are estimated based on nearby known addresses.
'approximate', -- Result position is approximated by a 9-digit zipcode centroid.
'intersection', -- For street type features only. The result is an intersection of 2 streets.
'browser', -- added to signify that we got location from the browser
'none' -- we have no accuarcy at all
);
COMMENT ON TYPE publicreport.AccuracyType IS 'most volues are determined by our geocoding API provider, mapbox. You can read more details at https://docs.mapbox.com/api/search/geocoding/#point-accuracy-for-address-features.';
ALTER TABLE publicreport.nuisance ADD COLUMN address_country TEXT;
ALTER TABLE publicreport.nuisance ADD COLUMN address_place TEXT;
ALTER TABLE publicreport.nuisance ADD COLUMN address_postcode TEXT;
ALTER TABLE publicreport.nuisance ADD COLUMN address_region TEXT;
ALTER TABLE publicreport.nuisance ADD COLUMN address_street TEXT;
ALTER TABLE publicreport.nuisance ADD COLUMN is_location_backyard BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN is_location_frontyard BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN is_location_garden BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN is_location_other BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN is_location_pool BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN map_zoom REAL;
ALTER TABLE publicreport.nuisance ADD COLUMN tod_early BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN tod_day BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN tod_evening BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN tod_night BOOLEAN;
ALTER TABLE publicreport.nuisance ADD COLUMN latlng_accuracy_type publicreport.AccuracyType;
ALTER TABLE publicreport.nuisance ADD COLUMN latlng_accuracy_value REAL;
UPDATE publicreport.nuisance SET address_country = '';
UPDATE publicreport.nuisance SET address_place = '';
UPDATE publicreport.nuisance SET address_postcode = '';
UPDATE publicreport.nuisance SET address_region = '';
UPDATE publicreport.nuisance SET address_street = '';
UPDATE publicreport.nuisance SET is_location_backyard = false;
UPDATE publicreport.nuisance SET is_location_frontyard = false;
UPDATE publicreport.nuisance SET is_location_garden = false;
UPDATE publicreport.nuisance SET is_location_other = false;
UPDATE publicreport.nuisance SET is_location_pool = false;
UPDATE publicreport.nuisance SET map_zoom = 0;
UPDATE publicreport.nuisance SET tod_early = false;
UPDATE publicreport.nuisance SET tod_day = false;
UPDATE publicreport.nuisance SET tod_evening = false;
UPDATE publicreport.nuisance SET tod_night = false;
UPDATE publicreport.nuisance SET latlng_accuracy_type = 'approximate';
UPDATE publicreport.nuisance SET latlng_accuracy_value = 0.0;
ALTER TABLE publicreport.nuisance ALTER COLUMN address_country SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN address_place SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN address_postcode SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN address_region SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN address_street SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN is_location_backyard SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN is_location_frontyard SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN is_location_garden SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN is_location_other SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN is_location_pool SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN map_zoom SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN tod_early SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN tod_day SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN tod_evening SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN tod_night SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN latlng_accuracy_type SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN latlng_accuracy_value SET NOT NULL;
ALTER TABLE publicreport.nuisance DROP COLUMN source_location;
DROP TYPE publicreport.NuisanceInspectionType;
DROP TYPE publicreport.NuisanceLocationType;
DROP TYPE publicreport.NuisancePreferredDateRangeType;
DROP TYPE publicreport.NuisancePreferredTimeType;
-- +goose Down
CREATE TYPE publicreport.NuisancePreferredTimeType AS ENUM (
'none',
'afternoon',
'any-time',
'morning'
);
CREATE TYPE publicreport.NuisancePreferredDateRangeType AS ENUM (
'none',
'any-time',
'in-two-weeks',
'next-week'
);
CREATE TYPE publicreport.NuisanceLocationType AS ENUM (
'none',
'front-yard',
'backyard',
'patio',
'garden',
'pool-area',
'throughout',
'indoors',
'other'
);
CREATE TYPE publicreport.NuisanceInspectionType AS ENUM (
'neighborhood',
'property'
);
ALTER TABLE publicreport.nuisance ADD COLUMN source_location publicreport.NuisanceLocationType;
ALTER TABLE publicreport.nuisance DROP COLUMN address_country;
ALTER TABLE publicreport.nuisance DROP COLUMN address_place;
ALTER TABLE publicreport.nuisance DROP COLUMN address_postcode;
ALTER TABLE publicreport.nuisance DROP COLUMN address_region;
ALTER TABLE publicreport.nuisance DROP COLUMN address_street;
ALTER TABLE publicreport.nuisance DROP COLUMN is_location_frontyard;
ALTER TABLE publicreport.nuisance DROP COLUMN is_location_backyard;
ALTER TABLE publicreport.nuisance DROP COLUMN is_location_garden;
ALTER TABLE publicreport.nuisance DROP COLUMN is_location_pool;
ALTER TABLE publicreport.nuisance DROP COLUMN is_location_other;
ALTER TABLE publicreport.nuisance DROP COLUMN map_zoom;
ALTER TABLE publicreport.nuisance DROP COLUMN tod_early;
ALTER TABLE publicreport.nuisance DROP COLUMN tod_day;
ALTER TABLE publicreport.nuisance DROP COLUMN tod_evening;
ALTER TABLE publicreport.nuisance DROP COLUMN tod_night;
ALTER TABLE publicreport.nuisance DROP COLUMN latlng_accuracy_type;
ALTER TABLE publicreport.nuisance DROP COLUMN latlng_accuracy_value;
DROP TYPE publicreport.AccuracyType;

View file

@ -29,24 +29,40 @@ import (
// PublicreportNuisance is an object representing the database table.
type PublicreportNuisance struct {
ID int32 `db:"id,pk" `
AdditionalInfo string `db:"additional_info" `
Created time.Time `db:"created" `
Duration enums.PublicreportNuisancedurationtype `db:"duration" `
SourceLocation enums.PublicreportNuisancelocationtype `db:"source_location" `
SourceContainer bool `db:"source_container" `
SourceDescription string `db:"source_description" `
SourceStagnant bool `db:"source_stagnant" `
PublicID string `db:"public_id" `
ReporterEmail null.Val[string] `db:"reporter_email" `
ReporterName null.Val[string] `db:"reporter_name" `
ReporterPhone null.Val[string] `db:"reporter_phone" `
Address string `db:"address" `
Location null.Val[string] `db:"location" `
Status enums.PublicreportReportstatustype `db:"status" `
OrganizationID null.Val[int32] `db:"organization_id" `
SourceGutter bool `db:"source_gutter" `
H3cell null.Val[string] `db:"h3cell" `
ID int32 `db:"id,pk" `
AdditionalInfo string `db:"additional_info" `
Created time.Time `db:"created" `
Duration enums.PublicreportNuisancedurationtype `db:"duration" `
SourceContainer bool `db:"source_container" `
SourceDescription string `db:"source_description" `
SourceStagnant bool `db:"source_stagnant" `
PublicID string `db:"public_id" `
ReporterEmail null.Val[string] `db:"reporter_email" `
ReporterName null.Val[string] `db:"reporter_name" `
ReporterPhone null.Val[string] `db:"reporter_phone" `
Address string `db:"address" `
Location null.Val[string] `db:"location" `
Status enums.PublicreportReportstatustype `db:"status" `
OrganizationID null.Val[int32] `db:"organization_id" `
SourceGutter bool `db:"source_gutter" `
H3cell null.Val[string] `db:"h3cell" `
AddressCountry string `db:"address_country" `
AddressPlace string `db:"address_place" `
AddressPostcode string `db:"address_postcode" `
AddressRegion string `db:"address_region" `
AddressStreet string `db:"address_street" `
IsLocationBackyard bool `db:"is_location_backyard" `
IsLocationFrontyard bool `db:"is_location_frontyard" `
IsLocationGarden bool `db:"is_location_garden" `
IsLocationOther bool `db:"is_location_other" `
IsLocationPool bool `db:"is_location_pool" `
MapZoom float32 `db:"map_zoom" `
TodEarly bool `db:"tod_early" `
TodDay bool `db:"tod_day" `
TodEvening bool `db:"tod_evening" `
TodNight bool `db:"tod_night" `
LatlngAccuracyType enums.PublicreportAccuracytype `db:"latlng_accuracy_type" `
LatlngAccuracyValue float32 `db:"latlng_accuracy_value" `
R publicreportNuisanceR `db:"-" `
@ -72,51 +88,83 @@ type publicreportNuisanceR struct {
func buildPublicreportNuisanceColumns(alias string) publicreportNuisanceColumns {
return publicreportNuisanceColumns{
ColumnsExpr: expr.NewColumnsExpr(
"id", "additional_info", "created", "duration", "source_location", "source_container", "source_description", "source_stagnant", "public_id", "reporter_email", "reporter_name", "reporter_phone", "address", "location", "status", "organization_id", "source_gutter", "h3cell",
"id", "additional_info", "created", "duration", "source_container", "source_description", "source_stagnant", "public_id", "reporter_email", "reporter_name", "reporter_phone", "address", "location", "status", "organization_id", "source_gutter", "h3cell", "address_country", "address_place", "address_postcode", "address_region", "address_street", "is_location_backyard", "is_location_frontyard", "is_location_garden", "is_location_other", "is_location_pool", "map_zoom", "tod_early", "tod_day", "tod_evening", "tod_night", "latlng_accuracy_type", "latlng_accuracy_value",
).WithParent("publicreport.nuisance"),
tableAlias: alias,
ID: psql.Quote(alias, "id"),
AdditionalInfo: psql.Quote(alias, "additional_info"),
Created: psql.Quote(alias, "created"),
Duration: psql.Quote(alias, "duration"),
SourceLocation: psql.Quote(alias, "source_location"),
SourceContainer: psql.Quote(alias, "source_container"),
SourceDescription: psql.Quote(alias, "source_description"),
SourceStagnant: psql.Quote(alias, "source_stagnant"),
PublicID: psql.Quote(alias, "public_id"),
ReporterEmail: psql.Quote(alias, "reporter_email"),
ReporterName: psql.Quote(alias, "reporter_name"),
ReporterPhone: psql.Quote(alias, "reporter_phone"),
Address: psql.Quote(alias, "address"),
Location: psql.Quote(alias, "location"),
Status: psql.Quote(alias, "status"),
OrganizationID: psql.Quote(alias, "organization_id"),
SourceGutter: psql.Quote(alias, "source_gutter"),
H3cell: psql.Quote(alias, "h3cell"),
tableAlias: alias,
ID: psql.Quote(alias, "id"),
AdditionalInfo: psql.Quote(alias, "additional_info"),
Created: psql.Quote(alias, "created"),
Duration: psql.Quote(alias, "duration"),
SourceContainer: psql.Quote(alias, "source_container"),
SourceDescription: psql.Quote(alias, "source_description"),
SourceStagnant: psql.Quote(alias, "source_stagnant"),
PublicID: psql.Quote(alias, "public_id"),
ReporterEmail: psql.Quote(alias, "reporter_email"),
ReporterName: psql.Quote(alias, "reporter_name"),
ReporterPhone: psql.Quote(alias, "reporter_phone"),
Address: psql.Quote(alias, "address"),
Location: psql.Quote(alias, "location"),
Status: psql.Quote(alias, "status"),
OrganizationID: psql.Quote(alias, "organization_id"),
SourceGutter: psql.Quote(alias, "source_gutter"),
H3cell: psql.Quote(alias, "h3cell"),
AddressCountry: psql.Quote(alias, "address_country"),
AddressPlace: psql.Quote(alias, "address_place"),
AddressPostcode: psql.Quote(alias, "address_postcode"),
AddressRegion: psql.Quote(alias, "address_region"),
AddressStreet: psql.Quote(alias, "address_street"),
IsLocationBackyard: psql.Quote(alias, "is_location_backyard"),
IsLocationFrontyard: psql.Quote(alias, "is_location_frontyard"),
IsLocationGarden: psql.Quote(alias, "is_location_garden"),
IsLocationOther: psql.Quote(alias, "is_location_other"),
IsLocationPool: psql.Quote(alias, "is_location_pool"),
MapZoom: psql.Quote(alias, "map_zoom"),
TodEarly: psql.Quote(alias, "tod_early"),
TodDay: psql.Quote(alias, "tod_day"),
TodEvening: psql.Quote(alias, "tod_evening"),
TodNight: psql.Quote(alias, "tod_night"),
LatlngAccuracyType: psql.Quote(alias, "latlng_accuracy_type"),
LatlngAccuracyValue: psql.Quote(alias, "latlng_accuracy_value"),
}
}
type publicreportNuisanceColumns struct {
expr.ColumnsExpr
tableAlias string
ID psql.Expression
AdditionalInfo psql.Expression
Created psql.Expression
Duration psql.Expression
SourceLocation psql.Expression
SourceContainer psql.Expression
SourceDescription psql.Expression
SourceStagnant psql.Expression
PublicID psql.Expression
ReporterEmail psql.Expression
ReporterName psql.Expression
ReporterPhone psql.Expression
Address psql.Expression
Location psql.Expression
Status psql.Expression
OrganizationID psql.Expression
SourceGutter psql.Expression
H3cell psql.Expression
tableAlias string
ID psql.Expression
AdditionalInfo psql.Expression
Created psql.Expression
Duration psql.Expression
SourceContainer psql.Expression
SourceDescription psql.Expression
SourceStagnant psql.Expression
PublicID psql.Expression
ReporterEmail psql.Expression
ReporterName psql.Expression
ReporterPhone psql.Expression
Address psql.Expression
Location psql.Expression
Status psql.Expression
OrganizationID psql.Expression
SourceGutter psql.Expression
H3cell psql.Expression
AddressCountry psql.Expression
AddressPlace psql.Expression
AddressPostcode psql.Expression
AddressRegion psql.Expression
AddressStreet psql.Expression
IsLocationBackyard psql.Expression
IsLocationFrontyard psql.Expression
IsLocationGarden psql.Expression
IsLocationOther psql.Expression
IsLocationPool psql.Expression
MapZoom psql.Expression
TodEarly psql.Expression
TodDay psql.Expression
TodEvening psql.Expression
TodNight psql.Expression
LatlngAccuracyType psql.Expression
LatlngAccuracyValue psql.Expression
}
func (c publicreportNuisanceColumns) Alias() string {
@ -131,28 +179,44 @@ func (publicreportNuisanceColumns) AliasedAs(alias string) publicreportNuisanceC
// All values are optional, and do not have to be set
// Generated columns are not included
type PublicreportNuisanceSetter struct {
ID omit.Val[int32] `db:"id,pk" `
AdditionalInfo omit.Val[string] `db:"additional_info" `
Created omit.Val[time.Time] `db:"created" `
Duration omit.Val[enums.PublicreportNuisancedurationtype] `db:"duration" `
SourceLocation omit.Val[enums.PublicreportNuisancelocationtype] `db:"source_location" `
SourceContainer omit.Val[bool] `db:"source_container" `
SourceDescription omit.Val[string] `db:"source_description" `
SourceStagnant omit.Val[bool] `db:"source_stagnant" `
PublicID omit.Val[string] `db:"public_id" `
ReporterEmail omitnull.Val[string] `db:"reporter_email" `
ReporterName omitnull.Val[string] `db:"reporter_name" `
ReporterPhone omitnull.Val[string] `db:"reporter_phone" `
Address omit.Val[string] `db:"address" `
Location omitnull.Val[string] `db:"location" `
Status omit.Val[enums.PublicreportReportstatustype] `db:"status" `
OrganizationID omitnull.Val[int32] `db:"organization_id" `
SourceGutter omit.Val[bool] `db:"source_gutter" `
H3cell omitnull.Val[string] `db:"h3cell" `
ID omit.Val[int32] `db:"id,pk" `
AdditionalInfo omit.Val[string] `db:"additional_info" `
Created omit.Val[time.Time] `db:"created" `
Duration omit.Val[enums.PublicreportNuisancedurationtype] `db:"duration" `
SourceContainer omit.Val[bool] `db:"source_container" `
SourceDescription omit.Val[string] `db:"source_description" `
SourceStagnant omit.Val[bool] `db:"source_stagnant" `
PublicID omit.Val[string] `db:"public_id" `
ReporterEmail omitnull.Val[string] `db:"reporter_email" `
ReporterName omitnull.Val[string] `db:"reporter_name" `
ReporterPhone omitnull.Val[string] `db:"reporter_phone" `
Address omit.Val[string] `db:"address" `
Location omitnull.Val[string] `db:"location" `
Status omit.Val[enums.PublicreportReportstatustype] `db:"status" `
OrganizationID omitnull.Val[int32] `db:"organization_id" `
SourceGutter omit.Val[bool] `db:"source_gutter" `
H3cell omitnull.Val[string] `db:"h3cell" `
AddressCountry omit.Val[string] `db:"address_country" `
AddressPlace omit.Val[string] `db:"address_place" `
AddressPostcode omit.Val[string] `db:"address_postcode" `
AddressRegion omit.Val[string] `db:"address_region" `
AddressStreet omit.Val[string] `db:"address_street" `
IsLocationBackyard omit.Val[bool] `db:"is_location_backyard" `
IsLocationFrontyard omit.Val[bool] `db:"is_location_frontyard" `
IsLocationGarden omit.Val[bool] `db:"is_location_garden" `
IsLocationOther omit.Val[bool] `db:"is_location_other" `
IsLocationPool omit.Val[bool] `db:"is_location_pool" `
MapZoom omit.Val[float32] `db:"map_zoom" `
TodEarly omit.Val[bool] `db:"tod_early" `
TodDay omit.Val[bool] `db:"tod_day" `
TodEvening omit.Val[bool] `db:"tod_evening" `
TodNight omit.Val[bool] `db:"tod_night" `
LatlngAccuracyType omit.Val[enums.PublicreportAccuracytype] `db:"latlng_accuracy_type" `
LatlngAccuracyValue omit.Val[float32] `db:"latlng_accuracy_value" `
}
func (s PublicreportNuisanceSetter) SetColumns() []string {
vals := make([]string, 0, 18)
vals := make([]string, 0, 34)
if s.ID.IsValue() {
vals = append(vals, "id")
}
@ -165,9 +229,6 @@ func (s PublicreportNuisanceSetter) SetColumns() []string {
if s.Duration.IsValue() {
vals = append(vals, "duration")
}
if s.SourceLocation.IsValue() {
vals = append(vals, "source_location")
}
if s.SourceContainer.IsValue() {
vals = append(vals, "source_container")
}
@ -207,6 +268,57 @@ func (s PublicreportNuisanceSetter) SetColumns() []string {
if !s.H3cell.IsUnset() {
vals = append(vals, "h3cell")
}
if s.AddressCountry.IsValue() {
vals = append(vals, "address_country")
}
if s.AddressPlace.IsValue() {
vals = append(vals, "address_place")
}
if s.AddressPostcode.IsValue() {
vals = append(vals, "address_postcode")
}
if s.AddressRegion.IsValue() {
vals = append(vals, "address_region")
}
if s.AddressStreet.IsValue() {
vals = append(vals, "address_street")
}
if s.IsLocationBackyard.IsValue() {
vals = append(vals, "is_location_backyard")
}
if s.IsLocationFrontyard.IsValue() {
vals = append(vals, "is_location_frontyard")
}
if s.IsLocationGarden.IsValue() {
vals = append(vals, "is_location_garden")
}
if s.IsLocationOther.IsValue() {
vals = append(vals, "is_location_other")
}
if s.IsLocationPool.IsValue() {
vals = append(vals, "is_location_pool")
}
if s.MapZoom.IsValue() {
vals = append(vals, "map_zoom")
}
if s.TodEarly.IsValue() {
vals = append(vals, "tod_early")
}
if s.TodDay.IsValue() {
vals = append(vals, "tod_day")
}
if s.TodEvening.IsValue() {
vals = append(vals, "tod_evening")
}
if s.TodNight.IsValue() {
vals = append(vals, "tod_night")
}
if s.LatlngAccuracyType.IsValue() {
vals = append(vals, "latlng_accuracy_type")
}
if s.LatlngAccuracyValue.IsValue() {
vals = append(vals, "latlng_accuracy_value")
}
return vals
}
@ -223,9 +335,6 @@ func (s PublicreportNuisanceSetter) Overwrite(t *PublicreportNuisance) {
if s.Duration.IsValue() {
t.Duration = s.Duration.MustGet()
}
if s.SourceLocation.IsValue() {
t.SourceLocation = s.SourceLocation.MustGet()
}
if s.SourceContainer.IsValue() {
t.SourceContainer = s.SourceContainer.MustGet()
}
@ -265,6 +374,57 @@ func (s PublicreportNuisanceSetter) Overwrite(t *PublicreportNuisance) {
if !s.H3cell.IsUnset() {
t.H3cell = s.H3cell.MustGetNull()
}
if s.AddressCountry.IsValue() {
t.AddressCountry = s.AddressCountry.MustGet()
}
if s.AddressPlace.IsValue() {
t.AddressPlace = s.AddressPlace.MustGet()
}
if s.AddressPostcode.IsValue() {
t.AddressPostcode = s.AddressPostcode.MustGet()
}
if s.AddressRegion.IsValue() {
t.AddressRegion = s.AddressRegion.MustGet()
}
if s.AddressStreet.IsValue() {
t.AddressStreet = s.AddressStreet.MustGet()
}
if s.IsLocationBackyard.IsValue() {
t.IsLocationBackyard = s.IsLocationBackyard.MustGet()
}
if s.IsLocationFrontyard.IsValue() {
t.IsLocationFrontyard = s.IsLocationFrontyard.MustGet()
}
if s.IsLocationGarden.IsValue() {
t.IsLocationGarden = s.IsLocationGarden.MustGet()
}
if s.IsLocationOther.IsValue() {
t.IsLocationOther = s.IsLocationOther.MustGet()
}
if s.IsLocationPool.IsValue() {
t.IsLocationPool = s.IsLocationPool.MustGet()
}
if s.MapZoom.IsValue() {
t.MapZoom = s.MapZoom.MustGet()
}
if s.TodEarly.IsValue() {
t.TodEarly = s.TodEarly.MustGet()
}
if s.TodDay.IsValue() {
t.TodDay = s.TodDay.MustGet()
}
if s.TodEvening.IsValue() {
t.TodEvening = s.TodEvening.MustGet()
}
if s.TodNight.IsValue() {
t.TodNight = s.TodNight.MustGet()
}
if s.LatlngAccuracyType.IsValue() {
t.LatlngAccuracyType = s.LatlngAccuracyType.MustGet()
}
if s.LatlngAccuracyValue.IsValue() {
t.LatlngAccuracyValue = s.LatlngAccuracyValue.MustGet()
}
}
func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) {
@ -273,7 +433,7 @@ func (s *PublicreportNuisanceSetter) 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, 18)
vals := make([]bob.Expression, 34)
if s.ID.IsValue() {
vals[0] = psql.Arg(s.ID.MustGet())
} else {
@ -298,90 +458,186 @@ func (s *PublicreportNuisanceSetter) Apply(q *dialect.InsertQuery) {
vals[3] = psql.Raw("DEFAULT")
}
if s.SourceLocation.IsValue() {
vals[4] = psql.Arg(s.SourceLocation.MustGet())
if s.SourceContainer.IsValue() {
vals[4] = psql.Arg(s.SourceContainer.MustGet())
} else {
vals[4] = psql.Raw("DEFAULT")
}
if s.SourceContainer.IsValue() {
vals[5] = psql.Arg(s.SourceContainer.MustGet())
if s.SourceDescription.IsValue() {
vals[5] = psql.Arg(s.SourceDescription.MustGet())
} else {
vals[5] = psql.Raw("DEFAULT")
}
if s.SourceDescription.IsValue() {
vals[6] = psql.Arg(s.SourceDescription.MustGet())
if s.SourceStagnant.IsValue() {
vals[6] = psql.Arg(s.SourceStagnant.MustGet())
} else {
vals[6] = psql.Raw("DEFAULT")
}
if s.SourceStagnant.IsValue() {
vals[7] = psql.Arg(s.SourceStagnant.MustGet())
if s.PublicID.IsValue() {
vals[7] = psql.Arg(s.PublicID.MustGet())
} else {
vals[7] = psql.Raw("DEFAULT")
}
if s.PublicID.IsValue() {
vals[8] = psql.Arg(s.PublicID.MustGet())
if !s.ReporterEmail.IsUnset() {
vals[8] = psql.Arg(s.ReporterEmail.MustGetNull())
} else {
vals[8] = psql.Raw("DEFAULT")
}
if !s.ReporterEmail.IsUnset() {
vals[9] = psql.Arg(s.ReporterEmail.MustGetNull())
if !s.ReporterName.IsUnset() {
vals[9] = psql.Arg(s.ReporterName.MustGetNull())
} else {
vals[9] = psql.Raw("DEFAULT")
}
if !s.ReporterName.IsUnset() {
vals[10] = psql.Arg(s.ReporterName.MustGetNull())
if !s.ReporterPhone.IsUnset() {
vals[10] = psql.Arg(s.ReporterPhone.MustGetNull())
} else {
vals[10] = psql.Raw("DEFAULT")
}
if !s.ReporterPhone.IsUnset() {
vals[11] = psql.Arg(s.ReporterPhone.MustGetNull())
if s.Address.IsValue() {
vals[11] = psql.Arg(s.Address.MustGet())
} else {
vals[11] = psql.Raw("DEFAULT")
}
if s.Address.IsValue() {
vals[12] = psql.Arg(s.Address.MustGet())
if !s.Location.IsUnset() {
vals[12] = psql.Arg(s.Location.MustGetNull())
} else {
vals[12] = psql.Raw("DEFAULT")
}
if !s.Location.IsUnset() {
vals[13] = psql.Arg(s.Location.MustGetNull())
if s.Status.IsValue() {
vals[13] = psql.Arg(s.Status.MustGet())
} else {
vals[13] = psql.Raw("DEFAULT")
}
if s.Status.IsValue() {
vals[14] = psql.Arg(s.Status.MustGet())
if !s.OrganizationID.IsUnset() {
vals[14] = psql.Arg(s.OrganizationID.MustGetNull())
} else {
vals[14] = psql.Raw("DEFAULT")
}
if !s.OrganizationID.IsUnset() {
vals[15] = psql.Arg(s.OrganizationID.MustGetNull())
if s.SourceGutter.IsValue() {
vals[15] = psql.Arg(s.SourceGutter.MustGet())
} else {
vals[15] = psql.Raw("DEFAULT")
}
if s.SourceGutter.IsValue() {
vals[16] = psql.Arg(s.SourceGutter.MustGet())
if !s.H3cell.IsUnset() {
vals[16] = psql.Arg(s.H3cell.MustGetNull())
} else {
vals[16] = psql.Raw("DEFAULT")
}
if !s.H3cell.IsUnset() {
vals[17] = psql.Arg(s.H3cell.MustGetNull())
if s.AddressCountry.IsValue() {
vals[17] = psql.Arg(s.AddressCountry.MustGet())
} else {
vals[17] = psql.Raw("DEFAULT")
}
if s.AddressPlace.IsValue() {
vals[18] = psql.Arg(s.AddressPlace.MustGet())
} else {
vals[18] = psql.Raw("DEFAULT")
}
if s.AddressPostcode.IsValue() {
vals[19] = psql.Arg(s.AddressPostcode.MustGet())
} else {
vals[19] = psql.Raw("DEFAULT")
}
if s.AddressRegion.IsValue() {
vals[20] = psql.Arg(s.AddressRegion.MustGet())
} else {
vals[20] = psql.Raw("DEFAULT")
}
if s.AddressStreet.IsValue() {
vals[21] = psql.Arg(s.AddressStreet.MustGet())
} else {
vals[21] = psql.Raw("DEFAULT")
}
if s.IsLocationBackyard.IsValue() {
vals[22] = psql.Arg(s.IsLocationBackyard.MustGet())
} else {
vals[22] = psql.Raw("DEFAULT")
}
if s.IsLocationFrontyard.IsValue() {
vals[23] = psql.Arg(s.IsLocationFrontyard.MustGet())
} else {
vals[23] = psql.Raw("DEFAULT")
}
if s.IsLocationGarden.IsValue() {
vals[24] = psql.Arg(s.IsLocationGarden.MustGet())
} else {
vals[24] = psql.Raw("DEFAULT")
}
if s.IsLocationOther.IsValue() {
vals[25] = psql.Arg(s.IsLocationOther.MustGet())
} else {
vals[25] = psql.Raw("DEFAULT")
}
if s.IsLocationPool.IsValue() {
vals[26] = psql.Arg(s.IsLocationPool.MustGet())
} else {
vals[26] = psql.Raw("DEFAULT")
}
if s.MapZoom.IsValue() {
vals[27] = psql.Arg(s.MapZoom.MustGet())
} else {
vals[27] = psql.Raw("DEFAULT")
}
if s.TodEarly.IsValue() {
vals[28] = psql.Arg(s.TodEarly.MustGet())
} else {
vals[28] = psql.Raw("DEFAULT")
}
if s.TodDay.IsValue() {
vals[29] = psql.Arg(s.TodDay.MustGet())
} else {
vals[29] = psql.Raw("DEFAULT")
}
if s.TodEvening.IsValue() {
vals[30] = psql.Arg(s.TodEvening.MustGet())
} else {
vals[30] = psql.Raw("DEFAULT")
}
if s.TodNight.IsValue() {
vals[31] = psql.Arg(s.TodNight.MustGet())
} else {
vals[31] = psql.Raw("DEFAULT")
}
if s.LatlngAccuracyType.IsValue() {
vals[32] = psql.Arg(s.LatlngAccuracyType.MustGet())
} else {
vals[32] = psql.Raw("DEFAULT")
}
if s.LatlngAccuracyValue.IsValue() {
vals[33] = psql.Arg(s.LatlngAccuracyValue.MustGet())
} else {
vals[33] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
@ -391,7 +647,7 @@ func (s PublicreportNuisanceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
}
func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 18)
exprs := make([]bob.Expression, 0, 34)
if s.ID.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
@ -421,13 +677,6 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi
}})
}
if s.SourceLocation.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "source_location")...),
psql.Arg(s.SourceLocation),
}})
}
if s.SourceContainer.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "source_container")...),
@ -519,6 +768,125 @@ func (s PublicreportNuisanceSetter) Expressions(prefix ...string) []bob.Expressi
}})
}
if s.AddressCountry.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "address_country")...),
psql.Arg(s.AddressCountry),
}})
}
if s.AddressPlace.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "address_place")...),
psql.Arg(s.AddressPlace),
}})
}
if s.AddressPostcode.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "address_postcode")...),
psql.Arg(s.AddressPostcode),
}})
}
if s.AddressRegion.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "address_region")...),
psql.Arg(s.AddressRegion),
}})
}
if s.AddressStreet.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "address_street")...),
psql.Arg(s.AddressStreet),
}})
}
if s.IsLocationBackyard.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "is_location_backyard")...),
psql.Arg(s.IsLocationBackyard),
}})
}
if s.IsLocationFrontyard.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "is_location_frontyard")...),
psql.Arg(s.IsLocationFrontyard),
}})
}
if s.IsLocationGarden.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "is_location_garden")...),
psql.Arg(s.IsLocationGarden),
}})
}
if s.IsLocationOther.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "is_location_other")...),
psql.Arg(s.IsLocationOther),
}})
}
if s.IsLocationPool.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "is_location_pool")...),
psql.Arg(s.IsLocationPool),
}})
}
if s.MapZoom.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "map_zoom")...),
psql.Arg(s.MapZoom),
}})
}
if s.TodEarly.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "tod_early")...),
psql.Arg(s.TodEarly),
}})
}
if s.TodDay.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "tod_day")...),
psql.Arg(s.TodDay),
}})
}
if s.TodEvening.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "tod_evening")...),
psql.Arg(s.TodEvening),
}})
}
if s.TodNight.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "tod_night")...),
psql.Arg(s.TodNight),
}})
}
if s.LatlngAccuracyType.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "latlng_accuracy_type")...),
psql.Arg(s.LatlngAccuracyType),
}})
}
if s.LatlngAccuracyValue.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "latlng_accuracy_value")...),
psql.Arg(s.LatlngAccuracyValue),
}})
}
return exprs
}
@ -912,24 +1280,40 @@ func (publicreportNuisance0 *PublicreportNuisance) AttachImages(ctx context.Cont
}
type publicreportNuisanceWhere[Q psql.Filterable] struct {
ID psql.WhereMod[Q, int32]
AdditionalInfo psql.WhereMod[Q, string]
Created psql.WhereMod[Q, time.Time]
Duration psql.WhereMod[Q, enums.PublicreportNuisancedurationtype]
SourceLocation psql.WhereMod[Q, enums.PublicreportNuisancelocationtype]
SourceContainer psql.WhereMod[Q, bool]
SourceDescription psql.WhereMod[Q, string]
SourceStagnant psql.WhereMod[Q, bool]
PublicID psql.WhereMod[Q, string]
ReporterEmail psql.WhereNullMod[Q, string]
ReporterName psql.WhereNullMod[Q, string]
ReporterPhone psql.WhereNullMod[Q, string]
Address psql.WhereMod[Q, string]
Location psql.WhereNullMod[Q, string]
Status psql.WhereMod[Q, enums.PublicreportReportstatustype]
OrganizationID psql.WhereNullMod[Q, int32]
SourceGutter psql.WhereMod[Q, bool]
H3cell psql.WhereNullMod[Q, string]
ID psql.WhereMod[Q, int32]
AdditionalInfo psql.WhereMod[Q, string]
Created psql.WhereMod[Q, time.Time]
Duration psql.WhereMod[Q, enums.PublicreportNuisancedurationtype]
SourceContainer psql.WhereMod[Q, bool]
SourceDescription psql.WhereMod[Q, string]
SourceStagnant psql.WhereMod[Q, bool]
PublicID psql.WhereMod[Q, string]
ReporterEmail psql.WhereNullMod[Q, string]
ReporterName psql.WhereNullMod[Q, string]
ReporterPhone psql.WhereNullMod[Q, string]
Address psql.WhereMod[Q, string]
Location psql.WhereNullMod[Q, string]
Status psql.WhereMod[Q, enums.PublicreportReportstatustype]
OrganizationID psql.WhereNullMod[Q, int32]
SourceGutter psql.WhereMod[Q, bool]
H3cell psql.WhereNullMod[Q, string]
AddressCountry psql.WhereMod[Q, string]
AddressPlace psql.WhereMod[Q, string]
AddressPostcode psql.WhereMod[Q, string]
AddressRegion psql.WhereMod[Q, string]
AddressStreet psql.WhereMod[Q, string]
IsLocationBackyard psql.WhereMod[Q, bool]
IsLocationFrontyard psql.WhereMod[Q, bool]
IsLocationGarden psql.WhereMod[Q, bool]
IsLocationOther psql.WhereMod[Q, bool]
IsLocationPool psql.WhereMod[Q, bool]
MapZoom psql.WhereMod[Q, float32]
TodEarly psql.WhereMod[Q, bool]
TodDay psql.WhereMod[Q, bool]
TodEvening psql.WhereMod[Q, bool]
TodNight psql.WhereMod[Q, bool]
LatlngAccuracyType psql.WhereMod[Q, enums.PublicreportAccuracytype]
LatlngAccuracyValue psql.WhereMod[Q, float32]
}
func (publicreportNuisanceWhere[Q]) AliasedAs(alias string) publicreportNuisanceWhere[Q] {
@ -938,24 +1322,40 @@ func (publicreportNuisanceWhere[Q]) AliasedAs(alias string) publicreportNuisance
func buildPublicreportNuisanceWhere[Q psql.Filterable](cols publicreportNuisanceColumns) publicreportNuisanceWhere[Q] {
return publicreportNuisanceWhere[Q]{
ID: psql.Where[Q, int32](cols.ID),
AdditionalInfo: psql.Where[Q, string](cols.AdditionalInfo),
Created: psql.Where[Q, time.Time](cols.Created),
Duration: psql.Where[Q, enums.PublicreportNuisancedurationtype](cols.Duration),
SourceLocation: psql.Where[Q, enums.PublicreportNuisancelocationtype](cols.SourceLocation),
SourceContainer: psql.Where[Q, bool](cols.SourceContainer),
SourceDescription: psql.Where[Q, string](cols.SourceDescription),
SourceStagnant: psql.Where[Q, bool](cols.SourceStagnant),
PublicID: psql.Where[Q, string](cols.PublicID),
ReporterEmail: psql.WhereNull[Q, string](cols.ReporterEmail),
ReporterName: psql.WhereNull[Q, string](cols.ReporterName),
ReporterPhone: psql.WhereNull[Q, string](cols.ReporterPhone),
Address: psql.Where[Q, string](cols.Address),
Location: psql.WhereNull[Q, string](cols.Location),
Status: psql.Where[Q, enums.PublicreportReportstatustype](cols.Status),
OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID),
SourceGutter: psql.Where[Q, bool](cols.SourceGutter),
H3cell: psql.WhereNull[Q, string](cols.H3cell),
ID: psql.Where[Q, int32](cols.ID),
AdditionalInfo: psql.Where[Q, string](cols.AdditionalInfo),
Created: psql.Where[Q, time.Time](cols.Created),
Duration: psql.Where[Q, enums.PublicreportNuisancedurationtype](cols.Duration),
SourceContainer: psql.Where[Q, bool](cols.SourceContainer),
SourceDescription: psql.Where[Q, string](cols.SourceDescription),
SourceStagnant: psql.Where[Q, bool](cols.SourceStagnant),
PublicID: psql.Where[Q, string](cols.PublicID),
ReporterEmail: psql.WhereNull[Q, string](cols.ReporterEmail),
ReporterName: psql.WhereNull[Q, string](cols.ReporterName),
ReporterPhone: psql.WhereNull[Q, string](cols.ReporterPhone),
Address: psql.Where[Q, string](cols.Address),
Location: psql.WhereNull[Q, string](cols.Location),
Status: psql.Where[Q, enums.PublicreportReportstatustype](cols.Status),
OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID),
SourceGutter: psql.Where[Q, bool](cols.SourceGutter),
H3cell: psql.WhereNull[Q, string](cols.H3cell),
AddressCountry: psql.Where[Q, string](cols.AddressCountry),
AddressPlace: psql.Where[Q, string](cols.AddressPlace),
AddressPostcode: psql.Where[Q, string](cols.AddressPostcode),
AddressRegion: psql.Where[Q, string](cols.AddressRegion),
AddressStreet: psql.Where[Q, string](cols.AddressStreet),
IsLocationBackyard: psql.Where[Q, bool](cols.IsLocationBackyard),
IsLocationFrontyard: psql.Where[Q, bool](cols.IsLocationFrontyard),
IsLocationGarden: psql.Where[Q, bool](cols.IsLocationGarden),
IsLocationOther: psql.Where[Q, bool](cols.IsLocationOther),
IsLocationPool: psql.Where[Q, bool](cols.IsLocationPool),
MapZoom: psql.Where[Q, float32](cols.MapZoom),
TodEarly: psql.Where[Q, bool](cols.TodEarly),
TodDay: psql.Where[Q, bool](cols.TodDay),
TodEvening: psql.Where[Q, bool](cols.TodEvening),
TodNight: psql.Where[Q, bool](cols.TodNight),
LatlngAccuracyType: psql.Where[Q, enums.PublicreportAccuracytype](cols.LatlngAccuracyType),
LatlngAccuracyValue: psql.Where[Q, float32](cols.LatlngAccuracyValue),
}
}

View file

@ -3,6 +3,7 @@ package rmo
import (
"fmt"
"net/http"
"slices"
"strconv"
"time"
@ -88,45 +89,94 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
respondError(w, "Failed to parse form", err, http.StatusBadRequest)
return
}
additional_info := r.PostFormValue("additional-info")
address := r.PostFormValue("address")
address_country := r.PostFormValue("address-country")
address_place := r.PostFormValue("address-place")
address_postcode := r.PostFormValue("address-postcode")
address_region := r.PostFormValue("address-region")
address_street := r.PostFormValue("address-street")
duration_str := postFormValueOrNone(r, "duration")
lat := r.FormValue("latitude")
lng := r.FormValue("longitude")
latlng_accuracy_type_str := r.PostFormValue("latlng-accuracy-type")
latlng_accuracy_value_str := r.PostFormValue("latlng-accuracy-value")
map_zoom_str := r.PostFormValue("map-zoom")
source_stagnant := boolFromForm(r, "source-stagnant")
source_container := boolFromForm(r, "source-container")
source_description := r.PostFormValue("source-description")
source_gutters := boolFromForm(r, "source-gutters")
source_locations := r.Form["source-location"]
tod_early := boolFromForm(r, "tod-early")
tod_day := boolFromForm(r, "tod-day")
tod_evening := boolFromForm(r, "tod-evening")
tod_night := boolFromForm(r, "tod-night")
duration := enums.PublicreportNuisancedurationtypeNone
is_location_frontyard := false
is_location_backyard := false
is_location_garden := false
is_location_pool := false
is_location_other := false
latlng_accuracy_value := float32(0.0)
map_zoom := float32(0.0)
duration_str := postFormValueOrNone(r, "duration")
var duration enums.PublicreportNuisancedurationtype
err = duration.Scan(duration_str)
if err != nil {
respondError(w, fmt.Sprintf("Failed to interpret 'duration' of '%s'", duration_str), err, http.StatusBadRequest)
return
log.Warn().Err(err).Str("duration_str", duration_str).Msg("Failed to interpret 'duration'")
}
source_location_str := postFormValueOrNone(r, "source-location")
var source_location enums.PublicreportNuisancelocationtype
err = source_location.Scan(source_location_str)
latlng_accuracy_type := enums.PublicreportAccuracytypeNone
err = latlng_accuracy_type.Scan(latlng_accuracy_type_str)
if err != nil {
respondError(w, fmt.Sprintf("Failed to interpret 'source-location' of '%s'", source_location_str), err, http.StatusBadRequest)
return
log.Warn().Err(err).Str("latlng_accuracy_type_str", latlng_accuracy_type_str).Msg("Failed to parse accuracy type")
}
source_description := r.PostFormValue("source-description")
additional_info := r.PostFormValue("additional-info")
log.Debug().Strs("source_locations", source_locations).Msg("parsing")
if slices.Contains(source_locations, "backyard") {
is_location_backyard = true
}
if slices.Contains(source_locations, "frontyard") {
is_location_frontyard = true
}
if slices.Contains(source_locations, "garden") {
is_location_garden = true
}
if slices.Contains(source_locations, "other") {
is_location_other = true
}
if slices.Contains(source_locations, "pool-area") {
is_location_pool = true
}
log.Debug().Bool("is_location_backyard", is_location_backyard).Bool("is_location_frontyard", is_location_frontyard).Bool("is_location_garden", is_location_garden).Bool("is_location_other", is_location_other).Bool("is_location_pool", is_location_pool).Msg("parsed")
var temp float64
temp, err = strconv.ParseFloat(latlng_accuracy_value_str, 32)
if err != nil {
log.Warn().Err(err).Str("latlng_accuracy_value_str", latlng_accuracy_value_str).Msg("Failed to parse latlng_accuracy_value")
} else {
latlng_accuracy_value = float32(temp)
}
latitude, err := strconv.ParseFloat(lat, 64)
if err != nil {
respondError(w, "Failed to create parse latitude", err, http.StatusBadRequest)
return
log.Warn().Err(err).Str("lat", lat).Msg("Failed to parse lat")
}
longitude, err := strconv.ParseFloat(lng, 64)
if err != nil {
respondError(w, "Failed to create parse longitude", err, http.StatusBadRequest)
return
log.Warn().Err(err).Str("lng", lng).Msg("Failed to parse lng")
}
temp, err = strconv.ParseFloat(map_zoom_str, 32)
if err != nil {
log.Warn().Err(err).Str("map_zoom_str", map_zoom_str).Msg("Failed to parse map_zoom_str")
} else {
map_zoom = float32(temp)
}
public_id, err := report.GenerateReportID()
if err != nil {
respondError(w, "Failed to create quick report public ID", err, http.StatusInternalServerError)
respondError(w, "Failed to create report public ID", err, http.StatusInternalServerError)
return
}
@ -158,13 +208,26 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
}
setter := models.PublicreportNuisanceSetter{
AdditionalInfo: omit.From(additional_info),
Address: omit.From(address),
Created: omit.From(time.Now()),
Duration: omit.From(duration),
H3cell: omitnull.From(c.String()),
AdditionalInfo: omit.From(additional_info),
Address: omit.From(address),
AddressCountry: omit.From(address_country),
AddressPlace: omit.From(address_place),
AddressPostcode: omit.From(address_postcode),
AddressRegion: omit.From(address_region),
AddressStreet: omit.From(address_street),
Created: omit.From(time.Now()),
Duration: omit.From(duration),
H3cell: omitnull.From(c.String()),
IsLocationBackyard: omit.From(is_location_backyard),
IsLocationFrontyard: omit.From(is_location_frontyard),
IsLocationGarden: omit.From(is_location_garden),
IsLocationOther: omit.From(is_location_other),
IsLocationPool: omit.From(is_location_pool),
LatlngAccuracyType: omit.From(latlng_accuracy_type),
LatlngAccuracyValue: omit.From(latlng_accuracy_value),
//Location: omitnull.From(fmt.Sprintf("ST_GeometryFromText(Point(%s %s))", longitude, latitude)),
Location: omitnull.FromPtr[string](nil),
MapZoom: omit.From(map_zoom),
OrganizationID: omitnull.FromPtr(organization_id),
PublicID: omit.From(public_id),
ReporterEmail: omitnull.FromPtr[string](nil),
@ -173,9 +236,12 @@ func postNuisance(w http.ResponseWriter, r *http.Request) {
SourceContainer: omit.From(source_container),
SourceDescription: omit.From(source_description),
SourceGutter: omit.From(source_gutters),
SourceLocation: omit.From(source_location),
SourceStagnant: omit.From(source_stagnant),
Status: omit.From(enums.PublicreportReportstatustypeReported),
TodEarly: omit.From(tod_early),
TodDay: omit.From(tod_day),
TodEvening: omit.From(tod_evening),
TodNight: omit.From(tod_night),
}
nuisance, err := models.PublicreportNuisances.Insert(&setter).One(ctx, txn)
if err != nil {

View file

@ -125,13 +125,45 @@ func contentFromNuisance(ctx context.Context, report_id string) (result ContentS
result.Report.Type = "Mosquito Nuisance"
result.Report.Details = []DetailEntry{
DetailEntry{
Name: "Active early morning?",
Value: "nah",
Name: "Active early morning (5a-8a)?",
Value: strconv.FormatBool(nuisance.TodEarly),
},
DetailEntry{
Name: "Active daytime (8a-5p)?",
Value: strconv.FormatBool(nuisance.TodDay),
},
DetailEntry{
Name: "Active evening (5p-9p)?",
Value: strconv.FormatBool(nuisance.TodEvening),
},
DetailEntry{
Name: "Active night (9p-5a)?",
Value: strconv.FormatBool(nuisance.TodNight),
},
DetailEntry{
Name: "Duration",
Value: nuisance.Duration.String(),
},
DetailEntry{
Name: "Active in backyard?",
Value: strconv.FormatBool(nuisance.IsLocationBackyard),
},
DetailEntry{
Name: "Active in frontyard?",
Value: strconv.FormatBool(nuisance.IsLocationFrontyard),
},
DetailEntry{
Name: "Active in garden?",
Value: strconv.FormatBool(nuisance.IsLocationGarden),
},
DetailEntry{
Name: "Active in other location?",
Value: strconv.FormatBool(nuisance.IsLocationOther),
},
DetailEntry{
Name: "Active in pool area?",
Value: strconv.FormatBool(nuisance.IsLocationPool),
},
DetailEntry{
Name: "Stagnant Water",
Value: strconv.FormatBool(nuisance.SourceStagnant),
@ -142,7 +174,7 @@ func contentFromNuisance(ctx context.Context, report_id string) (result ContentS
},
DetailEntry{
Name: "Sprinklers & Gutters",
Value: "guess not",
Value: strconv.FormatBool(nuisance.SourceGutter),
},
}
result.Timeline = []TimelineEntry{

View file

@ -283,7 +283,7 @@ document.addEventListener('DOMContentLoaded', function() {
<div class="col-md-12">
<label for="source-location" class="form-label">Where on your property do you notice the most mosquito activity?</label>
<select class="form-select tall" multiple="true" name="source-location">
<option value="front-yard">Front yard</option>
<option value="frontyard">Front yard</option>
<option value="backyard">Back yard</option>
<option value="garden">Garden</option>
<option value="pool-area">Pool area</option>

View file

@ -98,8 +98,10 @@ document.addEventListener("DOMContentLoaded", onLoad);
</div>
{{range .Report.Details}}
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<strong>{{.Name}}</strong>
</div>
<div class="col-md-6">
<span>{{.Value}}</span>
</div>
</div>