dbmodels

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSyncFail = errors.New("dbmodels: failed to synchronize data after insert")

ErrSyncFail occurs during insert when the record could not be retrieved in order to populate default value information. This usually happens when LastInsertId fails or there was a primary key configuration that was not resolvable.

View Source
var EventColumns = struct {
	ID         string
	Info       string
	Starts     string
	Ends       string
	InstanceID string
	OwnerID    string
	CreatedAt  string
	UpdatedAt  string
	DeletedAt  string
}{
	ID:         "id",
	Info:       "info",
	Starts:     "starts",
	Ends:       "ends",
	InstanceID: "instance_id",
	OwnerID:    "owner_id",
	CreatedAt:  "created_at",
	UpdatedAt:  "updated_at",
	DeletedAt:  "deleted_at",
}
View Source
var EventRels = struct {
	Workshops string
}{
	Workshops: "Workshops",
}

EventRels is where relationship names are stored.

View Source
var EventTableColumns = struct {
	ID         string
	Info       string
	Starts     string
	Ends       string
	InstanceID string
	OwnerID    string
	CreatedAt  string
	UpdatedAt  string
	DeletedAt  string
}{
	ID:         "events.id",
	Info:       "events.info",
	Starts:     "events.starts",
	Ends:       "events.ends",
	InstanceID: "events.instance_id",
	OwnerID:    "events.owner_id",
	CreatedAt:  "events.created_at",
	UpdatedAt:  "events.updated_at",
	DeletedAt:  "events.deleted_at",
}
View Source
var EventWhere = struct {
	ID         whereHelperstring
	Info       whereHelpertypes_JSON
	Starts     whereHelpertime_Time
	Ends       whereHelpernull_Time
	InstanceID whereHelperstring
	OwnerID    whereHelpernull_String
	CreatedAt  whereHelpertime_Time
	UpdatedAt  whereHelpertime_Time
	DeletedAt  whereHelpernull_Time
}{
	ID:         whereHelperstring{/* contains filtered or unexported fields */},
	Info:       whereHelpertypes_JSON{/* contains filtered or unexported fields */},
	Starts:     whereHelpertime_Time{/* contains filtered or unexported fields */},
	Ends:       whereHelpernull_Time{/* contains filtered or unexported fields */},
	InstanceID: whereHelperstring{/* contains filtered or unexported fields */},
	OwnerID:    whereHelpernull_String{/* contains filtered or unexported fields */},
	CreatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	DeletedAt:  whereHelpernull_Time{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Events    string
	Workshops string
}{
	Events:    "events",
	Workshops: "workshops",
}
View Source
var WorkshopColumns = struct {
	ID           string
	Info         string
	Starts       string
	Ends         string
	EventID      string
	Participants string
	CreatedAt    string
	UpdatedAt    string
	DeletedAt    string
}{
	ID:           "id",
	Info:         "info",
	Starts:       "starts",
	Ends:         "ends",
	EventID:      "event_id",
	Participants: "participants",
	CreatedAt:    "created_at",
	UpdatedAt:    "updated_at",
	DeletedAt:    "deleted_at",
}
View Source
var WorkshopRels = struct {
	Event string
}{
	Event: "Event",
}

WorkshopRels is where relationship names are stored.

View Source
var WorkshopTableColumns = struct {
	ID           string
	Info         string
	Starts       string
	Ends         string
	EventID      string
	Participants string
	CreatedAt    string
	UpdatedAt    string
	DeletedAt    string
}{
	ID:           "workshops.id",
	Info:         "workshops.info",
	Starts:       "workshops.starts",
	Ends:         "workshops.ends",
	EventID:      "workshops.event_id",
	Participants: "workshops.participants",
	CreatedAt:    "workshops.created_at",
	UpdatedAt:    "workshops.updated_at",
	DeletedAt:    "workshops.deleted_at",
}
View Source
var WorkshopWhere = struct {
	ID           whereHelperstring
	Info         whereHelpertypes_JSON
	Starts       whereHelpertime_Time
	Ends         whereHelpernull_Time
	EventID      whereHelperstring
	Participants whereHelpertypes_JSON
	CreatedAt    whereHelpertime_Time
	UpdatedAt    whereHelpertime_Time
	DeletedAt    whereHelpernull_Time
}{
	ID:           whereHelperstring{/* contains filtered or unexported fields */},
	Info:         whereHelpertypes_JSON{/* contains filtered or unexported fields */},
	Starts:       whereHelpertime_Time{/* contains filtered or unexported fields */},
	Ends:         whereHelpernull_Time{/* contains filtered or unexported fields */},
	EventID:      whereHelperstring{/* contains filtered or unexported fields */},
	Participants: whereHelpertypes_JSON{/* contains filtered or unexported fields */},
	CreatedAt:    whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:    whereHelpertime_Time{/* contains filtered or unexported fields */},
	DeletedAt:    whereHelpernull_Time{/* contains filtered or unexported fields */},
}

Functions

func AddEventHook

func AddEventHook(hookPoint boil.HookPoint, eventHook EventHook)

AddEventHook registers your hook function for all future operations.

func AddWorkshopHook

func AddWorkshopHook(hookPoint boil.HookPoint, workshopHook WorkshopHook)

AddWorkshopHook registers your hook function for all future operations.

func EventExists

func EventExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

EventExists checks if the Event row exists.

func Events

func Events(mods ...qm.QueryMod) eventQuery

Events retrieves all the records using an executor.

func NewQuery

func NewQuery(mods ...qm.QueryMod) *queries.Query

NewQuery initializes a new Query using the passed in QueryMods

func WorkshopExists

func WorkshopExists(ctx context.Context, exec boil.ContextExecutor, iD string) (bool, error)

WorkshopExists checks if the Workshop row exists.

func Workshops

func Workshops(mods ...qm.QueryMod) workshopQuery

Workshops retrieves all the records using an executor.

Types

type Event

type Event struct {
	ID         string      `boil:"id" json:"id" toml:"id" yaml:"id"`
	Info       types.JSON  `boil:"info" json:"info" toml:"info" yaml:"info"`
	Starts     time.Time   `boil:"starts" json:"starts" toml:"starts" yaml:"starts"`
	Ends       null.Time   `boil:"ends" json:"ends,omitempty" toml:"ends" yaml:"ends,omitempty"`
	InstanceID string      `boil:"instance_id" json:"instance_id" toml:"instance_id" yaml:"instance_id"`
	OwnerID    null.String `boil:"owner_id" json:"owner_id,omitempty" toml:"owner_id" yaml:"owner_id,omitempty"`
	CreatedAt  time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt  time.Time   `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
	DeletedAt  null.Time   `boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`

	R *eventR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L eventL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Event is an object representing the database table.

func FindEvent

func FindEvent(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Event, error)

FindEvent retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.

func (*Event) AddWorkshops

func (o *Event) AddWorkshops(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Workshop) error

AddWorkshops adds the given related objects to the existing relationships of the event, optionally inserting them as new records. Appends related to o.R.Workshops. Sets related.R.Event appropriately.

func (*Event) Delete

func (o *Event) Delete(ctx context.Context, exec boil.ContextExecutor, hardDelete bool) (int64, error)

Delete deletes a single Event record with an executor. Delete will match against the primary key column to find the record to delete.

func (*Event) Insert

func (o *Event) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*Event) Reload

func (o *Event) Reload(ctx context.Context, exec boil.ContextExecutor) error

Reload refetches the object from the database using the primary keys with an executor.

func (*Event) Update

func (o *Event) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)

Update uses an executor to update the Event. See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*Event) Upsert

func (o *Event) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict. See boil.Columns documentation for how to properly use updateColumns and insertColumns.

func (*Event) Workshops

func (o *Event) Workshops(mods ...qm.QueryMod) workshopQuery

Workshops retrieves all the workshop's Workshops with an executor.

type EventHook

type EventHook func(context.Context, boil.ContextExecutor, *Event) error

EventHook is the signature for custom Event hook methods

type EventSlice

type EventSlice []*Event

EventSlice is an alias for a slice of pointers to Event. This should almost always be used instead of []Event.

func (EventSlice) DeleteAll

func (o EventSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor, hardDelete bool) (int64, error)

DeleteAll deletes all rows in the slice, using an executor.

func (*EventSlice) ReloadAll

func (o *EventSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (EventSlice) UpdateAll

func (o EventSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)

UpdateAll updates all rows with the specified column values, using an executor.

type M

type M map[string]interface{}

M type is for providing columns and column values to UpdateAll.

type Workshop

type Workshop struct {
	ID           string     `boil:"id" json:"id" toml:"id" yaml:"id"`
	Info         types.JSON `boil:"info" json:"info" toml:"info" yaml:"info"`
	Starts       time.Time  `boil:"starts" json:"starts" toml:"starts" yaml:"starts"`
	Ends         null.Time  `boil:"ends" json:"ends,omitempty" toml:"ends" yaml:"ends,omitempty"`
	EventID      string     `boil:"event_id" json:"event_id" toml:"event_id" yaml:"event_id"`
	Participants types.JSON `boil:"participants" json:"participants" toml:"participants" yaml:"participants"`
	CreatedAt    time.Time  `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt    time.Time  `boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
	DeletedAt    null.Time  `boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`

	R *workshopR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L workshopL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Workshop is an object representing the database table.

func FindWorkshop

func FindWorkshop(ctx context.Context, exec boil.ContextExecutor, iD string, selectCols ...string) (*Workshop, error)

FindWorkshop retrieves a single record by ID with an executor. If selectCols is empty Find will return all columns.

func (*Workshop) Delete

func (o *Workshop) Delete(ctx context.Context, exec boil.ContextExecutor, hardDelete bool) (int64, error)

Delete deletes a single Workshop record with an executor. Delete will match against the primary key column to find the record to delete.

func (*Workshop) Event

func (o *Workshop) Event(mods ...qm.QueryMod) eventQuery

Event pointed to by the foreign key.

func (*Workshop) Insert

func (o *Workshop) Insert(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) error

Insert a single record using an executor. See boil.Columns.InsertColumnSet documentation to understand column list inference for inserts.

func (*Workshop) Reload

func (o *Workshop) Reload(ctx context.Context, exec boil.ContextExecutor) error

Reload refetches the object from the database using the primary keys with an executor.

func (*Workshop) SetEvent

func (o *Workshop) SetEvent(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Event) error

SetEvent of the workshop to the related item. Sets o.R.Event to related. Adds o to related.R.Workshops.

func (*Workshop) Update

func (o *Workshop) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error)

Update uses an executor to update the Workshop. See boil.Columns.UpdateColumnSet documentation to understand column list inference for updates. Update does not automatically update the record in case of default values. Use .Reload() to refresh the records.

func (*Workshop) Upsert

func (o *Workshop) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error

Upsert attempts an insert using an executor, and does an update or ignore on conflict. See boil.Columns documentation for how to properly use updateColumns and insertColumns.

type WorkshopHook

type WorkshopHook func(context.Context, boil.ContextExecutor, *Workshop) error

WorkshopHook is the signature for custom Workshop hook methods

type WorkshopSlice

type WorkshopSlice []*Workshop

WorkshopSlice is an alias for a slice of pointers to Workshop. This should almost always be used instead of []Workshop.

func (WorkshopSlice) DeleteAll

func (o WorkshopSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor, hardDelete bool) (int64, error)

DeleteAll deletes all rows in the slice, using an executor.

func (*WorkshopSlice) ReloadAll

func (o *WorkshopSlice) ReloadAll(ctx context.Context, exec boil.ContextExecutor) error

ReloadAll refetches every row with matching primary key column values and overwrites the original object slice with the newly updated slice.

func (WorkshopSlice) UpdateAll

func (o WorkshopSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error)

UpdateAll updates all rows with the specified column values, using an executor.

Jump to

Keyboard shortcuts

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