model

package
v0.0.0-...-bf8aa72 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShiftStatusActive   = "active"
	ShiftStatusOverride = "override"
)

Enum values for shift_interval are not proper Go identifiers, cannot emit constants Enum values for shift_status

Variables

View Source
var ErrSyncFail = errors.New("model: 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 ScheduleColumns = struct {
	ID             string
	SlackChannelID string
	TeamSlackID    string
	Name           string
	Interval       string
	IsEnabled      string
	EndTime        string
	StartTime      string
	WeekdaysOnly   string
	CreatedAt      string
	UpdatedAt      string
}{
	ID:             "id",
	SlackChannelID: "slack_channel_id",
	TeamSlackID:    "team_slack_id",
	Name:           "name",
	Interval:       "interval",
	IsEnabled:      "is_enabled",
	EndTime:        "end_time",
	StartTime:      "start_time",
	WeekdaysOnly:   "weekdays_only",
	CreatedAt:      "created_at",
	UpdatedAt:      "updated_at",
}
View Source
var ScheduleRels = struct {
	Shifts string
}{
	Shifts: "Shifts",
}

ScheduleRels is where relationship names are stored.

View Source
var ScheduleWhere = struct {
	ID             whereHelperint
	SlackChannelID whereHelperstring
	TeamSlackID    whereHelperstring
	Name           whereHelperstring
	Interval       whereHelperstring
	IsEnabled      whereHelperbool
	EndTime        whereHelpertime_Time
	StartTime      whereHelpertime_Time
	WeekdaysOnly   whereHelperbool
	CreatedAt      whereHelpertime_Time
	UpdatedAt      whereHelpertime_Time
}{
	ID:             whereHelperint{/* contains filtered or unexported fields */},
	SlackChannelID: whereHelperstring{/* contains filtered or unexported fields */},
	TeamSlackID:    whereHelperstring{/* contains filtered or unexported fields */},
	Name:           whereHelperstring{/* contains filtered or unexported fields */},
	Interval:       whereHelperstring{/* contains filtered or unexported fields */},
	IsEnabled:      whereHelperbool{/* contains filtered or unexported fields */},
	EndTime:        whereHelpertime_Time{/* contains filtered or unexported fields */},
	StartTime:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	WeekdaysOnly:   whereHelperbool{/* contains filtered or unexported fields */},
	CreatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:      whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ShiftColumns = struct {
	SequenceID string
	UserID     string
	ScheduleID string
	Status     string
	StartedAt  string
	CreatedAt  string
	UpdatedAt  string
}{
	SequenceID: "sequence_id",
	UserID:     "user_id",
	ScheduleID: "schedule_id",
	Status:     "status",
	StartedAt:  "started_at",
	CreatedAt:  "created_at",
	UpdatedAt:  "updated_at",
}
View Source
var ShiftRels = struct {
	Schedule string
	User     string
}{
	Schedule: "Schedule",
	User:     "User",
}

ShiftRels is where relationship names are stored.

View Source
var ShiftWhere = struct {
	SequenceID whereHelperint
	UserID     whereHelperint
	ScheduleID whereHelperint
	Status     whereHelpernull_String
	StartedAt  whereHelpernull_Time
	CreatedAt  whereHelpertime_Time
	UpdatedAt  whereHelpertime_Time
}{
	SequenceID: whereHelperint{/* contains filtered or unexported fields */},
	UserID:     whereHelperint{/* contains filtered or unexported fields */},
	ScheduleID: whereHelperint{/* contains filtered or unexported fields */},
	Status:     whereHelpernull_String{/* contains filtered or unexported fields */},
	StartedAt:  whereHelpernull_Time{/* contains filtered or unexported fields */},
	CreatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:  whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var TableNames = struct {
	Schedules string
	Shifts    string
	Users     string
}{
	Schedules: "schedules",
	Shifts:    "shifts",
	Users:     "users",
}
View Source
var UserColumns = struct {
	ID          string
	SlackID     string
	SlackHandle string
	Email       string
	FirstName   string
	LastName    string
	AvatarURL   string
	DisplayName string
	CreatedAt   string
	UpdatedAt   string
	DeletedAt   string
}{
	ID:          "id",
	SlackID:     "slack_id",
	SlackHandle: "slack_handle",
	Email:       "email",
	FirstName:   "first_name",
	LastName:    "last_name",
	AvatarURL:   "avatar_url",
	DisplayName: "display_name",
	CreatedAt:   "created_at",
	UpdatedAt:   "updated_at",
	DeletedAt:   "deleted_at",
}
View Source
var UserRels = struct {
	Shifts string
}{
	Shifts: "Shifts",
}

UserRels is where relationship names are stored.

View Source
var UserWhere = struct {
	ID          whereHelperint
	SlackID     whereHelperstring
	SlackHandle whereHelperstring
	Email       whereHelperstring
	FirstName   whereHelperstring
	LastName    whereHelperstring
	AvatarURL   whereHelperstring
	DisplayName whereHelperstring
	CreatedAt   whereHelpertime_Time
	UpdatedAt   whereHelpertime_Time
	DeletedAt   whereHelpernull_Time
}{
	ID:          whereHelperint{/* contains filtered or unexported fields */},
	SlackID:     whereHelperstring{/* contains filtered or unexported fields */},
	SlackHandle: whereHelperstring{/* contains filtered or unexported fields */},
	Email:       whereHelperstring{/* contains filtered or unexported fields */},
	FirstName:   whereHelperstring{/* contains filtered or unexported fields */},
	LastName:    whereHelperstring{/* contains filtered or unexported fields */},
	AvatarURL:   whereHelperstring{/* contains filtered or unexported fields */},
	DisplayName: whereHelperstring{/* 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 NewQuery

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

NewQuery initializes a new Query using the passed in QueryMods

func ScheduleExists

func ScheduleExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

ScheduleExists checks if the Schedule row exists.

func Schedules

func Schedules(mods ...qm.QueryMod) scheduleQuery

Schedules retrieves all the records using an executor.

func ShiftExists

func ShiftExists(ctx context.Context, exec boil.ContextExecutor, userID int, scheduleID int) (bool, error)

ShiftExists checks if the Shift row exists.

func Shifts

func Shifts(mods ...qm.QueryMod) shiftQuery

Shifts retrieves all the records using an executor.

func UserExists

func UserExists(ctx context.Context, exec boil.ContextExecutor, iD int) (bool, error)

UserExists checks if the User row exists.

func Users

func Users(mods ...qm.QueryMod) userQuery

Users retrieves all the records using an executor.

Types

type M

type M map[string]interface{}

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

type Schedule

type Schedule struct {
	ID             int       `db:"id" boil:"id" json:"id" toml:"id" yaml:"id"`
	SlackChannelID string    `db:"slack_channel_id" boil:"slack_channel_id" json:"slack_channel_id" toml:"slack_channel_id" yaml:"slack_channel_id"`
	TeamSlackID    string    `db:"team_slack_id" boil:"team_slack_id" json:"team_slack_id" toml:"team_slack_id" yaml:"team_slack_id"`
	Name           string    `db:"name" boil:"name" json:"name" toml:"name" yaml:"name"`
	Interval       string    `db:"interval" boil:"interval" json:"interval" toml:"interval" yaml:"interval"`
	IsEnabled      bool      `db:"is_enabled" boil:"is_enabled" json:"is_enabled" toml:"is_enabled" yaml:"is_enabled"`
	EndTime        time.Time `db:"end_time" boil:"end_time" json:"end_time" toml:"end_time" yaml:"end_time"`
	StartTime      time.Time `db:"start_time" boil:"start_time" json:"start_time" toml:"start_time" yaml:"start_time"`
	WeekdaysOnly   bool      `db:"weekdays_only" boil:"weekdays_only" json:"weekdays_only" toml:"weekdays_only" yaml:"weekdays_only"`
	CreatedAt      time.Time `db:"created_at" boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt      time.Time `db:"updated_at" boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`

	R *scheduleR `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
	L scheduleL  `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
}

Schedule is an object representing the database table.

func FindSchedule

func FindSchedule(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*Schedule, error)

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

func (*Schedule) AddShifts

func (o *Schedule) AddShifts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Shift) error

AddShifts adds the given related objects to the existing relationships of the schedule, optionally inserting them as new records. Appends related to o.R.Shifts. Sets related.R.Schedule appropriately.

func (*Schedule) Delete

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

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

func (*Schedule) Insert

func (o *Schedule) 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 (*Schedule) Reload

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

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

func (*Schedule) Shifts

func (o *Schedule) Shifts(mods ...qm.QueryMod) shiftQuery

Shifts retrieves all the shift's Shifts with an executor.

func (*Schedule) Update

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

Update uses an executor to update the Schedule. 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 (*Schedule) Upsert

func (o *Schedule) 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 ScheduleSlice

type ScheduleSlice []*Schedule

ScheduleSlice is an alias for a slice of pointers to Schedule. This should generally be used opposed to []Schedule.

func (ScheduleSlice) DeleteAll

func (o ScheduleSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (*ScheduleSlice) ReloadAll

func (o *ScheduleSlice) 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 (ScheduleSlice) UpdateAll

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

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

type Shift

type Shift struct {
	SequenceID int         `db:"sequence_id" boil:"sequence_id" json:"sequence_id" toml:"sequence_id" yaml:"sequence_id"`
	UserID     int         `db:"user_id" boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	ScheduleID int         `db:"schedule_id" boil:"schedule_id" json:"schedule_id" toml:"schedule_id" yaml:"schedule_id"`
	Status     null.String `db:"status" boil:"status" json:"status,omitempty" toml:"status" yaml:"status,omitempty"`
	StartedAt  null.Time   `db:"started_at" boil:"started_at" json:"started_at,omitempty" toml:"started_at" yaml:"started_at,omitempty"`
	CreatedAt  time.Time   `db:"created_at" boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt  time.Time   `db:"updated_at" boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`

	R *shiftR `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
	L shiftL  `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
}

Shift is an object representing the database table.

func FindShift

func FindShift(ctx context.Context, exec boil.ContextExecutor, userID int, scheduleID int, selectCols ...string) (*Shift, error)

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

func (*Shift) Delete

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

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

func (*Shift) Insert

func (o *Shift) 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 (*Shift) Reload

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

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

func (*Shift) Schedule

func (o *Shift) Schedule(mods ...qm.QueryMod) scheduleQuery

Schedule pointed to by the foreign key.

func (*Shift) SetSchedule

func (o *Shift) SetSchedule(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Schedule) error

SetSchedule of the shift to the related item. Sets o.R.Schedule to related. Adds o to related.R.Shifts.

func (*Shift) SetUser

func (o *Shift) SetUser(ctx context.Context, exec boil.ContextExecutor, insert bool, related *User) error

SetUser of the shift to the related item. Sets o.R.User to related. Adds o to related.R.Shifts.

func (*Shift) Update

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

Update uses an executor to update the Shift. 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 (*Shift) Upsert

func (o *Shift) 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 (*Shift) User

func (o *Shift) User(mods ...qm.QueryMod) userQuery

User pointed to by the foreign key.

type ShiftSlice

type ShiftSlice []*Shift

ShiftSlice is an alias for a slice of pointers to Shift. This should generally be used opposed to []Shift.

func (ShiftSlice) DeleteAll

func (o ShiftSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (*ShiftSlice) ReloadAll

func (o *ShiftSlice) 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 (ShiftSlice) UpdateAll

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

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

type User

type User struct {
	ID          int       `db:"id" boil:"id" json:"id" toml:"id" yaml:"id"`
	SlackID     string    `db:"slack_id" boil:"slack_id" json:"slack_id" toml:"slack_id" yaml:"slack_id"`
	SlackHandle string    `db:"slack_handle" boil:"slack_handle" json:"slack_handle" toml:"slack_handle" yaml:"slack_handle"`
	Email       string    `db:"email" boil:"email" json:"email" toml:"email" yaml:"email"`
	FirstName   string    `db:"first_name" boil:"first_name" json:"first_name" toml:"first_name" yaml:"first_name"`
	LastName    string    `db:"last_name" boil:"last_name" json:"last_name" toml:"last_name" yaml:"last_name"`
	AvatarURL   string    `db:"avatar_url" boil:"avatar_url" json:"avatar_url" toml:"avatar_url" yaml:"avatar_url"`
	DisplayName string    `db:"display_name" boil:"display_name" json:"display_name" toml:"display_name" yaml:"display_name"`
	CreatedAt   time.Time `db:"created_at" boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" boil:"updated_at" json:"updated_at" toml:"updated_at" yaml:"updated_at"`
	DeletedAt   null.Time `db:"deleted_at" boil:"deleted_at" json:"deleted_at,omitempty" toml:"deleted_at" yaml:"deleted_at,omitempty"`

	R *userR `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
	L userL  `db:"-" boil:"-" json:"-" toml:"-" yaml:"-"`
}

User is an object representing the database table.

func FindUser

func FindUser(ctx context.Context, exec boil.ContextExecutor, iD int, selectCols ...string) (*User, error)

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

func (*User) AddShifts

func (o *User) AddShifts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Shift) error

AddShifts adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.Shifts. Sets related.R.User appropriately.

func (*User) Delete

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

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

func (*User) Insert

func (o *User) 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 (*User) Reload

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

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

func (*User) Shifts

func (o *User) Shifts(mods ...qm.QueryMod) shiftQuery

Shifts retrieves all the shift's Shifts with an executor.

func (*User) Update

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

Update uses an executor to update the User. 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 (*User) Upsert

func (o *User) 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 UserSlice

type UserSlice []*User

UserSlice is an alias for a slice of pointers to User. This should generally be used opposed to []User.

func (UserSlice) DeleteAll

func (o UserSlice) DeleteAll(ctx context.Context, exec boil.ContextExecutor) (int64, error)

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

func (*UserSlice) ReloadAll

func (o *UserSlice) 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 (UserSlice) UpdateAll

func (o UserSlice) 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