models

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Code generated by cql-gen v0.1.0, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllTypes added in v0.8.0

type AllTypes struct {
	model.UUIDModel

	ValInt     int
	ValInt8    int8
	ValInt16   int16
	ValInt32   int32
	ValInt64   int64
	ValUint    uint
	ValUint8   uint8
	ValUint16  uint16
	ValUint32  uint32
	ValUint64  uint64
	ValFloat32 float32
	ValFloat64 float64
	ValBool    bool
	ValString  string
	ValTime    time.Time

	PtrInt     *int
	PtrInt8    *int8
	PtrInt16   *int16
	PtrInt32   *int32
	PtrInt64   *int64
	PtrUint    *uint
	PtrUint8   *uint8
	PtrUint16  *uint16
	PtrUint32  *uint32
	PtrUint64  *uint64
	PtrFloat32 *float32
	PtrFloat64 *float64
	PtrBool    *bool
	PtrString  *string
	PtrTime    *time.Time

	// database/sql nullable wrappers used directly as fields — these
	// exercise the sql.NullInt16 / NullInt32 / NullByte scan pools that the
	// sized int/uint value fields (which scan via NullInt64) never touch.
	NullInt16 sql.NullInt16
	NullInt32 sql.NullInt32
	NullByte  sql.NullByte

	// named scalars (underlying int): stored as their underlying kind, so the
	// scanner reads them via NullInt64 and casts back to Color — value and
	// nullable-pointer variants.
	Favorite Color
	PtrColor *Color
}

AllTypes exercises the fast scanner across every supported scalar type — as a value and as a nullable pointer — so a round-trip test can prove each generated scan/assign path materializes the value correctly.

type Bicycle

type Bicycle struct {
	model.UUIDModel

	Name string
	// Bicycle BelongsTo Person (Bicycle 0..* -> 1 Person)
	Owner     Person `gorm:"references:Name;foreignKey:OwnerName"`
	OwnerName string
}

func (Bicycle) Equal

func (m Bicycle) Equal(other Bicycle) bool

func (Bicycle) GetOwner

func (m Bicycle) GetOwner() (*Person, error)

type Brand

type Brand struct {
	model.UIntModel

	Name string
}

func (Brand) Equal

func (m Brand) Equal(other Brand) bool

type Child

type Child struct {
	model.UUIDModel

	Name   string
	Number int

	Parent1   Parent1
	Parent1ID model.UUID

	Parent2   Parent2
	Parent2ID model.UUID
}

func (Child) Equal

func (m Child) Equal(other Child) bool

func (Child) GetParent1

func (m Child) GetParent1() (*Parent1, error)

func (Child) GetParent2

func (m Child) GetParent2() (*Parent2, error)

type City

type City struct {
	model.UUIDModel

	Name      string
	Country   *Country
	CountryID model.UUID // Country HasOne City (Country 1 -> 1 City)
}

func (City) Equal

func (m City) Equal(other City) bool

func (City) GetCountry

func (m City) GetCountry() (*Country, error)

type Color added in v0.8.0

type Color int

Color is a named scalar type: no custom Scan/Value, so gorm stores it as its underlying int. The fast scanner classifies it via its underlying kind and casts the scanned value back to Color, so a plain named scalar takes the fast path (no gorm fallback).

const (
	ColorRed Color = iota + 1
	ColorGreen
	ColorBlue
)

type Company

type Company struct {
	model.UUIDModelWithTimestamps

	Name    string
	Sellers *[]Seller // Company HasMany Sellers (Company 0..1 -> 0..* Seller)
}

func (Company) Equal

func (m Company) Equal(other Company) bool

func (Company) GetSellers

func (m Company) GetSellers() ([]Seller, error)

type CompanyNoTimestamps added in v0.6.0

type CompanyNoTimestamps struct {
	model.UUIDModel

	Name    string
	Sellers *[]SellerNoTimestamps // Company HasMany Sellers (Company 0..1 -> 0..* Seller)
}

func (CompanyNoTimestamps) Equal added in v0.6.0

func (CompanyNoTimestamps) GetSellers added in v0.6.0

