This allows a single table to be used to process images, meaning if anything happens to the system we can always return to polling the database and process these images individually. Because of this we also want an `image` table to contain the actual binary data for the image, so we aren't selecting and writing it each time, as it is potentially a bottleneck.
82 lines
2.1 KiB
Go
82 lines
2.1 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var Image = newImageTable("haystack", "image", "")
|
|
|
|
type imageTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
ID postgres.ColumnString
|
|
ImageName postgres.ColumnString
|
|
Image postgres.ColumnString
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
}
|
|
|
|
type ImageTable struct {
|
|
imageTable
|
|
|
|
EXCLUDED imageTable
|
|
}
|
|
|
|
// AS creates new ImageTable with assigned alias
|
|
func (a ImageTable) AS(alias string) *ImageTable {
|
|
return newImageTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new ImageTable with assigned schema name
|
|
func (a ImageTable) FromSchema(schemaName string) *ImageTable {
|
|
return newImageTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new ImageTable with assigned table prefix
|
|
func (a ImageTable) WithPrefix(prefix string) *ImageTable {
|
|
return newImageTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new ImageTable with assigned table suffix
|
|
func (a ImageTable) WithSuffix(suffix string) *ImageTable {
|
|
return newImageTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newImageTable(schemaName, tableName, alias string) *ImageTable {
|
|
return &ImageTable{
|
|
imageTable: newImageTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newImageTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newImageTableImpl(schemaName, tableName, alias string) imageTable {
|
|
var (
|
|
IDColumn = postgres.StringColumn("id")
|
|
ImageNameColumn = postgres.StringColumn("image_name")
|
|
ImageColumn = postgres.StringColumn("image")
|
|
allColumns = postgres.ColumnList{IDColumn, ImageNameColumn, ImageColumn}
|
|
mutableColumns = postgres.ColumnList{ImageNameColumn, ImageColumn}
|
|
)
|
|
|
|
return imageTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
ID: IDColumn,
|
|
ImageName: ImageNameColumn,
|
|
Image: ImageColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
}
|
|
}
|