orm

package
v0.0.0-...-d552a0f Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CategoryColumns = struct {
	CategoryID  string
	Description string
}{
	CategoryID:  "category_id",
	Description: "description",
}
View Source
var CategoryRels = struct {
	Products string
}{
	Products: "Products",
}

CategoryRels is where relationship names are stored.

View Source
var CategoryTableColumns = struct {
	CategoryID  string
	Description string
}{
	CategoryID:  "categories.category_id",
	Description: "categories.description",
}
View Source
var CategoryWhere = struct {
	CategoryID  whereHelperint64
	Description whereHelperstring
}{
	CategoryID:  whereHelperint64{/* contains filtered or unexported fields */},
	Description: whereHelperstring{/* contains filtered or unexported fields */},
}
View Source
var ErrSyncFail = errors.New("orm: 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 OrderColumns = struct {
	OrderID         string
	UserID          string
	TotalAmount     string
	ShippingAddress string
	Status          string
	CreatedAt       string
	UpdatedAt       string
}{
	OrderID:         "order_id",
	UserID:          "user_id",
	TotalAmount:     "total_amount",
	ShippingAddress: "shipping_address",
	Status:          "status",
	CreatedAt:       "created_at",
	UpdatedAt:       "updated_at",
}
View Source
var OrderItemColumns = struct {
	OrderID   string
	ProductID string
	Quantity  string
}{
	OrderID:   "order_id",
	ProductID: "product_id",
	Quantity:  "quantity",
}
View Source
var OrderItemRels = struct {
	Order   string
	Product string
}{
	Order:   "Order",
	Product: "Product",
}

OrderItemRels is where relationship names are stored.

View Source
var OrderItemTableColumns = struct {
	OrderID   string
	ProductID string
	Quantity  string
}{
	OrderID:   "order_items.order_id",
	ProductID: "order_items.product_id",
	Quantity:  "order_items.quantity",
}
View Source
var OrderItemWhere = struct {
	OrderID   whereHelperstring
	ProductID whereHelperstring
	Quantity  whereHelperint64
}{
	OrderID:   whereHelperstring{/* contains filtered or unexported fields */},
	ProductID: whereHelperstring{/* contains filtered or unexported fields */},
	Quantity:  whereHelperint64{/* contains filtered or unexported fields */},
}
View Source
var OrderRels = struct {
	User       string
	OrderItems string
}{
	User:       "User",
	OrderItems: "OrderItems",
}

OrderRels is where relationship names are stored.