func (m CompanyNoTimestamps) GetSellers() ([]SellerNoTimestamps, error)

type Country

type Country struct {
	model.UUIDModel

	Name    string
	Capital City // Country HasOne City (Country 1 -> 1 City)
}

func (Country) Equal

func (m Country) Equal(other Country) bool

func (Country) GetCapital

func (m Country) GetCapital() (*City, error)

type Employee

type Employee struct {
	model.UUIDModel

	Name   string
	Boss   *Employee // Self-Referential Has One (Employee 0..* -> 0..1 Employee)
	BossID *model.UUID
}

func (Employee) Equal

func (m Employee) Equal(other Employee) bool

func (Employee) GetBoss

func (m Employee) GetBoss() (*Employee, error)

type MultiString

type MultiString []string

func (MultiString) GetValue added in v0.2.0

func (s MultiString) GetValue() MultiString

func (MultiString) GormDBDataType

func (MultiString) GormDBDataType(db *gorm.DB, _ *schema.Field) string

func (MultiString) GormDataType

func (MultiString) GormDataType() string

func (*MultiString) Scan

func (s *MultiString) Scan(src interface{}) error

func (MultiString) ToSQL added in v0.2.0

func (s MultiString) ToSQL(_ *condition.CQLQuery) (string, []any, error)

func (MultiString) Value

func (s MultiString) Value() (driver.Value, error)

type Parent1

type Parent1 struct {
	model.UUIDModel

	Name string

	ParentParent   ParentParent
	ParentParentID model.UUID
}

func (Parent1) Equal

func (m Parent1) Equal(other Parent1) bool

func (Parent1) GetParentParent

func (m Parent1) GetParentParent() (*ParentParent, error)

type Parent2

type Parent2 struct {
	model.UUIDModel

	ParentParent   ParentParent
	ParentParentID model.UUID
}

func (Parent2) Equal

func (m Parent2) Equal(other Parent2) bool

func (Parent2) GetParentParent

func (m Parent2) GetParentParent() (*ParentParent, error)

type ParentParent

type ParentParent struct {
	model.UUIDModel

	Name   string
	Number int
}

func (ParentParent) Equal

func (m ParentParent) Equal(other ParentParent) bool

type Person

type Person struct {
	model.UUIDModel

	Name string `gorm:"unique;type:VARCHAR(255)"`
}

func (Person) TableName

func (m Person) TableName() string

type Phone

type Phone struct {
	model.UIntModelWithTimestamps

	Name string
	// Phone belongsTo Brand (Phone 0..* -> 1 Brand)
	Brand   Brand
	BrandID uint
}

func (Phone) Equal

func (m Phone) Equal(other Phone) bool

func (Phone) GetBrand

func (m Phone) GetBrand() (*Brand, error)

type PhoneNoTimestamps added in v0.6.0

type PhoneNoTimestamps struct {
	model.UIntModel

	Name string
	// Phone belongsTo Brand (Phone 0..* -> 1 Brand)
	Brand   Brand
	BrandID uint
}

func (PhoneNoTimestamps) Equal added in v0.6.0

func (m PhoneNoTimestamps) Equal(other PhoneNoTimestamps) bool

func (PhoneNoTimestamps) GetBrand added in v0.6.0

func (m PhoneNoTimestamps) GetBrand() (*Brand, error)

type Product

type Product struct {
	model.UUIDModelWithTimestamps

	String      string `gorm:"column:string_something_else"`
	Int         int
	IntPointer  *int
	Float       float64
	NullFloat   sql.NullFloat64
	Bool        bool
	NullBool    sql.NullBool
	ByteArray   []byte
	MultiString MultiString
	ToBeEmbedded
	GormEmbedded ToBeGormEmbedded `gorm:"embedded;embeddedPrefix:gorm_embedded_"`
	String2      string
}

func (Product) Equal

func (m Product) Equal(other Product) bool

type ProductNoTimestamps added in v0.6.0

