models

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SelectJoins = getJoins[*dialect.SelectQuery]()
	UpdateJoins = getJoins[*dialect.UpdateQuery]()
	DeleteJoins = getJoins[*dialect.DeleteQuery]()
)
View Source
var (
	SelectThenLoad = getThenLoaders[*dialect.SelectQuery]()
	InsertThenLoad = getThenLoaders[*dialect.InsertQuery]()
	UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]()
)
View Source
var (
	SelectWhere     = Where[*dialect.SelectQuery]()
	UpdateWhere     = Where[*dialect.UpdateQuery]()
	DeleteWhere     = Where[*dialect.DeleteQuery]()
	OnConflictWhere = Where[*clause.ConflictClause]() // Used in ON CONFLICT DO UPDATE
)
View Source
var DeviceLocations = psql.NewTablex[*DeviceLocation, DeviceLocationSlice, *DeviceLocationSetter]("", "device_locations", buildDeviceLocationColumns("device_locations"))

DeviceLocations contains methods to work with the device_locations table

View Source
var Preload = getPreloaders()
View Source
var SchemaMigrations = psql.NewTablex[*SchemaMigration, SchemaMigrationSlice, *SchemaMigrationSetter]("", "schema_migrations", buildSchemaMigrationColumns("schema_migrations"))

SchemaMigrations contains methods to work with the schema_migrations table

Functions

func DeviceLocationExists

func DeviceLocationExists(ctx context.Context, exec bob.Executor, TimePK time.Time, DeviceIDPK string) (bool, error)

DeviceLocationExists checks the presence of a single record by primary key

func SchemaMigrationExists

func SchemaMigrationExists(ctx context.Context, exec bob.Executor, VersionPK string) (bool, error)

SchemaMigrationExists checks the presence of a single record by primary key

func Where

func Where[Q psql.Filterable]() struct {
	DeviceLocations  deviceLocationWhere[Q]
	SchemaMigrations schemaMigrationWhere[Q]
}

Types

type DeviceLocation

type DeviceLocation struct {
	Time      time.Time `db:"time,pk" `
	DeviceID  string    `db:"device_id,pk" `
	SpaceSlug string    `db:"space_slug" `
	Latitude  float64   `db:"latitude" `
	Longitude float64   `db:"longitude" `
	Accuracy  float64   `db:"accuracy" `
}

DeviceLocation is an object representing the database table.

func FindDeviceLocation

func FindDeviceLocation(ctx context.Context, exec bob.Executor, TimePK time.Time, DeviceIDPK string, cols ...string) (*DeviceLocation, error)

FindDeviceLocation retrieves a single record by primary key If cols is empty Find will return all columns.

func (*DeviceLocation) AfterQueryHook

