models

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PhaseValidator

func PhaseValidator(p Phase) error

PhaseValidator reports a value Phase does not declare

Types

type ArrayConvertExample

type ArrayConvertExample struct {
	ID     string
	Values [3]int
}

ArrayConvertExample demonstrates a fixed-size array whose elements need a conversion, rather than being assignable as they are

type ArrayExample

type ArrayExample struct {
	ID   string
	Data [4]byte
	Name string
}

ArrayExample demonstrates fixed-size array support

type Cron

type Cron struct {
	ID            string    `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt     time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt     null.Time `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	Schedule      string    `boil:"schedule" json:"schedule" toml:"schedule" yaml:"schedule"`
	DataType      string    `boil:"data_type" json:"data_type" toml:"data_type" yaml:"data_type"`
	Data          []byte    `boil:"data" json:"data" toml:"data" yaml:"data"`
	Queue         string    `boil:"queue" json:"queue" toml:"queue" yaml:"queue"`
	SkipExecution bool      `boil:"skip_execution" json:"skip_execution" toml:"skip_execution" yaml:"skip_execution"`
	StartTime     time.Time `boil:"start_time" json:"start_time" toml:"start_time" yaml:"start_time"`

	R *cronR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L cronL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Cron is an object representing the database table.

type CustomConvertExample

type CustomConvertExample struct {
	ID        string
	Value     string
	Timestamp int64
}

CustomConvertExample demonstrates the using: directive

type Customer

type Customer struct {
	Name string
}

Customer is the far side of an edge

type Detail

type Detail struct {
	Note   string
	Weight int
}

Detail is an optional nested value, mapped through a value method

type EnumExample

type EnumExample struct {
	ID         string
	Status     Status
	Visibility Visibility
}

EnumExample demonstrates enum mapping

type Event

type Event struct {
	ID        string
	At        time.Time
	Owner     string
	OwnerID   int64
	Level     int
	RetiredAt *time.Time
	Deadline  *time.Time
	Note      *string
}

Event demonstrates conversions the generator derives on its own: a time read through a method, a string carried as bytes and an int onto a named integer type

type EventCreate

type EventCreate struct {
	Values map[string]any
}

EventCreate mimics the builder ent generates for an entity: a setter per column, a nillable twin for each optional column, both forms of an edge setter and a variadic adder for a to-many edge. Values records what was set.

func NewEventCreate

func NewEventCreate() *EventCreate

NewEventCreate starts an empty builder

func (*EventCreate) AddTagIDs

func (c *EventCreate) AddTagIDs(ids ...int) *EventCreate

AddTagIDs adds to the "tags" edge by ids

func (*EventCreate) SetAt

func (c *EventCreate) SetAt(v time.Time) *EventCreate

SetAt sets the "at" column

func (*EventCreate) SetCustomer

func (c *EventCreate) SetCustomer(v *Customer) *EventCreate

SetCustomer sets the "customer" edge to an entity

func (*EventCreate) SetCustomerID

func (c *EventCreate) SetCustomerID(v int64) *EventCreate

SetCustomerID sets the "customer" edge by id

func (*EventCreate) SetDeletedAt

func (c *EventCreate) SetDeletedAt(v time.Time) *EventCreate

SetDeletedAt sets the optional "deleted_at" column

func (*EventCreate) SetID

func (c *EventCreate) SetID(v string) *EventCreate

SetID sets the "id" column

func (*EventCreate) SetLevel

func (c *EventCreate) SetLevel(v int) *EventCreate

SetLevel sets the "level" column

func (*EventCreate) SetNillableDeletedAt

func (c *EventCreate) SetNillableDeletedAt(v *time.Time) *EventCreate

SetNillableDeletedAt sets the "deleted_at" column if v is not nil

func (*EventCreate) SetNillableNote

func (c *EventCreate) SetNillableNote(v *string) *EventCreate

SetNillableNote sets the "note" column if v is not nil

func (*EventCreate) SetNillableRetiredAt

func (c *EventCreate) SetNillableRetiredAt(v *time.Time) *EventCreate

SetNillableRetiredAt sets the "retired_at" column if v is not nil

func (*EventCreate) SetNote

func (c *EventCreate) SetNote(v string) *EventCreate

SetNote sets the optional "note" column

func (*EventCreate) SetOwner

func (c *EventCreate) SetOwner(v string) *EventCreate

SetOwner sets the "owner" column

func (*EventCreate) SetRetiredAt

func (c *EventCreate) SetRetiredAt(v time.Time) *EventCreate

SetRetiredAt sets the optional "retired_at" column

type Item

type Item struct {
	Name  string
	Count int
}

Item is the element of a slice of pointers

type Job

type Job struct {
	ID         string      `boil:"id" json:"id" toml:"id" yaml:"id"`
	CreatedAt  time.Time   `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	UpdatedAt  null.Time   `boil:"updated_at" json:"updated_at,omitempty" toml:"updated_at" yaml:"updated_at,omitempty"`
	RunAt      time.Time   `boil:"run_at" json:"run_at" toml:"run_at" yaml:"run_at"`
	Group      null.String `boil:"group" json:"group,omitempty" toml:"group" yaml:"group,omitempty"`
	Queue      string      `boil:"queue" json:"queue" toml:"queue" yaml:"queue"`
	DataType   string      `boil:"data_type" json:"data_type" toml:"data_type" yaml:"data_type"`
	Data       []byte      `boil:"data" json:"data" toml:"data" yaml:"data"`
	ExternalID null.String `boil:"external_id" json:"external_id,omitempty" toml:"external_id" yaml:"external_id,omitempty"`
	CronID     null.String `boil:"cron_id" json:"cron_id,omitempty" toml:"cron_id" yaml:"cron_id,omitempty"`

	R *jobR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L jobL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Job is an object representing the database table.

type JobSlice

type JobSlice []*Job

type NamedSliceExample

type NamedSliceExample struct {
	ID    string
	Items StringSlice
}

NamedSliceExample demonstrates named slice type support

type OptionalExample

type OptionalExample struct {
	ID     string
	Detail *Detail
	Item   *Item
}

OptionalExample demonstrates optional nested values: a nil field stays nil

type Order

type Order struct {
	ID    string
	Edges OrderEdges
}

Order demonstrates a from: path that crosses an edge

type OrderEdges

type OrderEdges struct {
	Customer *Customer
}

OrderEdges mirrors the Edges struct ent generates: the pointer is nil unless the edge was loaded, and the OrErr accessor reports that instead of a nil dereference

func (OrderEdges) CustomerOrErr

func (e OrderEdges) CustomerOrErr() (*Customer, error)

CustomerOrErr is the accessor ent generates for an edge

type Phase

type Phase string

Phase is a string enum shaped like the ones ent generates, with its values under the type name and a validator next to them

const (
	PhaseRunning Phase = "running"
	PhaseDone    Phase = "done"
)

type PointerSliceExample

type PointerSliceExample struct {
	ID    string
	Items []*Item
}

PointerSliceExample demonstrates a repeated field of pointers, the shape a protobuf `repeated Item` message field takes on the Go side

type Snapshot

type Snapshot struct {
	ID   string
	Tick int64
}

Snapshot is a named struct handed to a converter through the using: directive

type SnapshotExample

type SnapshotExample struct {
	ID       string
	Snapshot *Snapshot
}

SnapshotExample demonstrates using: with a converter over a named struct

type Status

type Status string

Status is a named string enum. Its values line up with protos.StatusProto, so a conversion between the two is derived automatically without any annotation.

const (
	StatusActive   Status = "active"
	StatusInactive Status = "inactive"
)

type StringSlice

type StringSlice []string

StringSlice is a named slice type

type Task

type Task struct {
	ID    string
	Phase Phase
}

Task demonstrates a string enum mapped onto a numbered one

type Transition

type Transition struct {
	ID        int64     `boil:"id" json:"id" toml:"id" yaml:"id"`
	JobID     string    `boil:"job_id" json:"job_id" toml:"job_id" yaml:"job_id"`
	CreatedAt time.Time `boil:"created_at" json:"created_at" toml:"created_at" yaml:"created_at"`
	State     string    `boil:"state" json:"state" toml:"state" yaml:"state"`
	Attempts  int       `boil:"attempts" json:"attempts" toml:"attempts" yaml:"attempts"`
	RetryAt   null.Time `boil:"retry_at" json:"retry_at,omitempty" toml:"retry_at" yaml:"retry_at,omitempty"`

	R *transitionR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L transitionL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

Transition is an object representing the database table.

type TransitionSlice

type TransitionSlice []*Transition

type User

type User struct {
	ID        string
	Name      string
	Email     string
	Age       int
	CreatedAt time.Time
}

User demonstrates basic struct mapping

type UserWithRoles

type UserWithRoles struct {
	ID       string
	Name     string
	Roles    []string
	Tags     map[string]string
	Scores   []int
	Metadata map[string]int
}

UserWithRoles demonstrates slice and map fields

type Visibility

type Visibility string

Visibility is a named string enum whose counterpart uses different values, so a mapping has to be spelled out with the map: directive

const (
	VisibilityUnspecified Visibility = ""
	VisibilityPublic      Visibility = "public"
	VisibilityPrivate     Visibility = "private"
)

Jump to

Keyboard shortcuts

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