View Source
var OrderTableColumns = struct {
	OrderID         string
	UserID          string
	TotalAmount     string
	ShippingAddress string
	Status          string
	CreatedAt       string
	UpdatedAt       string
}{
	OrderID:         "orders.order_id",
	UserID:          "orders.user_id",
	TotalAmount:     "orders.total_amount",
	ShippingAddress: "orders.shipping_address",
	Status:          "orders.status",
	CreatedAt:       "orders.created_at",
	UpdatedAt:       "orders.updated_at",
}
View Source
var OrderWhere = struct {
	OrderID         whereHelperstring
	UserID          whereHelperstring
	TotalAmount     whereHelperint64
	ShippingAddress whereHelperstring
	Status          whereHelperStatus
	CreatedAt       whereHelpertime_Time
	UpdatedAt       whereHelpertime_Time
}{
	OrderID:         whereHelperstring{/* contains filtered or unexported fields */},
	UserID:          whereHelperstring{/* contains filtered or unexported fields */},
	TotalAmount:     whereHelperint64{/* contains filtered or unexported fields */},
	ShippingAddress: whereHelperstring{/* contains filtered or unexported fields */},
	Status:          whereHelperStatus{/* contains filtered or unexported fields */},
	CreatedAt:       whereHelpertime_Time{/* contains filtered or unexported fields */},
	UpdatedAt:       whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ProductColumns = struct {
	ProductID   string
	Name        string
	Description string
	Price       string
	Stock       string
	CategoryID  string
	CreatedAt   string
	UpdatedAt   string
}{
	ProductID:   "product_id",
	Name:        "name",
	Description: "description",
	Price:       "price",
	Stock:       "stock",
	CategoryID:  "category_id",
	CreatedAt:   "created_at",
	UpdatedAt:   "updated_at",
}
View Source
var ProductRels = struct {
	Category   string
	OrderItems string
}{
	Category:   "Category",
	OrderItems: "OrderItems",
}

ProductRels is where relationship names are stored.

View Source
var ProductTableColumns = struct {
	ProductID   string
	Name        string
	Description string
	Price       string
	Stock       string
	CategoryID  string
	CreatedAt   string
	UpdatedAt   string
}{
	ProductID:   "products.product_id",
	Name:        "products.name",
	Description: "products.description",
	Price:       "products.price",
	Stock:       "products.stock",
	CategoryID:  "products.category_id",
	CreatedAt:   "products.created_at",
	UpdatedAt:   "products.updated_at",
}
View Source
var ProductWhere = struct {
	ProductID   whereHelperstring
	Name        whereHelperstring
	Description whereHelperstring
	Price       whereHelperfloat32
	Stock       whereHelperint64
	CategoryID  whereHelperint64
	CreatedAt   whereHelpertime_Time
	UpdatedAt   whereHelpertime_Time
}{
	ProductID:   whereHelperstring{/* contains filtered or unexported fields */},
	Name:        whereHelperstring{/* contains filtered or unexported fields */},
	Description: whereHelperstring{/* contains filtered or unexported fields */},
	Price:       whereHelperfloat32{/* contains filtered or unexported fields */},
	Stock:       whereHelperint64{/* contains filtered or unexported fields */},
	CategoryID:  whereHelperint64{/* 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 {
	Categories string
	OrderItems string
	Orders     string
	Products   string
	Users      string
}{
	Categories: "categories",
	OrderItems: "order_items",
	Orders:     "orders",
	Products:   "products",
	Users:      "users",
}
View Source
var UserColumns = struct {
	UserID       string
	Username     string
	Email        string
	PasswordHash string
	CreatedAt    string
}{
	UserID:       "user_id",
	Username:     "username",
	Email:        "email",
	PasswordHash: "password_hash",
	CreatedAt:    "created_at",
}
View Source
var UserRels = struct {
	Orders string
}{
	Orders: "Orders",
}

UserRels is where relationship names are stored.

View Source
var UserTableColumns = struct {
	UserID       string
	Username     string
	Email        string
	PasswordHash string
	CreatedAt    string
}{
	UserID:       "users.user_id",
	Username:     "users.username",
	Email:        "users.email",
	PasswordHash: "users.password_hash",
	CreatedAt:    "users.created_at",
}
View Source
var UserWhere = struct {
	UserID       whereHelperstring
	Username     whereHelperstring
	Email        whereHelperstring
	PasswordHash whereHelperstring
	CreatedAt    whereHelpertime_Time
}{
	UserID:       whereHelperstring{/* contains filtered or unexported fields */},
	Username:     whereHelperstring{/* contains filtered or unexported fields */},
	Email:        whereHelperstring{/* contains filtered or unexported fields */},
	PasswordHash: whereHelperstring{/* contains filtered or unexported fields */},
	CreatedAt:    whereHelpertime_Time{/* contains filtered or unexported fields */},
}
View Source
var ViewNames = struct {
}{}

Functions

func AddCategoryHook

func AddCategoryHook(hookPoint boil.HookPoint, categoryHook CategoryHook)

AddCategoryHook registers your hook function for all future operations.

func AddOrderHook

func AddOrderHook(hookPoint boil.HookPoint, orderHook OrderHook)

AddOrderHook registers your hook function for all future operations.

func AddOrderItemHook

func AddOrderItemHook(hookPoint boil.HookPoint, orderItemHook OrderItemHook)

AddOrderItemHook registers your hook function for all future operations.

func AddProductHook

func AddProductHook(hookPoint boil.HookPoint, productHook ProductHook)

AddProductHook registers your hook function for all future operations.

func AddUserHook

func AddUserHook(hookPoint boil.HookPoint, userHook UserHook)

AddUserHook registers your hook function for all future operations.

func Categories

func Categories(mods ...qm.QueryMod) categoryQuery

Categories retrieves all the records using an executor.

func CategoryExists

func CategoryExists(ctx context.Context, exec boil.ContextExecutor, categoryID int64) (bool, error)

CategoryExists checks if the Category row exists.

func NewQuery

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

NewQuery initializes a new Query using the passed in QueryMods

func OrderExists

func OrderExists(ctx context.Context, exec boil.ContextExecutor, orderID string) (bool, error)

OrderExists checks if the Order row exists.

func OrderItemExists

func OrderItemExists(ctx context.Context, exec boil.ContextExecutor, orderID string, productID string) (bool, error)

OrderItemExists checks if the OrderItem row exists.

func OrderItems

func OrderItems(mods ...qm.QueryMod) orderItemQuery

OrderItems retrieves all the records using an executor.

func Orders

func Orders(mods ...qm.QueryMod) orderQuery

Orders retrieves all the records using an executor.

func ProductExists

func ProductExists(ctx context.Context, exec boil.ContextExecutor, productID string) (bool, error)

ProductExists checks if the Product row exists.

func Products

func Products(mods ...qm.QueryMod) productQuery

Products retrieves all the records using an executor.

func UserExists

func UserExists(ctx context.Context, exec boil.ContextExecutor, userID string) (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 Category

type Category struct {
	CategoryID  int64  `boil:"category_id" json:"category_id" toml:"category_id" yaml:"category_id"`
	Description string `boil:"description" json:"description" toml:"description" yaml:"description"`

	R *categoryR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L categoryL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Category is an object representing the database table.

func FindCategory

func FindCategory(ctx context.Context, exec boil.ContextExecutor, categoryID int64, selectCols ...string) (*Category, error)

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

func (*Category) AddProducts

func (o *Category) AddProducts(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*Product) error

AddProducts adds the given related objects to the existing relationships of the category, optionally inserting them as new records. Appends related to o.R.Products. Sets related.R.Category appropriately.

func (*Category) Delete

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

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

func (*Category) Exists

func (o *Category) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error)

Exists checks if the Category row exists.

func (*Category) Insert

func (o *Category) 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 (*Category) Products

func (o *Category) Products(mods ...qm.QueryMod) productQuery

Products retrieves all the product's Products with an executor.

func (*Category) Reload

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

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

func (*Category) Update

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

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

func (o *Category) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 CategoryHook

type CategoryHook func(context.Context, boil.ContextExecutor, *Category) error

CategoryHook is the signature for custom Category hook methods

type CategorySlice

type CategorySlice []*Category

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

func (CategorySlice) DeleteAll

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

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

func (*CategorySlice) ReloadAll

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

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

type Order struct {
	OrderID         string    `boil:"order_id" json:"order_id" toml:"order_id" yaml:"order_id"`
	UserID          string    `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	TotalAmount     int64     `boil:"total_amount" json:"total_amount" toml:"total_amount" yaml:"total_amount"`
	ShippingAddress string    `boil:"shipping_address" json:"shipping_address" toml:"shipping_address" yaml:"shipping_address"`
	Status          Status    `boil:"status" json:"status" toml:"status" yaml:"status"`
	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"`

	R *orderR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L orderL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Order is an object representing the database table.

func FindOrder

func FindOrder(ctx context.Context, exec boil.ContextExecutor, orderID string, selectCols ...string) (*Order, error)

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

func (*Order) AddOrderItems

func (o *Order) AddOrderItems(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OrderItem) error

AddOrderItems adds the given related objects to the existing relationships of the order, optionally inserting them as new records. Appends related to o.R.OrderItems. Sets related.R.Order appropriately.

func (*Order) Delete

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

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

func (*Order) Exists

func (o *Order) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error)

Exists checks if the Order row exists.

func (*Order) Insert

func (o *Order) 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 (*Order) OrderItems

func (o *Order) OrderItems(mods ...qm.QueryMod) orderItemQuery

OrderItems retrieves all the order_item's OrderItems with an executor.

func (*Order) Reload

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

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

func (*Order) SetUser

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

SetUser of the order to the related item. Sets o.R.User to related. Adds o to related.R.Orders.

func (*Order) Update

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

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

func (o *Order) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 (*Order) User

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

User pointed to by the foreign key.

type OrderHook

type OrderHook func(context.Context, boil.ContextExecutor, *Order) error

OrderHook is the signature for custom Order hook methods

type OrderItem

type OrderItem struct {
	OrderID   string `boil:"order_id" json:"order_id" toml:"order_id" yaml:"order_id"`
	ProductID string `boil:"product_id" json:"product_id" toml:"product_id" yaml:"product_id"`
	Quantity  int64  `boil:"quantity" json:"quantity" toml:"quantity" yaml:"quantity"`

	R *orderItemR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L orderItemL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

OrderItem is an object representing the database table.

func FindOrderItem

func FindOrderItem(ctx context.Context, exec boil.ContextExecutor, orderID string, productID string, selectCols ...string) (*OrderItem, error)

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

func (*OrderItem) Delete

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

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

func (*OrderItem) Exists

func (o *OrderItem) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error)

Exists checks if the OrderItem row exists.

func (*OrderItem) Insert

func (o *OrderItem) 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 (*OrderItem) Order

func (o *OrderItem) Order(mods ...qm.QueryMod) orderQuery

Order pointed to by the foreign key.

func (*OrderItem) Product

func (o *OrderItem) Product(mods ...qm.QueryMod) productQuery

Product pointed to by the foreign key.

func (*OrderItem) Reload

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

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

func (*OrderItem) SetOrder

func (o *OrderItem) SetOrder(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Order) error

SetOrder of the orderItem to the related item. Sets o.R.Order to related. Adds o to related.R.OrderItems.

func (*OrderItem) SetProduct

func (o *OrderItem) SetProduct(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Product) error

SetProduct of the orderItem to the related item. Sets o.R.Product to related. Adds o to related.R.OrderItems.

func (*OrderItem) Update

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

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

func (o *OrderItem) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 OrderItemHook

type OrderItemHook func(context.Context, boil.ContextExecutor, *OrderItem) error

OrderItemHook is the signature for custom OrderItem hook methods

type OrderItemSlice

type OrderItemSlice []*OrderItem

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

func (OrderItemSlice) DeleteAll

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

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

func (*OrderItemSlice) ReloadAll

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

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

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

type OrderSlice

type OrderSlice []*Order

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

func (OrderSlice) DeleteAll

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

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

func (*OrderSlice) ReloadAll

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

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

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

type Product

type Product struct {
	ProductID   string    `boil:"product_id" json:"product_id" toml:"product_id" yaml:"product_id"`
	Name        string    `boil:"name" json:"name" toml:"name" yaml:"name"`
	Description string    `boil:"description" json:"description" toml:"description" yaml:"description"`
	Price       float32   `boil:"price" json:"price" toml:"price" yaml:"price"`
	Stock       int64     `boil:"stock" json:"stock" toml:"stock" yaml:"stock"`
	CategoryID  int64     `boil:"category_id" json:"category_id" toml:"category_id" yaml:"category_id"`
	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"`

	R *productR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L productL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Product is an object representing the database table.

func FindProduct

func FindProduct(ctx context.Context, exec boil.ContextExecutor, productID string, selectCols ...string) (*Product, error)

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

func (*Product) AddOrderItems

func (o *Product) AddOrderItems(ctx context.Context, exec boil.ContextExecutor, insert bool, related ...*OrderItem) error

AddOrderItems adds the given related objects to the existing relationships of the product, optionally inserting them as new records. Appends related to o.R.OrderItems. Sets related.R.Product appropriately.

func (*Product) Category

func (o *Product) Category(mods ...qm.QueryMod) categoryQuery

Category pointed to by the foreign key.

func (*Product) Delete

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

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

func (*Product) Exists

func (o *Product) Exists(ctx context.Context, exec boil.ContextExecutor) (bool, error)

Exists checks if the Product row exists.

func (*Product) Insert

func (o *Product) 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 (*Product) OrderItems

func (o *Product) OrderItems(mods ...qm.QueryMod) orderItemQuery

OrderItems retrieves all the order_item's OrderItems with an executor.

func (*Product) Reload

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

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

func (*Product) SetCategory

func (o *Product) SetCategory(ctx context.Context, exec boil.ContextExecutor, insert bool, related *Category) error

SetCategory of the product to the related item. Sets o.R.Category to related. Adds o to related.R.Products.

func (*Product) Update

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

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

func (o *Product) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns, opts ...UpsertOptionFunc) 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 ProductHook

type ProductHook func(context.Context, boil.ContextExecutor, *Product) error

ProductHook is the signature for custom Product hook methods

type ProductSlice

type ProductSlice []*Product

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

func (ProductSlice) DeleteAll

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

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

func (*ProductSlice) ReloadAll

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

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

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

type Status

type Status string
const (
	StatusProcessed Status = "processed"
	StatusShipped   Status = "shipped"
	StatusDelivered Status = "delivered"
)

Enum values for Status

func AllStatus

func AllStatus() []Status

func (Status) IsValid

func (e Status) IsValid() error

func (Status) Ordinal

func (e Status) Ordinal() int

func (Status) String

func (e Status) String() string

type UpsertOptionFunc

type UpsertOptionFunc func(o *UpsertOptions)

func UpsertConflictTarget

func UpsertConflictTarget(conflictTarget string) UpsertOptionFunc

func UpsertUpdateSet

func UpsertUpdateSet(updateSet string) UpsertOptionFunc

type UpsertOptions

type UpsertOptions struct {
	// contains filtered or unexported fields
}

type User

type User struct {
	UserID       string    `boil:"user_id" json:"user_id" toml:"user_id" yaml:"user_id"`
	Username     string    `boil:"username" json:"username" toml:"username" yaml:"username"`
	Email        string    `boil:"email" json:"email" toml:"email" yaml:"email"`
	PasswordHash string    `boil:"password_hash" json:"password_hash" toml:"password_hash" yaml:"password_hash"`
	CreatedAt    time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`

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

User is an object representing the database table.

func FindUser

func FindUser(ctx context.Context, exec boil.ContextExecutor, userID string, 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) AddOrders

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

AddOrders adds the given related objects to the existing relationships of the user, optionally inserting them as new records. Appends related to o.R.Orders. 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) Exists

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

Exists checks if the User row exists.

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) Orders

func (o *User) Orders(mods ...qm.QueryMod) orderQuery

Orders retrieves all the order's Orders with an executor.

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) 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, opts ...UpsertOptionFunc) 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 UserHook

type UserHook func(context.Context, boil.ContextExecutor, *User) error

UserHook is the signature for custom User hook methods

type UserSlice

type UserSlice []*User

UserSlice is an alias for a slice of pointers to User. This should almost always be used instead of []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