func (o *DeviceLocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error

AfterQueryHook is called after DeviceLocation is retrieved from the database

func (*DeviceLocation) Delete

func (o *DeviceLocation) Delete(ctx context.Context, exec bob.Executor) error

Delete deletes a single DeviceLocation record with an executor

func (*DeviceLocation) Reload

func (o *DeviceLocation) Reload(ctx context.Context, exec bob.Executor) error

Reload refreshes the DeviceLocation using the executor

func (*DeviceLocation) Update

Update uses an executor to update the DeviceLocation

type DeviceLocationSetter

type DeviceLocationSetter struct {
	Time      omit.Val[time.Time] `db:"time,pk" `
	DeviceID  omit.Val[string]    `db:"device_id,pk" `
	SpaceSlug omit.Val[string]    `db:"space_slug" `
	Latitude  omit.Val[float64]   `db:"latitude" `
	Longitude omit.Val[float64]   `db:"longitude" `
	Accuracy  omit.Val[float64]   `db:"accuracy" `
}

DeviceLocationSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included

func (*DeviceLocationSetter) Apply

func (DeviceLocationSetter) Expressions

func (s DeviceLocationSetter) Expressions(prefix ...string) []bob.Expression

func (DeviceLocationSetter) Overwrite

func (s DeviceLocationSetter) Overwrite(t *DeviceLocation)

func (DeviceLocationSetter) SetColumns

func (s DeviceLocationSetter) SetColumns() []string

func (DeviceLocationSetter) UpdateMod

type DeviceLocationSlice

type DeviceLocationSlice []*DeviceLocation

DeviceLocationSlice is an alias for a slice of pointers to DeviceLocation. This should almost always be used instead of []*DeviceLocation.

func (DeviceLocationSlice) AfterQueryHook

func (o DeviceLocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error

AfterQueryHook is called after DeviceLocationSlice is retrieved from the database

func (DeviceLocationSlice) DeleteAll

func (o DeviceLocationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error

func (DeviceLocationSlice) DeleteMod

func (o DeviceLocationSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery]

DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"

func (DeviceLocationSlice) ReloadAll

func (o DeviceLocationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error

func (DeviceLocationSlice) UpdateAll

func (DeviceLocationSlice) UpdateMod

func (o DeviceLocationSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery]

UpdateMod modifies an update query with "WHERE primary_key IN (o...)"

type DeviceLocationsQuery

type DeviceLocationsQuery = *psql.ViewQuery[*DeviceLocation, DeviceLocationSlice]

DeviceLocationsQuery is a query on the device_locations table

type SchemaMigration

type SchemaMigration struct {
	Version string `db:"version,pk" `
}

SchemaMigration is an object representing the database table.

func FindSchemaMigration

func FindSchemaMigration(ctx context.Context, exec bob.Executor, VersionPK string, cols ...string) (*SchemaMigration, error)

FindSchemaMigration retrieves a single record by primary key If cols is empty Find will return all columns.

func (*SchemaMigration) AfterQueryHook

func (o *SchemaMigration) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error

AfterQueryHook is called after SchemaMigration is retrieved from the database

func (*SchemaMigration) Delete

func (o *SchemaMigration) Delete(ctx context.Context, exec bob.Executor) error

Delete deletes a single SchemaMigration record with an executor

func (*SchemaMigration) Reload

func (o *SchemaMigration) Reload(ctx context.Context, exec bob.Executor) error

Reload refreshes the SchemaMigration using the executor

func (*SchemaMigration) Update

Update uses an executor to update the SchemaMigration

type SchemaMigrationSetter

type SchemaMigrationSetter struct {
	Version omit.Val[string] `db:"version,pk" `
}

SchemaMigrationSetter is used for insert/upsert/update operations All values are optional, and do not have to be set Generated columns are not included

func (*SchemaMigrationSetter) Apply

func (SchemaMigrationSetter) Expressions

func (s SchemaMigrationSetter) Expressions(prefix ...string) []bob.Expression

func (SchemaMigrationSetter) Overwrite

func (s SchemaMigrationSetter) Overwrite(t *SchemaMigration)

func (SchemaMigrationSetter) SetColumns

func (s SchemaMigrationSetter) SetColumns() []string

func (SchemaMigrationSetter) UpdateMod

type SchemaMigrationSlice

type SchemaMigrationSlice []*SchemaMigration

SchemaMigrationSlice is an alias for a slice of pointers to SchemaMigration. This should almost always be used instead of []*SchemaMigration.

func (SchemaMigrationSlice) AfterQueryHook

func (o SchemaMigrationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error

AfterQueryHook is called after SchemaMigrationSlice is retrieved from the database

func (SchemaMigrationSlice) DeleteAll

func (o SchemaMigrationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error

func (SchemaMigrationSlice) DeleteMod

DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"

func (SchemaMigrationSlice) ReloadAll

func (o SchemaMigrationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error

func (SchemaMigrationSlice) UpdateAll

func (SchemaMigrationSlice) UpdateMod

UpdateMod modifies an update query with "WHERE primary_key IN (o...)"

type SchemaMigrationsQuery

type SchemaMigrationsQuery = *psql.ViewQuery[*SchemaMigration, SchemaMigrationSlice]

SchemaMigrationsQuery is a query on the schema_migrations table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL