sample

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sample holds a representative model used by the codegen tests: the conformance test loads it via go/packages (AST) and via reflection, and the golden test regenerates its quark_gen.go and compares. It is a real, importable package so reflection can see the same types the AST extractor parses.

Index

Constants

This section is empty.

Variables

View Source
var AccountColumns = struct {
	ID        quark.TypedColumn[int64]
	Email     quark.TypedStringColumn
	Age       quark.TypedColumn[int]
	Balance   quark.TypedColumn[float64]
	Active    quark.TypedColumn[bool]
	Settings  quark.TypedColumn[quark.JSON[string]]
	Nickname  quark.TypedColumn[sql.Null[string]]
	CreatedAt quark.TypedColumn[time.Time]
	UpdatedAt quark.TypedColumn[*time.Time]
}{
	ID:        quark.NewTypedColumn[int64]("id"),
	Email:     quark.NewTypedStringColumn("email"),
	Age:       quark.NewTypedColumn[int]("age"),
	Balance:   quark.NewTypedColumn[float64]("balance"),
	Active:    quark.NewTypedColumn[bool]("active"),
	Settings:  quark.NewTypedColumn[quark.JSON[string]]("settings"),
	Nickname:  quark.NewTypedColumn[sql.Null[string]]("nickname"),
	CreatedAt: quark.NewTypedColumn[time.Time]("created_at"),
	UpdatedAt: quark.NewTypedColumn[*time.Time]("updated_at"),
}

AccountColumns provides typed, compile-time-checked column accessors for Account.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        int64                  `db:"id" pk:"true"`
	Email     string                 `db:"email"`
	Age       int                    `db:"age"`
	Balance   float64                `db:"balance"`
	Active    bool                   `db:"active"`
	Settings  quark.JSON[string]     `db:"settings"`
	Nickname  quark.Nullable[string] `db:"nickname"`
	CreatedAt time.Time              `db:"created_at"`
	UpdatedAt *time.Time             `db:"updated_at"`
	// contains filtered or unexported fields
}

Account is a representative model: a primary key, plain scalar columns, a pointer column, and a Quark generic type. The field types are chosen so reflect.Type.String() and go/types render them identically after CanonicalType, exercising the conformance check without hitting the known alias edge cases.

Jump to

Keyboard shortcuts

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