type ProductNoTimestamps struct {
	model.UUIDModel

	String      string `gorm:"column:string_something_else"`
	Int         int
	IntPointer  *int
	Float       float64
	NullFloat   sql.NullFloat64
	Bool        bool
	NullBool    sql.NullBool
	ByteArray   []byte
	MultiString MultiString
	ToBeEmbedded
	GormEmbedded ToBeGormEmbedded `gorm:"embedded;embeddedPrefix:gorm_embedded_"`
	String2      string
}

func (ProductNoTimestamps) Equal added in v0.6.0

type Sale

type Sale struct {
	model.UUIDModelWithTimestamps

	Code        int
	Description string

	// Sale belongsTo Product (Sale 0..* -> 1 Product)
	Product   Product
	ProductID model.UUID

	// Sale belongsTo Seller (Sale 0..* -> 0..1 Seller)
	Seller   *Seller
	SellerID *model.UUID
}

func (Sale) Equal

func (m Sale) Equal(other Sale) bool

func (Sale) GetProduct

func (m Sale) GetProduct() (*Product, error)

func (Sale) GetSeller

func (m Sale) GetSeller() (*Seller, error)

type SaleNoTimestamps added in v0.6.0

type SaleNoTimestamps struct {
	model.UUIDModel

	Code        int
	Description string

	// Sale belongsTo Product (Sale 0..* -> 1 Product)
	Product   ProductNoTimestamps
	ProductID model.UUID

	// Sale belongsTo Seller (Sale 0..* -> 0..1 Seller)
	Seller   *SellerNoTimestamps
	SellerID *model.UUID
}

func (SaleNoTimestamps) Equal added in v0.6.0

func (m SaleNoTimestamps) Equal(other SaleNoTimestamps) bool

func (SaleNoTimestamps) GetProduct added in v0.6.0

func (m SaleNoTimestamps) GetProduct() (*ProductNoTimestamps, error)

func (SaleNoTimestamps) GetSeller added in v0.6.0

func (m SaleNoTimestamps) GetSeller() (*SellerNoTimestamps, error)

type Seller

type Seller struct {
	model.UUIDModel

	Name      string
	Company   *Company
	CompanyID *model.UUID // Company HasMany Sellers (Company 0..1 -> 0..* Seller)

	University   *University
	UniversityID *model.UUID
}

func (Seller) Equal

func (m Seller) Equal(other Seller) bool

func (Seller) GetCompany

func (m Seller) GetCompany() (*Company, error)

func (Seller) GetUniversity

func (m Seller) GetUniversity() (*University, error)

type SellerNoTimestamps added in v0.6.0

type SellerNoTimestamps struct {
	model.UUIDModel

	Name                  string
	CompanyNoTimestamps   *CompanyNoTimestamps
	CompanyNoTimestampsID *model.UUID // Company HasMany Sellers (Company 0..1 -> 0..* Seller)

	University   *University
	UniversityID *model.UUID
}

func (SellerNoTimestamps) Equal added in v0.6.0

func (SellerNoTimestamps) GetCompanyNoTimestamps added in v0.6.0

func (m SellerNoTimestamps) GetCompanyNoTimestamps() (*CompanyNoTimestamps, error)

func (SellerNoTimestamps) GetUniversity added in v0.6.0

func (m SellerNoTimestamps) GetUniversity() (*University, error)

type ToBeEmbedded

type ToBeEmbedded struct {
	EmbeddedInt int
}

type ToBeGormEmbedded

type ToBeGormEmbedded struct {
	Int int
}

type University

type University struct {
	model.UUIDModel

	Name string
}

func (University) Equal

func (m University) Equal(other University) bool

type WithUnsupportedColumn added in v0.8.0

type WithUnsupportedColumn struct {
	model.UUIDModel

	Name string
	Tags []string `gorm:"serializer:json"`
}

WithUnsupportedColumn holds a column the fast scanner genuinely can't classify: a []string persisted through gorm's json serializer. There's no static Scan/Value and the value lives in a JSON text column, so no scanner is generated and its queries fall back to gorm's reflective scan — the safety net exercised by TestUnsupportedColumnFallsBackToGorm.

Jump to

Keyboard shortcuts

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