init
This commit is contained in:
30
database/schemas/public/enum/river_job_state.go
Normal file
30
database/schemas/public/enum/river_job_state.go
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// 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 enum
|
||||
|
||||
import "github.com/go-jet/jet/v2/postgres"
|
||||
|
||||
var RiverJobState = &struct {
|
||||
Available postgres.StringExpression
|
||||
Cancelled postgres.StringExpression
|
||||
Completed postgres.StringExpression
|
||||
Discarded postgres.StringExpression
|
||||
Pending postgres.StringExpression
|
||||
Retryable postgres.StringExpression
|
||||
Running postgres.StringExpression
|
||||
Scheduled postgres.StringExpression
|
||||
}{
|
||||
Available: postgres.NewEnumValue("available"),
|
||||
Cancelled: postgres.NewEnumValue("cancelled"),
|
||||
Completed: postgres.NewEnumValue("completed"),
|
||||
Discarded: postgres.NewEnumValue("discarded"),
|
||||
Pending: postgres.NewEnumValue("pending"),
|
||||
Retryable: postgres.NewEnumValue("retryable"),
|
||||
Running: postgres.NewEnumValue("running"),
|
||||
Scheduled: postgres.NewEnumValue("scheduled"),
|
||||
}
|
||||
21
database/schemas/public/model/medias.go
Normal file
21
database/schemas/public/model/medias.go
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Medias struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Name string `json:"name"`
|
||||
MimeType string `json:"mime_type"`
|
||||
Size int64 `json:"size"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
19
database/schemas/public/model/migrations.go
Normal file
19
database/schemas/public/model/migrations.go
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Migrations struct {
|
||||
ID int32 `sql:"primary_key" json:"id"`
|
||||
VersionID int64 `json:"version_id"`
|
||||
IsApplied bool `json:"is_applied"`
|
||||
Tstamp time.Time `json:"tstamp"`
|
||||
}
|
||||
73
database/schemas/public/model/river_job_state.go
Normal file
73
database/schemas/public/model/river_job_state.go
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// 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 model
|
||||
|
||||
import "errors"
|
||||
|
||||
type RiverJobState string
|
||||
|
||||
const (
|
||||
RiverJobState_Available RiverJobState = "available"
|
||||
RiverJobState_Cancelled RiverJobState = "cancelled"
|
||||
RiverJobState_Completed RiverJobState = "completed"
|
||||
RiverJobState_Discarded RiverJobState = "discarded"
|
||||
RiverJobState_Pending RiverJobState = "pending"
|
||||
RiverJobState_Retryable RiverJobState = "retryable"
|
||||
RiverJobState_Running RiverJobState = "running"
|
||||
RiverJobState_Scheduled RiverJobState = "scheduled"
|
||||
)
|
||||
|
||||
var RiverJobStateAllValues = []RiverJobState{
|
||||
RiverJobState_Available,
|
||||
RiverJobState_Cancelled,
|
||||
RiverJobState_Completed,
|
||||
RiverJobState_Discarded,
|
||||
RiverJobState_Pending,
|
||||
RiverJobState_Retryable,
|
||||
RiverJobState_Running,
|
||||
RiverJobState_Scheduled,
|
||||
}
|
||||
|
||||
func (e *RiverJobState) Scan(value interface{}) error {
|
||||
var enumValue string
|
||||
switch val := value.(type) {
|
||||
case string:
|
||||
enumValue = val
|
||||
case []byte:
|
||||
enumValue = string(val)
|
||||
default:
|
||||
return errors.New("jet: Invalid scan value for AllTypesEnum enum. Enum value has to be of type string or []byte")
|
||||
}
|
||||
|
||||
switch enumValue {
|
||||
case "available":
|
||||
*e = RiverJobState_Available
|
||||
case "cancelled":
|
||||
*e = RiverJobState_Cancelled
|
||||
case "completed":
|
||||
*e = RiverJobState_Completed
|
||||
case "discarded":
|
||||
*e = RiverJobState_Discarded
|
||||
case "pending":
|
||||
*e = RiverJobState_Pending
|
||||
case "retryable":
|
||||
*e = RiverJobState_Retryable
|
||||
case "running":
|
||||
*e = RiverJobState_Running
|
||||
case "scheduled":
|
||||
*e = RiverJobState_Scheduled
|
||||
default:
|
||||
return errors.New("jet: Invalid scan value '" + enumValue + "' for RiverJobState enum")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e RiverJobState) String() string {
|
||||
return string(e)
|
||||
}
|
||||
90
database/schemas/public/table/medias.go
Normal file
90
database/schemas/public/table/medias.go
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// 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 Medias = newMediasTable("public", "medias", "")
|
||||
|
||||
type mediasTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
Name postgres.ColumnString
|
||||
MimeType postgres.ColumnString
|
||||
Size postgres.ColumnInteger
|
||||
Path postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MediasTable struct {
|
||||
mediasTable
|
||||
|
||||
EXCLUDED mediasTable
|
||||
}
|
||||
|
||||
// AS creates new MediasTable with assigned alias
|
||||
func (a MediasTable) AS(alias string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MediasTable with assigned schema name
|
||||
func (a MediasTable) FromSchema(schemaName string) *MediasTable {
|
||||
return newMediasTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MediasTable with assigned table prefix
|
||||
func (a MediasTable) WithPrefix(prefix string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MediasTable with assigned table suffix
|
||||
func (a MediasTable) WithSuffix(suffix string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMediasTable(schemaName, tableName, alias string) *MediasTable {
|
||||
return &MediasTable{
|
||||
mediasTable: newMediasTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMediasTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
MimeTypeColumn = postgres.StringColumn("mime_type")
|
||||
SizeColumn = postgres.IntegerColumn("size")
|
||||
PathColumn = postgres.StringColumn("path")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn}
|
||||
)
|
||||
|
||||
return mediasTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
Name: NameColumn,
|
||||
MimeType: MimeTypeColumn,
|
||||
Size: SizeColumn,
|
||||
Path: PathColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
84
database/schemas/public/table/migrations.go
Normal file
84
database/schemas/public/table/migrations.go
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// 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 Migrations = newMigrationsTable("public", "migrations", "")
|
||||
|
||||
type migrationsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
VersionID postgres.ColumnInteger
|
||||
IsApplied postgres.ColumnBool
|
||||
Tstamp postgres.ColumnTimestamp
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MigrationsTable struct {
|
||||
migrationsTable
|
||||
|
||||
EXCLUDED migrationsTable
|
||||
}
|
||||
|
||||
// AS creates new MigrationsTable with assigned alias
|
||||
func (a MigrationsTable) AS(alias string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MigrationsTable with assigned schema name
|
||||
func (a MigrationsTable) FromSchema(schemaName string) *MigrationsTable {
|
||||
return newMigrationsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MigrationsTable with assigned table prefix
|
||||
func (a MigrationsTable) WithPrefix(prefix string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MigrationsTable with assigned table suffix
|
||||
func (a MigrationsTable) WithSuffix(suffix string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMigrationsTable(schemaName, tableName, alias string) *MigrationsTable {
|
||||
return &MigrationsTable{
|
||||
migrationsTable: newMigrationsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMigrationsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMigrationsTableImpl(schemaName, tableName, alias string) migrationsTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
VersionIDColumn = postgres.IntegerColumn("version_id")
|
||||
IsAppliedColumn = postgres.BoolColumn("is_applied")
|
||||
TstampColumn = postgres.TimestampColumn("tstamp")
|
||||
allColumns = postgres.ColumnList{IDColumn, VersionIDColumn, IsAppliedColumn, TstampColumn}
|
||||
mutableColumns = postgres.ColumnList{VersionIDColumn, IsAppliedColumn, TstampColumn}
|
||||
)
|
||||
|
||||
return migrationsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
VersionID: VersionIDColumn,
|
||||
IsApplied: IsAppliedColumn,
|
||||
Tstamp: TstampColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
15
database/schemas/public/table/table_use_schema.go
Normal file
15
database/schemas/public/table/table_use_schema.go
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
|
||||
// this method only once at the beginning of the program.
|
||||
func UseSchema(schema string) {
|
||||
Medias = Medias.FromSchema(schema)
|
||||
Migrations = Migrations.FromSchema(schema)
|
||||
}
|
||||
Reference in New Issue
Block a user