products

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CategoryId represents the column "category_id" of with type "integer", nullable:true, primary:false
	CategoryId = p.NewFieldAccess[pgtype.Int4](p.MakeColumnInfo(tableInfo, "category_id", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).CategoryId })
	// Code represents the column "code" of with type "text", nullable:true, primary:false
	Code = p.NewFieldAccess[pgtype.Text](p.MakeColumnInfo(tableInfo, "code", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).Code })
	// CreatedAt represents the column "created_at" of with type "timestamp with time zone", nullable:true, primary:false
	CreatedAt = p.NewFieldAccess[pgtype.Timestamptz](p.MakeColumnInfo(tableInfo, "created_at", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).CreatedAt })
	// DeletedAt represents the column "deleted_at" of with type "timestamp with time zone", nullable:true, primary:false
	DeletedAt = p.NewFieldAccess[pgtype.Timestamptz](p.MakeColumnInfo(tableInfo, "deleted_at", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).DeletedAt })
	// ID represents the column "id" of with type "integer", nullable:false, primary:true
	ID = p.NewInt32Access(p.MakeColumnInfo(tableInfo, "id", p.IsPrimary, p.NotNull, 0),
		func(dest any) any { return &dest.(*Product).ID })
	// Price represents the column "price" of with type "bigint", nullable:true, primary:false
	Price = p.NewFieldAccess[pgtype.Int8](p.MakeColumnInfo(tableInfo, "price", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).Price })
	// UpdatedAt represents the column "updated_at" of with type "timestamp with time zone", nullable:true, primary:false
	UpdatedAt = p.NewFieldAccess[pgtype.Timestamptz](p.MakeColumnInfo(tableInfo, "updated_at", p.NotPrimary, p.Nullable, 0),
		func(dest any) any { return &dest.(*Product).UpdatedAt })
)

Functions

func Columns added in v0.15.0

func Columns(names ...string) (list []p.ColumnAccessor)

Columns returns the ColumnAccessor list for the given column names. If the names is empty then return all columns.

func Delete

func Delete() p.MutationSet[Product]

Delete creates a MutationSet for deleting data.

func Insert

func Insert(cas ...p.ColumnAccessor) p.MutationSet[Product]

Insert creates a MutationSet for inserting data with zero or more columns.

func Select

func Select(cas ...p.ColumnAccessor) p.QuerySet[Product]

Select returns a new QuerySet[Product] for fetching column data.

func TableInfo added in v1.5.0

func TableInfo() p.TableInfo

TableInfo returns meta information about the table.

func Update

func Update(cas ...p.ColumnAccessor) p.MutationSet[Product]

Update creates a MutationSet to update zero or more columns.

Types

type Product

type Product struct {
	CategoryId pgtype.Int4        // category_id : integer
	Code       pgtype.Text        // code : text
	CreatedAt  pgtype.Timestamptz // created_at : timestamp with time zone
	DeletedAt  pgtype.Timestamptz // deleted_at : timestamp with time zone
	ID         int32              // id : integer
	Price      pgtype.Int8        // price : bigint
	UpdatedAt  pgtype.Timestamptz // updated_at : timestamp with time zone
	// contains filtered or unexported fields
}

Product is generated from the public.products table.

func (*Product) AddExpressionResult added in v0.18.0

func (e *Product) AddExpressionResult(key string, value any)

AddExpressionResult puts a value into the custom expression results

func (*Product) GetExpressionResult added in v0.18.0

func (e *Product) GetExpressionResult(key string) any

GetExpressionResult gets a value from the custom expression results. Returns nil if absent.

func (*Product) SetCategoryId

func (e *Product) SetCategoryId(v int32) *Product

SetCategoryId sets the value to the field value and returns the receiver.

func (*Product) SetCode

func (e *Product) SetCode(v string) *Product

SetCode sets the value to the field value and returns the receiver.

func (*Product) SetCreatedAt

func (e *Product) SetCreatedAt(v time.Time) *Product

SetCreatedAt sets the value to the field value and returns the receiver.

func (*Product) SetDeletedAt

func (e *Product) SetDeletedAt(v time.Time) *Product

SetDeletedAt sets the value to the field value and returns the receiver.

func (*Product) SetID

func (e *Product) SetID(v int32) *Product

SetID sets the value to the field value and returns the receiver.

func (*Product) SetPrice

func (e *Product) SetPrice(v int64) *Product

SetPrice sets the value to the field value and returns the receiver.

func (*Product) SetUpdatedAt

func (e *Product) SetUpdatedAt(v time.Time) *Product

SetUpdatedAt sets the value to the field value and returns the receiver.

func (*Product) Setters

func (e *Product) Setters() (list []p.ColumnAccessor)

Setters returns the list of changes to a Product for which updates/inserts need to be processed. Can be used in Insert,Update,Select. Cannot be used to set null values for columns.

func (*Product) String

func (e *Product) String() string

String returns the debug string for *Product with all non-nil field values.

Jump to

Keyboard shortcuts

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