tests

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

IMPORTANT! This is auto generated code by https://github.com/src-d/go-kallax Please, do not touch the code below, and if you do, do it under your own risk. Take into account that all the code you write here will be completely erased from earth the next time you generate the kallax models.

Index

Constants

This section is empty.

Variables

View Source
var Schema = &schema{
	Car: &schemaCar{
		BaseSchema: kallax.NewBaseSchema(
			"cars",
			"__car",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Owner": kallax.NewForeignKey("owner_id", true),
			},
			func() kallax.Record {
				return new(Car)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("owner_id"),
			kallax.NewSchemaField("model_name"),
		),
		ID:        kallax.NewSchemaField("id"),
		ModelName: kallax.NewSchemaField("model_name"),
	},
	EventsAllFixture: &schemaEventsAllFixture{
		BaseSchema: kallax.NewBaseSchema(
			"event",
			"__eventsallfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(EventsAllFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("checks"),
			kallax.NewSchemaField("must_fail_before"),
			kallax.NewSchemaField("must_fail_after"),
		),
		ID:             kallax.NewSchemaField("id"),
		Checks:         kallax.NewSchemaField("checks"),
		MustFailBefore: kallax.NewSchemaField("must_fail_before"),
		MustFailAfter:  kallax.NewSchemaField("must_fail_after"),
	},
	EventsFixture: &schemaEventsFixture{
		BaseSchema: kallax.NewBaseSchema(
			"event",
			"__eventsfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(EventsFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("checks"),
			kallax.NewSchemaField("must_fail_before"),
			kallax.NewSchemaField("must_fail_after"),
		),
		ID:             kallax.NewSchemaField("id"),
		Checks:         kallax.NewSchemaField("checks"),
		MustFailBefore: kallax.NewSchemaField("must_fail_before"),
		MustFailAfter:  kallax.NewSchemaField("must_fail_after"),
	},
	EventsSaveFixture: &schemaEventsSaveFixture{
		BaseSchema: kallax.NewBaseSchema(
			"event",
			"__eventssavefixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(EventsSaveFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("checks"),
			kallax.NewSchemaField("must_fail_before"),
			kallax.NewSchemaField("must_fail_after"),
		),
		ID:             kallax.NewSchemaField("id"),
		Checks:         kallax.NewSchemaField("checks"),
		MustFailBefore: kallax.NewSchemaField("must_fail_before"),
		MustFailAfter:  kallax.NewSchemaField("must_fail_after"),
	},
	JSONModel: &schemaJSONModel{
		BaseSchema: kallax.NewBaseSchema(
			"jsons",
			"__jsonmodel",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(JSONModel)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
			kallax.NewSchemaField("bar"),
			kallax.NewSchemaField("baz_slice"),
			kallax.NewSchemaField("baz"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
		Bar: &schemaJSONModelBar{
			BaseSchemaField: kallax.NewSchemaField("bar").(*kallax.BaseSchemaField),
			Qux: &schemaJSONModelBarQux{
				JSONSchemaArray: kallax.NewJSONSchemaArray("bar", "Qux"),
				Schnooga:        kallax.NewJSONSchemaKey(kallax.JSONText, "bar", "Qux", "Schnooga"),
				Balooga:         kallax.NewJSONSchemaKey(kallax.JSONInt, "bar", "Qux", "Balooga"),
				Boo:             kallax.NewJSONSchemaKey(kallax.JSONFloat, "bar", "Qux", "Boo"),
			},
			Mux: kallax.NewJSONSchemaKey(kallax.JSONText, "bar", "Mux"),
		},
		BazSlice: &schemaJSONModelBazSlice{
			BaseSchemaField: kallax.NewSchemaField("baz_slice").(*kallax.BaseSchemaField),
			Mux:             kallax.NewJSONSchemaKey(kallax.JSONText, "baz_slice", "Mux"),
		},
		Baz: kallax.NewSchemaField("baz"),
	},
	MultiKeySortFixture: &schemaMultiKeySortFixture{
		BaseSchema: kallax.NewBaseSchema(
			"query",
			"__multikeysortfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(MultiKeySortFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("start"),
			kallax.NewSchemaField("_end"),
		),
		ID:    kallax.NewSchemaField("id"),
		Name:  kallax.NewSchemaField("name"),
		Start: kallax.NewSchemaField("start"),
		End:   kallax.NewSchemaField("_end"),
	},
	Person: &schemaPerson{
		BaseSchema: kallax.NewBaseSchema(
			"persons",
			"__person",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Pets": kallax.NewForeignKey("owner_id", false),
				"Car":  kallax.NewForeignKey("owner_id", false),
			},
			func() kallax.Record {
				return new(Person)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
	},
	Pet: &schemaPet{
		BaseSchema: kallax.NewBaseSchema(
			"pets",
			"__pet",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Owner": kallax.NewForeignKey("owner_id", true),
			},
			func() kallax.Record {
				return new(Pet)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("kind"),
			kallax.NewSchemaField("owner_id"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
		Kind: kallax.NewSchemaField("kind"),
	},
	QueryFixture: &schemaQueryFixture{
		BaseSchema: kallax.NewBaseSchema(
			"query",
			"__queryfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(QueryFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
	},
	ResultSetFixture: &schemaResultSetFixture{
		BaseSchema: kallax.NewBaseSchema(
			"resultset",
			"__resultsetfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(ResultSetFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
	},
	SchemaFixture: &schemaSchemaFixture{
		BaseSchema: kallax.NewBaseSchema(
			"schema",
			"__schemafixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Nested": kallax.NewForeignKey("schema_fixture_id", false),
			},
			func() kallax.Record {
				return new(SchemaFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("string"),
			kallax.NewSchemaField("int"),
			kallax.NewSchemaField("inline"),
			kallax.NewSchemaField("map_of_string"),
			kallax.NewSchemaField("map_of_interface"),
			kallax.NewSchemaField("map_of_some_type"),
		),
		ID:             kallax.NewSchemaField("id"),
		String:         kallax.NewSchemaField("string"),
		Int:            kallax.NewSchemaField("int"),
		Inline:         kallax.NewSchemaField("inline"),
		MapOfString:    kallax.NewSchemaField("map_of_string"),
		MapOfInterface: kallax.NewSchemaField("map_of_interface"),
		MapOfSomeType:  kallax.NewSchemaField("map_of_some_type"),
	},
	StoreFixture: &schemaStoreFixture{
		BaseSchema: kallax.NewBaseSchema(
			"store",
			"__storefixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(StoreFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
	},
	StoreWithConstructFixture: &schemaStoreWithConstructFixture{
		BaseSchema: kallax.NewBaseSchema(
			"store_construct",
			"__storewithconstructfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(StoreWithConstructFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
	},
	StoreWithNewFixture: &schemaStoreWithNewFixture{
		BaseSchema: kallax.NewBaseSchema(
			"store_new",
			"__storewithnewfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(StoreWithNewFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("foo"),
			kallax.NewSchemaField("bar"),
		),
		ID:  kallax.NewSchemaField("id"),
		Foo: kallax.NewSchemaField("foo"),
		Bar: kallax.NewSchemaField("bar"),
	},
}

Functions

This section is empty.

Types

type Bar added in v0.13.0

type Bar struct {
	Qux []Qux
	Mux string
}

type Baz added in v0.13.0

type Baz struct {
	Mux string
}

type Car added in v0.12.0

type Car struct {
	kallax.Model `table:"cars"`
	ID           kallax.ULID `pk:""`
	Owner        *Person     `fk:"owner_id,inverse"`
	ModelName    string
	// contains filtered or unexported fields
}

func NewCar added in v0.12.0

func NewCar(model string, owner *Person) (record *Car)

NewCar returns a new instance of Car.

func (*Car) AfterDelete added in v0.13.0

func (c *Car) AfterDelete() error

func (*Car) AfterSave added in v0.13.0

func (c *Car) AfterSave() error

func (*Car) BeforeDelete added in v0.13.0

func (c *Car) BeforeDelete() error

func (*Car) BeforeSave added in v0.13.0

func (c *Car) BeforeSave() error

func (*Car) ColumnAddress added in v0.12.0

func (r *Car) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*Car) GetID added in v0.13.0

func (r *Car) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*Car) NewRelationshipRecord added in v0.12.0

func (r *Car) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*Car) SetRelationship added in v0.12.0

func (r *Car) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*Car) Value added in v0.12.0

func (r *Car) Value(col string) (interface{}, error)

Value returns the value of the given column.

type CarQuery added in v0.12.0

type CarQuery struct {
	*kallax.BaseQuery
}

CarQuery is the object used to create queries for the Car entity.

func NewCarQuery added in v0.12.0

func NewCarQuery() *CarQuery

NewCarQuery returns a new instance of CarQuery.

func (*CarQuery) BatchSize added in v0.12.0

func (q *CarQuery) BatchSize(size uint64) *CarQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*CarQuery) Copy added in v0.12.0

func (q *CarQuery) Copy() *CarQuery

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*CarQuery) Limit added in v0.12.0

func (q *CarQuery) Limit(n uint64) *CarQuery

Limit sets the max number of items to retrieve.

func (*CarQuery) Offset added in v0.12.0

func (q *CarQuery) Offset(n uint64) *CarQuery

Offset sets the number of items to skip from the result set of items.

func (*CarQuery) Order added in v0.12.0

func (q *CarQuery) Order(cols ...kallax.ColumnOrder) *CarQuery

Order adds order clauses to the query for the given columns.

func (*CarQuery) Select added in v0.12.0

func (q *CarQuery) Select(columns ...kallax.SchemaField) *CarQuery

Select adds columns to select in the query.

func (*CarQuery) SelectNot added in v0.12.0

func (q *CarQuery) SelectNot(columns ...kallax.SchemaField) *CarQuery

SelectNot excludes columns from being selected in the query.

func (*CarQuery) Where added in v0.12.0

func (q *CarQuery) Where(cond kallax.Condition) *CarQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

func (*CarQuery) WithOwner added in v0.12.0

func (q *CarQuery) WithOwner() *CarQuery

type CarResultSet added in v0.12.0

type CarResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

CarResultSet is the set of results returned by a query to the database.

func NewCarResultSet added in v0.12.0

func NewCarResultSet(rs kallax.ResultSet) *CarResultSet

NewCarResultSet creates a new result set for rows of the type Car.

func (*CarResultSet) All added in v0.12.0

func (rs *CarResultSet) All() ([]*Car, error)

All returns all records on the result set and closes the result set.

func (*CarResultSet) Close added in v0.12.0

func (rs *CarResultSet) Close() error

Close closes the result set.

func (*CarResultSet) Err added in v0.12.0

func (rs *CarResultSet) Err() error

Err returns the last error occurred.

func (*CarResultSet) ForEach added in v0.12.0

func (rs *CarResultSet) ForEach(fn func(*Car) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*CarResultSet) Get added in v0.12.0

func (rs *CarResultSet) Get() (*Car, error)

Get retrieves the last fetched item from the result set and the last error.

func (*CarResultSet) Next added in v0.12.0

func (rs *CarResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*CarResultSet) One added in v0.12.0

func (rs *CarResultSet) One() (*Car, error)

One returns the first record on the result set and closes the result set.

type CarStore added in v0.12.0

type CarStore struct {
	*kallax.Store
}

CarStore is the entity to access the records of the type Car in the database.

func NewCarStore added in v0.12.0

func NewCarStore(db *sql.DB) *CarStore

NewCarStore creates a new instance of CarStore using a SQL database.

func (*CarStore) Count added in v0.12.0

func (s *CarStore) Count(q *CarQuery) (int64, error)

Count returns the number of rows that would be retrieved with the given query.

func (*CarStore) Delete added in v0.12.0

func (s *CarStore) Delete(record *Car) error

Delete removes the given record from the database.

func (*CarStore) Find added in v0.12.0

func (s *CarStore) Find(q *CarQuery) (*CarResultSet, error)

Find returns the set of results for the given query.

func (*CarStore) FindOne added in v0.12.0

func (s *CarStore) FindOne(q *CarQuery) (*Car, error)

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*CarStore) Insert added in v0.12.0

func (s *CarStore) Insert(record *Car) error

Insert inserts a Car in the database. A non-persisted object is required for this operation.

func (*CarStore) MustCount added in v0.12.0

func (s *CarStore) MustCount(q *CarQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*CarStore) MustFind added in v0.12.0

func (s *CarStore) MustFind(q *CarQuery) *CarResultSet

MustFind returns the set of results for the given query, but panics if there is any error.

func (*CarStore) MustFindOne added in v0.12.0

func (s *CarStore) MustFindOne(q *CarQuery) *Car

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*CarStore) Reload added in v0.12.0

func (s *CarStore) Reload(record *Car) error

Reload refreshes the Car with the data in the database and makes it writable.

func (*CarStore) Save added in v0.12.0

func (s *CarStore) Save(record *Car) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*CarStore) Transaction added in v0.12.0

func (s *CarStore) Transaction(callback func(*CarStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*CarStore) Update added in v0.12.0

func (s *CarStore) Update(record *Car, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type EventsAllFixture added in v0.13.0

type EventsAllFixture struct {
	kallax.Model   `table:"event"`
	ID             kallax.ULID `pk:""`
	Checks         map[string]bool
	MustFailBefore error
	MustFailAfter  error
}

func NewEventsAllFixture added in v0.13.0

func NewEventsAllFixture() (record *EventsAllFixture)

NewEventsAllFixture returns a new instance of EventsAllFixture.

func (*EventsAllFixture) AfterInsert added in v0.13.0

func (s *EventsAllFixture) AfterInsert() error

func (*EventsAllFixture) AfterSave added in v0.13.0

func (s *EventsAllFixture) AfterSave() error

func (*EventsAllFixture) AfterUpdate added in v0.13.0

func (s *EventsAllFixture) AfterUpdate() error

func (*EventsAllFixture) BeforeInsert added in v0.13.0

func (s *EventsAllFixture) BeforeInsert() error

func (*EventsAllFixture) BeforeSave added in v0.13.0

func (s *EventsAllFixture) BeforeSave() error

func (*EventsAllFixture) BeforeUpdate added in v0.13.0

func (s *EventsAllFixture) BeforeUpdate() error

func (*EventsAllFixture) ColumnAddress added in v0.13.0

func (r *EventsAllFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*EventsAllFixture) GetID added in v0.13.0

func (r *EventsAllFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*EventsAllFixture) NewRelationshipRecord added in v0.13.0

func (r *EventsAllFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*EventsAllFixture) SetRelationship added in v0.13.0

func (r *EventsAllFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*EventsAllFixture) Value added in v0.13.0

func (r *EventsAllFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type EventsAllFixtureQuery added in v0.13.0

type EventsAllFixtureQuery struct {
	*kallax.BaseQuery
}

EventsAllFixtureQuery is the object used to create queries for the EventsAllFixture entity.

func NewEventsAllFixtureQuery added in v0.13.0

func NewEventsAllFixtureQuery() *EventsAllFixtureQuery

NewEventsAllFixtureQuery returns a new instance of EventsAllFixtureQuery.

func (*EventsAllFixtureQuery) BatchSize added in v0.13.0

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*EventsAllFixtureQuery) Copy added in v0.13.0

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*EventsAllFixtureQuery) Limit added in v0.13.0

Limit sets the max number of items to retrieve.

func (*EventsAllFixtureQuery) Offset added in v0.13.0

Offset sets the number of items to skip from the result set of items.

func (*EventsAllFixtureQuery) Order added in v0.13.0

func (q *EventsAllFixtureQuery) Order(cols ...kallax.ColumnOrder) *EventsAllFixtureQuery

Order adds order clauses to the query for the given columns.

func (*EventsAllFixtureQuery) Select added in v0.13.0

func (q *EventsAllFixtureQuery) Select(columns ...kallax.SchemaField) *EventsAllFixtureQuery

Select adds columns to select in the query.

func (*EventsAllFixtureQuery) SelectNot added in v0.13.0

func (q *EventsAllFixtureQuery) SelectNot(columns ...kallax.SchemaField) *EventsAllFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*EventsAllFixtureQuery) Where added in v0.13.0

func (q *EventsAllFixtureQuery) Where(cond kallax.Condition) *EventsAllFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type EventsAllFixtureResultSet added in v0.13.0

type EventsAllFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

EventsAllFixtureResultSet is the set of results returned by a query to the database.

func NewEventsAllFixtureResultSet added in v0.13.0

func NewEventsAllFixtureResultSet(rs kallax.ResultSet) *EventsAllFixtureResultSet

NewEventsAllFixtureResultSet creates a new result set for rows of the type EventsAllFixture.

func (*EventsAllFixtureResultSet) All added in v0.13.0

All returns all records on the result set and closes the result set.

func (*EventsAllFixtureResultSet) Close added in v0.13.0

func (rs *EventsAllFixtureResultSet) Close() error

Close closes the result set.

func (*EventsAllFixtureResultSet) Err added in v0.13.0

func (rs *EventsAllFixtureResultSet) Err() error

Err returns the last error occurred.

func (*EventsAllFixtureResultSet) ForEach added in v0.13.0

func (rs *EventsAllFixtureResultSet) ForEach(fn func(*EventsAllFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*EventsAllFixtureResultSet) Get added in v0.13.0

Get retrieves the last fetched item from the result set and the last error.

func (*EventsAllFixtureResultSet) Next added in v0.13.0

func (rs *EventsAllFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*EventsAllFixtureResultSet) One added in v0.13.0

One returns the first record on the result set and closes the result set.

type EventsAllFixtureStore added in v0.13.0

type EventsAllFixtureStore struct {
	*kallax.Store
}

EventsAllFixtureStore is the entity to access the records of the type EventsAllFixture in the database.

func NewEventsAllFixtureStore added in v0.13.0

func NewEventsAllFixtureStore(db *sql.DB) *EventsAllFixtureStore

NewEventsAllFixtureStore creates a new instance of EventsAllFixtureStore using a SQL database.

func (*EventsAllFixtureStore) Count added in v0.13.0

Count returns the number of rows that would be retrieved with the given query.

func (*EventsAllFixtureStore) Delete added in v0.13.0

func (s *EventsAllFixtureStore) Delete(record *EventsAllFixture) error

Delete removes the given record from the database.

func (*EventsAllFixtureStore) Find added in v0.13.0

Find returns the set of results for the given query.

func (*EventsAllFixtureStore) FindOne added in v0.13.0

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*EventsAllFixtureStore) Insert added in v0.13.0

func (s *EventsAllFixtureStore) Insert(record *EventsAllFixture) error

Insert inserts a EventsAllFixture in the database. A non-persisted object is required for this operation.

func (*EventsAllFixtureStore) MustCount added in v0.13.0

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*EventsAllFixtureStore) MustFind added in v0.13.0

MustFind returns the set of results for the given query, but panics if there is any error.

func (*EventsAllFixtureStore) MustFindOne added in v0.13.0

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*EventsAllFixtureStore) Reload added in v0.13.0

func (s *EventsAllFixtureStore) Reload(record *EventsAllFixture) error

Reload refreshes the EventsAllFixture with the data in the database and makes it writable.

func (*EventsAllFixtureStore) Save added in v0.13.0

func (s *EventsAllFixtureStore) Save(record *EventsAllFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*EventsAllFixtureStore) Transaction added in v0.13.0

func (s *EventsAllFixtureStore) Transaction(callback func(*EventsAllFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*EventsAllFixtureStore) Update added in v0.13.0

func (s *EventsAllFixtureStore) Update(record *EventsAllFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type EventsFixture

type EventsFixture struct {
	kallax.Model   `table:"event"`
	ID             kallax.ULID `pk:""`
	Checks         map[string]bool
	MustFailBefore error
	MustFailAfter  error
}

func NewEventsFixture

func NewEventsFixture() (record *EventsFixture)

NewEventsFixture returns a new instance of EventsFixture.

func (*EventsFixture) AfterInsert added in v0.12.0

func (s *EventsFixture) AfterInsert() error

func (*EventsFixture) AfterUpdate added in v0.12.0

func (s *EventsFixture) AfterUpdate() error

func (*EventsFixture) BeforeInsert added in v0.12.0

func (s *EventsFixture) BeforeInsert() error

func (*EventsFixture) BeforeUpdate added in v0.12.0

func (s *EventsFixture) BeforeUpdate() error

func (*EventsFixture) ColumnAddress

func (r *EventsFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*EventsFixture) GetID added in v0.13.0

func (r *EventsFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*EventsFixture) NewRelationshipRecord

func (r *EventsFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*EventsFixture) SetRelationship

func (r *EventsFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*EventsFixture) Value

func (r *EventsFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type EventsFixtureQuery

type EventsFixtureQuery struct {
	*kallax.BaseQuery
}

EventsFixtureQuery is the object used to create queries for the EventsFixture entity.

func NewEventsFixtureQuery

func NewEventsFixtureQuery() *EventsFixtureQuery

NewEventsFixtureQuery returns a new instance of EventsFixtureQuery.

func (*EventsFixtureQuery) BatchSize

func (q *EventsFixtureQuery) BatchSize(size uint64) *EventsFixtureQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*EventsFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*EventsFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*EventsFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*EventsFixtureQuery) Order

func (q *EventsFixtureQuery) Order(cols ...kallax.ColumnOrder) *EventsFixtureQuery

Order adds order clauses to the query for the given columns.

func (*EventsFixtureQuery) Select

func (q *EventsFixtureQuery) Select(columns ...kallax.SchemaField) *EventsFixtureQuery

Select adds columns to select in the query.

func (*EventsFixtureQuery) SelectNot

func (q *EventsFixtureQuery) SelectNot(columns ...kallax.SchemaField) *EventsFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*EventsFixtureQuery) Where

func (q *EventsFixtureQuery) Where(cond kallax.Condition) *EventsFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type EventsFixtureResultSet

type EventsFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

EventsFixtureResultSet is the set of results returned by a query to the database.

func NewEventsFixtureResultSet

func NewEventsFixtureResultSet(rs kallax.ResultSet) *EventsFixtureResultSet

NewEventsFixtureResultSet creates a new result set for rows of the type EventsFixture.

func (*EventsFixtureResultSet) All

func (rs *EventsFixtureResultSet) All() ([]*EventsFixture, error)

All returns all records on the result set and closes the result set.

func (*EventsFixtureResultSet) Close added in v0.12.0

func (rs *EventsFixtureResultSet) Close() error

Close closes the result set.

func (*EventsFixtureResultSet) Err added in v0.12.0

func (rs *EventsFixtureResultSet) Err() error

Err returns the last error occurred.

func (*EventsFixtureResultSet) ForEach

func (rs *EventsFixtureResultSet) ForEach(fn func(*EventsFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*EventsFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*EventsFixtureResultSet) Next

func (rs *EventsFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*EventsFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type EventsFixtureStore

type EventsFixtureStore struct {
	*kallax.Store
}

EventsFixtureStore is the entity to access the records of the type EventsFixture in the database.

func NewEventsFixtureStore

func NewEventsFixtureStore(db *sql.DB) *EventsFixtureStore

NewEventsFixtureStore creates a new instance of EventsFixtureStore using a SQL database.

func (*EventsFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*EventsFixtureStore) Delete

func (s *EventsFixtureStore) Delete(record *EventsFixture) error

Delete removes the given record from the database.

func (*EventsFixtureStore) Find

Find returns the set of results for the given query.

func (*EventsFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*EventsFixtureStore) Insert

func (s *EventsFixtureStore) Insert(record *EventsFixture) error

Insert inserts a EventsFixture in the database. A non-persisted object is required for this operation.

func (*EventsFixtureStore) MustCount

func (s *EventsFixtureStore) MustCount(q *EventsFixtureQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*EventsFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*EventsFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*EventsFixtureStore) Reload

func (s *EventsFixtureStore) Reload(record *EventsFixture) error

Reload refreshes the EventsFixture with the data in the database and makes it writable.

func (*EventsFixtureStore) Save

func (s *EventsFixtureStore) Save(record *EventsFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*EventsFixtureStore) Transaction

func (s *EventsFixtureStore) Transaction(callback func(*EventsFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*EventsFixtureStore) Update

func (s *EventsFixtureStore) Update(record *EventsFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type EventsSaveFixture

type EventsSaveFixture struct {
	kallax.Model   `table:"event"`
	ID             kallax.ULID `pk:""`
	Checks         map[string]bool
	MustFailBefore error
	MustFailAfter  error
}

func NewEventsSaveFixture

func NewEventsSaveFixture() (record *EventsSaveFixture)

NewEventsSaveFixture returns a new instance of EventsSaveFixture.

func (*EventsSaveFixture) AfterSave added in v0.12.0

func (s *EventsSaveFixture) AfterSave() error

func (*EventsSaveFixture) BeforeSave added in v0.12.0

func (s *EventsSaveFixture) BeforeSave() error

func (*EventsSaveFixture) ColumnAddress

func (r *EventsSaveFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*EventsSaveFixture) GetID added in v0.13.0

func (r *EventsSaveFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*EventsSaveFixture) NewRelationshipRecord

func (r *EventsSaveFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*EventsSaveFixture) SetRelationship

func (r *EventsSaveFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*EventsSaveFixture) Value

func (r *EventsSaveFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type EventsSaveFixtureQuery

type EventsSaveFixtureQuery struct {
	*kallax.BaseQuery
}

EventsSaveFixtureQuery is the object used to create queries for the EventsSaveFixture entity.

func NewEventsSaveFixtureQuery

func NewEventsSaveFixtureQuery() *EventsSaveFixtureQuery

NewEventsSaveFixtureQuery returns a new instance of EventsSaveFixtureQuery.

func (*EventsSaveFixtureQuery) BatchSize

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*EventsSaveFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*EventsSaveFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*EventsSaveFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*EventsSaveFixtureQuery) Order

func (q *EventsSaveFixtureQuery) Order(cols ...kallax.ColumnOrder) *EventsSaveFixtureQuery

Order adds order clauses to the query for the given columns.

func (*EventsSaveFixtureQuery) Select

func (q *EventsSaveFixtureQuery) Select(columns ...kallax.SchemaField) *EventsSaveFixtureQuery

Select adds columns to select in the query.

func (*EventsSaveFixtureQuery) SelectNot

func (q *EventsSaveFixtureQuery) SelectNot(columns ...kallax.SchemaField) *EventsSaveFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*EventsSaveFixtureQuery) Where

func (q *EventsSaveFixtureQuery) Where(cond kallax.Condition) *EventsSaveFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type EventsSaveFixtureResultSet

type EventsSaveFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

EventsSaveFixtureResultSet is the set of results returned by a query to the database.

func NewEventsSaveFixtureResultSet

func NewEventsSaveFixtureResultSet(rs kallax.ResultSet) *EventsSaveFixtureResultSet

NewEventsSaveFixtureResultSet creates a new result set for rows of the type EventsSaveFixture.

func (*EventsSaveFixtureResultSet) All

All returns all records on the result set and closes the result set.

func (*EventsSaveFixtureResultSet) Close added in v0.12.0

func (rs *EventsSaveFixtureResultSet) Close() error

Close closes the result set.

func (*EventsSaveFixtureResultSet) Err added in v0.12.0

Err returns the last error occurred.

func (*EventsSaveFixtureResultSet) ForEach

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*EventsSaveFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*EventsSaveFixtureResultSet) Next

func (rs *EventsSaveFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*EventsSaveFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type EventsSaveFixtureStore

type EventsSaveFixtureStore struct {
	*kallax.Store
}

EventsSaveFixtureStore is the entity to access the records of the type EventsSaveFixture in the database.

func NewEventsSaveFixtureStore

func NewEventsSaveFixtureStore(db *sql.DB) *EventsSaveFixtureStore

NewEventsSaveFixtureStore creates a new instance of EventsSaveFixtureStore using a SQL database.

func (*EventsSaveFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*EventsSaveFixtureStore) Delete

func (s *EventsSaveFixtureStore) Delete(record *EventsSaveFixture) error

Delete removes the given record from the database.

func (*EventsSaveFixtureStore) Find

Find returns the set of results for the given query.

func (*EventsSaveFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*EventsSaveFixtureStore) Insert

func (s *EventsSaveFixtureStore) Insert(record *EventsSaveFixture) error

Insert inserts a EventsSaveFixture in the database. A non-persisted object is required for this operation.

func (*EventsSaveFixtureStore) MustCount

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*EventsSaveFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*EventsSaveFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*EventsSaveFixtureStore) Reload

func (s *EventsSaveFixtureStore) Reload(record *EventsSaveFixture) error

Reload refreshes the EventsSaveFixture with the data in the database and makes it writable.

func (*EventsSaveFixtureStore) Save

func (s *EventsSaveFixtureStore) Save(record *EventsSaveFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*EventsSaveFixtureStore) Transaction

func (s *EventsSaveFixtureStore) Transaction(callback func(*EventsSaveFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*EventsSaveFixtureStore) Update

func (s *EventsSaveFixtureStore) Update(record *EventsSaveFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type JSONModel added in v0.13.0

type JSONModel struct {
	kallax.Model `table:"jsons"`
	ID           kallax.ULID `pk:""`
	Foo          string
	Bar          *Bar
	BazSlice     []Baz
	Baz          map[string]interface{}
}

func NewJSONModel added in v0.13.0

func NewJSONModel() (record *JSONModel)

NewJSONModel returns a new instance of JSONModel.

func (*JSONModel) ColumnAddress added in v0.13.0

func (r *JSONModel) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*JSONModel) GetID added in v0.13.0

func (r *JSONModel) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*JSONModel) NewRelationshipRecord added in v0.13.0

func (r *JSONModel) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*JSONModel) SetRelationship added in v0.13.0

func (r *JSONModel) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*JSONModel) Value added in v0.13.0

func (r *JSONModel) Value(col string) (interface{}, error)

Value returns the value of the given column.

type JSONModelQuery added in v0.13.0

type JSONModelQuery struct {
	*kallax.BaseQuery
}

JSONModelQuery is the object used to create queries for the JSONModel entity.

func NewJSONModelQuery added in v0.13.0

func NewJSONModelQuery() *JSONModelQuery

NewJSONModelQuery returns a new instance of JSONModelQuery.

func (*JSONModelQuery) BatchSize added in v0.13.0

func (q *JSONModelQuery) BatchSize(size uint64) *JSONModelQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*JSONModelQuery) Copy added in v0.13.0

func (q *JSONModelQuery) Copy() *JSONModelQuery

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*JSONModelQuery) Limit added in v0.13.0

func (q *JSONModelQuery) Limit(n uint64) *JSONModelQuery

Limit sets the max number of items to retrieve.

func (*JSONModelQuery) Offset added in v0.13.0

func (q *JSONModelQuery) Offset(n uint64) *JSONModelQuery

Offset sets the number of items to skip from the result set of items.

func (*JSONModelQuery) Order added in v0.13.0

func (q *JSONModelQuery) Order(cols ...kallax.ColumnOrder) *JSONModelQuery

Order adds order clauses to the query for the given columns.

func (*JSONModelQuery) Select added in v0.13.0

func (q *JSONModelQuery) Select(columns ...kallax.SchemaField) *JSONModelQuery

Select adds columns to select in the query.

func (*JSONModelQuery) SelectNot added in v0.13.0

func (q *JSONModelQuery) SelectNot(columns ...kallax.SchemaField) *JSONModelQuery

SelectNot excludes columns from being selected in the query.

func (*JSONModelQuery) Where added in v0.13.0

func (q *JSONModelQuery) Where(cond kallax.Condition) *JSONModelQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type JSONModelResultSet added in v0.13.0

type JSONModelResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

JSONModelResultSet is the set of results returned by a query to the database.

func NewJSONModelResultSet added in v0.13.0

func NewJSONModelResultSet(rs kallax.ResultSet) *JSONModelResultSet

NewJSONModelResultSet creates a new result set for rows of the type JSONModel.

func (*JSONModelResultSet) All added in v0.13.0

func (rs *JSONModelResultSet) All() ([]*JSONModel, error)

All returns all records on the result set and closes the result set.

func (*JSONModelResultSet) Close added in v0.13.0

func (rs *JSONModelResultSet) Close() error

Close closes the result set.

func (*JSONModelResultSet) Err added in v0.13.0

func (rs *JSONModelResultSet) Err() error

Err returns the last error occurred.

func (*JSONModelResultSet) ForEach added in v0.13.0

func (rs *JSONModelResultSet) ForEach(fn func(*JSONModel) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*JSONModelResultSet) Get added in v0.13.0

func (rs *JSONModelResultSet) Get() (*JSONModel, error)

Get retrieves the last fetched item from the result set and the last error.

func (*JSONModelResultSet) Next added in v0.13.0

func (rs *JSONModelResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*JSONModelResultSet) One added in v0.13.0

func (rs *JSONModelResultSet) One() (*JSONModel, error)

One returns the first record on the result set and closes the result set.

type JSONModelStore added in v0.13.0

type JSONModelStore struct {
	*kallax.Store
}

JSONModelStore is the entity to access the records of the type JSONModel in the database.

func NewJSONModelStore added in v0.13.0

func NewJSONModelStore(db *sql.DB) *JSONModelStore

NewJSONModelStore creates a new instance of JSONModelStore using a SQL database.

func (*JSONModelStore) Count added in v0.13.0

func (s *JSONModelStore) Count(q *JSONModelQuery) (int64, error)

Count returns the number of rows that would be retrieved with the given query.

func (*JSONModelStore) Delete added in v0.13.0

func (s *JSONModelStore) Delete(record *JSONModel) error

Delete removes the given record from the database.

func (*JSONModelStore) Find added in v0.13.0

Find returns the set of results for the given query.

func (*JSONModelStore) FindOne added in v0.13.0

func (s *JSONModelStore) FindOne(q *JSONModelQuery) (*JSONModel, error)

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*JSONModelStore) Insert added in v0.13.0

func (s *JSONModelStore) Insert(record *JSONModel) error

Insert inserts a JSONModel in the database. A non-persisted object is required for this operation.

func (*JSONModelStore) MustCount added in v0.13.0

func (s *JSONModelStore) MustCount(q *JSONModelQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*JSONModelStore) MustFind added in v0.13.0

MustFind returns the set of results for the given query, but panics if there is any error.

func (*JSONModelStore) MustFindOne added in v0.13.0

func (s *JSONModelStore) MustFindOne(q *JSONModelQuery) *JSONModel

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*JSONModelStore) Reload added in v0.13.0

func (s *JSONModelStore) Reload(record *JSONModel) error

Reload refreshes the JSONModel with the data in the database and makes it writable.

func (*JSONModelStore) Save added in v0.13.0

func (s *JSONModelStore) Save(record *JSONModel) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*JSONModelStore) Transaction added in v0.13.0

func (s *JSONModelStore) Transaction(callback func(*JSONModelStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*JSONModelStore) Update added in v0.13.0

func (s *JSONModelStore) Update(record *JSONModel, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type MultiKeySortFixture

type MultiKeySortFixture struct {
	kallax.Model `table:"query"`
	ID           kallax.ULID `pk:""`
	Name         string
	Start        time.Time
	End          time.Time
}

func NewMultiKeySortFixture

func NewMultiKeySortFixture() (record *MultiKeySortFixture)

NewMultiKeySortFixture returns a new instance of MultiKeySortFixture.

func (*MultiKeySortFixture) ColumnAddress

func (r *MultiKeySortFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*MultiKeySortFixture) GetID added in v0.13.0

func (r *MultiKeySortFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*MultiKeySortFixture) NewRelationshipRecord

func (r *MultiKeySortFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*MultiKeySortFixture) SetRelationship

func (r *MultiKeySortFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*MultiKeySortFixture) Value

func (r *MultiKeySortFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type MultiKeySortFixtureQuery

type MultiKeySortFixtureQuery struct {
	*kallax.BaseQuery
}

MultiKeySortFixtureQuery is the object used to create queries for the MultiKeySortFixture entity.

func NewMultiKeySortFixtureQuery

func NewMultiKeySortFixtureQuery() *MultiKeySortFixtureQuery

NewMultiKeySortFixtureQuery returns a new instance of MultiKeySortFixtureQuery.

func (*MultiKeySortFixtureQuery) BatchSize

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*MultiKeySortFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*MultiKeySortFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*MultiKeySortFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*MultiKeySortFixtureQuery) Order

func (q *MultiKeySortFixtureQuery) Order(cols ...kallax.ColumnOrder) *MultiKeySortFixtureQuery

Order adds order clauses to the query for the given columns.

func (*MultiKeySortFixtureQuery) Select

func (q *MultiKeySortFixtureQuery) Select(columns ...kallax.SchemaField) *MultiKeySortFixtureQuery

Select adds columns to select in the query.

func (*MultiKeySortFixtureQuery) SelectNot

func (q *MultiKeySortFixtureQuery) SelectNot(columns ...kallax.SchemaField) *MultiKeySortFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*MultiKeySortFixtureQuery) Where

func (q *MultiKeySortFixtureQuery) Where(cond kallax.Condition) *MultiKeySortFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type MultiKeySortFixtureResultSet

type MultiKeySortFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

MultiKeySortFixtureResultSet is the set of results returned by a query to the database.

func NewMultiKeySortFixtureResultSet

func NewMultiKeySortFixtureResultSet(rs kallax.ResultSet) *MultiKeySortFixtureResultSet

NewMultiKeySortFixtureResultSet creates a new result set for rows of the type MultiKeySortFixture.

func (*MultiKeySortFixtureResultSet) All

All returns all records on the result set and closes the result set.

func (*MultiKeySortFixtureResultSet) Close added in v0.12.0

func (rs *MultiKeySortFixtureResultSet) Close() error

Close closes the result set.

func (*MultiKeySortFixtureResultSet) Err added in v0.12.0

Err returns the last error occurred.

func (*MultiKeySortFixtureResultSet) ForEach

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*MultiKeySortFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*MultiKeySortFixtureResultSet) Next

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*MultiKeySortFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type MultiKeySortFixtureStore

type MultiKeySortFixtureStore struct {
	*kallax.Store
}

MultiKeySortFixtureStore is the entity to access the records of the type MultiKeySortFixture in the database.

func NewMultiKeySortFixtureStore

func NewMultiKeySortFixtureStore(db *sql.DB) *MultiKeySortFixtureStore

NewMultiKeySortFixtureStore creates a new instance of MultiKeySortFixtureStore using a SQL database.

func (*MultiKeySortFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*MultiKeySortFixtureStore) Delete

Delete removes the given record from the database.

func (*MultiKeySortFixtureStore) Find

Find returns the set of results for the given query.

func (*MultiKeySortFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*MultiKeySortFixtureStore) Insert

Insert inserts a MultiKeySortFixture in the database. A non-persisted object is required for this operation.

func (*MultiKeySortFixtureStore) MustCount

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*MultiKeySortFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*MultiKeySortFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*MultiKeySortFixtureStore) Reload

Reload refreshes the MultiKeySortFixture with the data in the database and makes it writable.

func (*MultiKeySortFixtureStore) Save

func (s *MultiKeySortFixtureStore) Save(record *MultiKeySortFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*MultiKeySortFixtureStore) Transaction

func (s *MultiKeySortFixtureStore) Transaction(callback func(*MultiKeySortFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*MultiKeySortFixtureStore) Update

func (s *MultiKeySortFixtureStore) Update(record *MultiKeySortFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type Person added in v0.12.0

type Person struct {
	kallax.Model `table:"persons"`
	ID           int64 `pk:"autoincr"`
	Name         string
	Pets         []*Pet `fk:"owner_id"`
	Car          *Car   `fk:"owner_id"`
	// contains filtered or unexported fields
}

func NewPerson added in v0.12.0

func NewPerson(name string) (record *Person)

NewPerson returns a new instance of Person.

func (*Person) AfterDelete added in v0.13.0

func (c *Person) AfterDelete() error

func (*Person) AfterSave added in v0.13.0

func (c *Person) AfterSave() error

func (*Person) BeforeDelete added in v0.13.0

func (c *Person) BeforeDelete() error

func (*Person) BeforeSave added in v0.13.0

func (c *Person) BeforeSave() error

func (*Person) ColumnAddress added in v0.12.0

func (r *Person) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*Person) GetID added in v0.13.0

func (r *Person) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*Person) NewRelationshipRecord added in v0.12.0

func (r *Person) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*Person) SetRelationship added in v0.12.0

func (r *Person) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*Person) Value added in v0.12.0

func (r *Person) Value(col string) (interface{}, error)

Value returns the value of the given column.

type PersonQuery added in v0.12.0

type PersonQuery struct {
	*kallax.BaseQuery
}

PersonQuery is the object used to create queries for the Person entity.

func NewPersonQuery added in v0.12.0

func NewPersonQuery() *PersonQuery

NewPersonQuery returns a new instance of PersonQuery.

func (*PersonQuery) BatchSize added in v0.12.0

func (q *PersonQuery) BatchSize(size uint64) *PersonQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*PersonQuery) Copy added in v0.12.0

func (q *PersonQuery) Copy() *PersonQuery

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*PersonQuery) Limit added in v0.12.0

func (q *PersonQuery) Limit(n uint64) *PersonQuery

Limit sets the max number of items to retrieve.

func (*PersonQuery) Offset added in v0.12.0

func (q *PersonQuery) Offset(n uint64) *PersonQuery

Offset sets the number of items to skip from the result set of items.

func (*PersonQuery) Order added in v0.12.0

func (q *PersonQuery) Order(cols ...kallax.ColumnOrder) *PersonQuery

Order adds order clauses to the query for the given columns.

func (*PersonQuery) Select added in v0.12.0

func (q *PersonQuery) Select(columns ...kallax.SchemaField) *PersonQuery

Select adds columns to select in the query.

func (*PersonQuery) SelectNot added in v0.12.0

func (q *PersonQuery) SelectNot(columns ...kallax.SchemaField) *PersonQuery

SelectNot excludes columns from being selected in the query.

func (*PersonQuery) Where added in v0.12.0

func (q *PersonQuery) Where(cond kallax.Condition) *PersonQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

func (*PersonQuery) WithCar added in v0.12.0

func (q *PersonQuery) WithCar() *PersonQuery

func (*PersonQuery) WithPets added in v0.12.0

func (q *PersonQuery) WithPets(cond kallax.Condition) *PersonQuery

type PersonResultSet added in v0.12.0

type PersonResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

PersonResultSet is the set of results returned by a query to the database.

func NewPersonResultSet added in v0.12.0

func NewPersonResultSet(rs kallax.ResultSet) *PersonResultSet

NewPersonResultSet creates a new result set for rows of the type Person.

func (*PersonResultSet) All added in v0.12.0

func (rs *PersonResultSet) All() ([]*Person, error)

All returns all records on the result set and closes the result set.

func (*PersonResultSet) Close added in v0.12.0

func (rs *PersonResultSet) Close() error

Close closes the result set.

func (*PersonResultSet) Err added in v0.12.0

func (rs *PersonResultSet) Err() error

Err returns the last error occurred.

func (*PersonResultSet) ForEach added in v0.12.0

func (rs *PersonResultSet) ForEach(fn func(*Person) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*PersonResultSet) Get added in v0.12.0

func (rs *PersonResultSet) Get() (*Person, error)

Get retrieves the last fetched item from the result set and the last error.

func (*PersonResultSet) Next added in v0.12.0

func (rs *PersonResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*PersonResultSet) One added in v0.12.0

func (rs *PersonResultSet) One() (*Person, error)

One returns the first record on the result set and closes the result set.

type PersonStore added in v0.12.0

type PersonStore struct {
	*kallax.Store
}

PersonStore is the entity to access the records of the type Person in the database.

func NewPersonStore added in v0.12.0

func NewPersonStore(db *sql.DB) *PersonStore

NewPersonStore creates a new instance of PersonStore using a SQL database.

func (*PersonStore) Count added in v0.12.0

func (s *PersonStore) Count(q *PersonQuery) (int64, error)

Count returns the number of rows that would be retrieved with the given query.

func (*PersonStore) Delete added in v0.12.0

func (s *PersonStore) Delete(record *Person) error

Delete removes the given record from the database.

func (*PersonStore) Find added in v0.12.0

func (s *PersonStore) Find(q *PersonQuery) (*PersonResultSet, error)

Find returns the set of results for the given query.

func (*PersonStore) FindOne added in v0.12.0

func (s *PersonStore) FindOne(q *PersonQuery) (*Person, error)

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*PersonStore) Insert added in v0.12.0

func (s *PersonStore) Insert(record *Person) error

Insert inserts a Person in the database. A non-persisted object is required for this operation.

func (*PersonStore) MustCount added in v0.12.0

func (s *PersonStore) MustCount(q *PersonQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*PersonStore) MustFind added in v0.12.0

func (s *PersonStore) MustFind(q *PersonQuery) *PersonResultSet

MustFind returns the set of results for the given query, but panics if there is any error.

func (*PersonStore) MustFindOne added in v0.12.0

func (s *PersonStore) MustFindOne(q *PersonQuery) *Person

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*PersonStore) Reload added in v0.12.0

func (s *PersonStore) Reload(record *Person) error

Reload refreshes the Person with the data in the database and makes it writable.

func (*PersonStore) RemoveCar added in v0.12.0

func (s *PersonStore) RemoveCar(record *Person) error

RemoveCar removes from the database the given relationship of the model. It also resets the field Car of the model.

func (*PersonStore) RemovePets added in v0.12.0

func (s *PersonStore) RemovePets(record *Person, deleted ...*Pet) error

RemovePets removes the given items of the Pets field of the model. If no items are given, it removes all of them. The items will also be removed from the passed record inside this method.

func (*PersonStore) Save added in v0.12.0

func (s *PersonStore) Save(record *Person) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*PersonStore) Transaction added in v0.12.0

func (s *PersonStore) Transaction(callback func(*PersonStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*PersonStore) Update added in v0.12.0

func (s *PersonStore) Update(record *Person, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type Pet added in v0.12.0

type Pet struct {
	kallax.Model `table:"pets"`
	ID           kallax.ULID `pk:""`
	Name         string
	Kind         string
	Owner        *Person `fk:"owner_id,inverse"`
	// contains filtered or unexported fields
}

func NewPet added in v0.12.0

func NewPet(name string, kind string, owner *Person) (record *Pet)

NewPet returns a new instance of Pet.

func (*Pet) AfterDelete added in v0.13.0

func (c *Pet) AfterDelete() error

func (*Pet) AfterSave added in v0.13.0

func (c *Pet) AfterSave() error

func (*Pet) BeforeDelete added in v0.13.0

func (c *Pet) BeforeDelete() error

func (*Pet) BeforeSave added in v0.13.0

func (c *Pet) BeforeSave() error

func (*Pet) ColumnAddress added in v0.12.0

func (r *Pet) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*Pet) GetID added in v0.13.0

func (r *Pet) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*Pet) NewRelationshipRecord added in v0.12.0

func (r *Pet) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*Pet) SetRelationship added in v0.12.0

func (r *Pet) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*Pet) Value added in v0.12.0

func (r *Pet) Value(col string) (interface{}, error)

Value returns the value of the given column.

type PetQuery added in v0.12.0

type PetQuery struct {
	*kallax.BaseQuery
}

PetQuery is the object used to create queries for the Pet entity.

func NewPetQuery added in v0.12.0

func NewPetQuery() *PetQuery

NewPetQuery returns a new instance of PetQuery.

func (*PetQuery) BatchSize added in v0.12.0

func (q *PetQuery) BatchSize(size uint64) *PetQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*PetQuery) Copy added in v0.12.0

func (q *PetQuery) Copy() *PetQuery

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*PetQuery) Limit added in v0.12.0

func (q *PetQuery) Limit(n uint64) *PetQuery

Limit sets the max number of items to retrieve.

func (*PetQuery) Offset added in v0.12.0

func (q *PetQuery) Offset(n uint64) *PetQuery

Offset sets the number of items to skip from the result set of items.

func (*PetQuery) Order added in v0.12.0

func (q *PetQuery) Order(cols ...kallax.ColumnOrder) *PetQuery

Order adds order clauses to the query for the given columns.

func (*PetQuery) Select added in v0.12.0

func (q *PetQuery) Select(columns ...kallax.SchemaField) *PetQuery

Select adds columns to select in the query.

func (*PetQuery) SelectNot added in v0.12.0

func (q *PetQuery) SelectNot(columns ...kallax.SchemaField) *PetQuery

SelectNot excludes columns from being selected in the query.

func (*PetQuery) Where added in v0.12.0

func (q *PetQuery) Where(cond kallax.Condition) *PetQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

func (*PetQuery) WithOwner added in v0.12.0

func (q *PetQuery) WithOwner() *PetQuery

type PetResultSet added in v0.12.0

type PetResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

PetResultSet is the set of results returned by a query to the database.

func NewPetResultSet added in v0.12.0

func NewPetResultSet(rs kallax.ResultSet) *PetResultSet

NewPetResultSet creates a new result set for rows of the type Pet.

func (*PetResultSet) All added in v0.12.0

func (rs *PetResultSet) All() ([]*Pet, error)

All returns all records on the result set and closes the result set.

func (*PetResultSet) Close added in v0.12.0

func (rs *PetResultSet) Close() error

Close closes the result set.

func (*PetResultSet) Err added in v0.12.0

func (rs *PetResultSet) Err() error

Err returns the last error occurred.

func (*PetResultSet) ForEach added in v0.12.0

func (rs *PetResultSet) ForEach(fn func(*Pet) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*PetResultSet) Get added in v0.12.0

func (rs *PetResultSet) Get() (*Pet, error)

Get retrieves the last fetched item from the result set and the last error.

func (*PetResultSet) Next added in v0.12.0

func (rs *PetResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*PetResultSet) One added in v0.12.0

func (rs *PetResultSet) One() (*Pet, error)

One returns the first record on the result set and closes the result set.

type PetStore added in v0.12.0

type PetStore struct {
	*kallax.Store
}

PetStore is the entity to access the records of the type Pet in the database.

func NewPetStore added in v0.12.0

func NewPetStore(db *sql.DB) *PetStore

NewPetStore creates a new instance of PetStore using a SQL database.

func (*PetStore) Count added in v0.12.0

func (s *PetStore) Count(q *PetQuery) (int64, error)

Count returns the number of rows that would be retrieved with the given query.

func (*PetStore) Delete added in v0.12.0

func (s *PetStore) Delete(record *Pet) error

Delete removes the given record from the database.

func (*PetStore) Find added in v0.12.0

func (s *PetStore) Find(q *PetQuery) (*PetResultSet, error)

Find returns the set of results for the given query.

func (*PetStore) FindOne added in v0.12.0

func (s *PetStore) FindOne(q *PetQuery) (*Pet, error)

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*PetStore) Insert added in v0.12.0

func (s *PetStore) Insert(record *Pet) error

Insert inserts a Pet in the database. A non-persisted object is required for this operation.

func (*PetStore) MustCount added in v0.12.0

func (s *PetStore) MustCount(q *PetQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*PetStore) MustFind added in v0.12.0

func (s *PetStore) MustFind(q *PetQuery) *PetResultSet

MustFind returns the set of results for the given query, but panics if there is any error.

func (*PetStore) MustFindOne added in v0.12.0

func (s *PetStore) MustFindOne(q *PetQuery) *Pet

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*PetStore) Reload added in v0.12.0

func (s *PetStore) Reload(record *Pet) error

Reload refreshes the Pet with the data in the database and makes it writable.

func (*PetStore) Save added in v0.12.0

func (s *PetStore) Save(record *Pet) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*PetStore) Transaction added in v0.12.0

func (s *PetStore) Transaction(callback func(*PetStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*PetStore) Update added in v0.12.0

func (s *PetStore) Update(record *Pet, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type QueryFixture

type QueryFixture struct {
	kallax.Model `table:"query"`
	ID           kallax.ULID `pk:""`
	Foo          string
}

func NewQueryFixture

func NewQueryFixture(f string) (record *QueryFixture)

NewQueryFixture returns a new instance of QueryFixture.

func (*QueryFixture) ColumnAddress

func (r *QueryFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*QueryFixture) GetID added in v0.13.0

func (r *QueryFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*QueryFixture) NewRelationshipRecord

func (r *QueryFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*QueryFixture) SetRelationship

func (r *QueryFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*QueryFixture) Value

func (r *QueryFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type QueryFixtureQuery

type QueryFixtureQuery struct {
	*kallax.BaseQuery
}

QueryFixtureQuery is the object used to create queries for the QueryFixture entity.

func NewQueryFixtureQuery

func NewQueryFixtureQuery() *QueryFixtureQuery

NewQueryFixtureQuery returns a new instance of QueryFixtureQuery.

func (*QueryFixtureQuery) BatchSize

func (q *QueryFixtureQuery) BatchSize(size uint64) *QueryFixtureQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*QueryFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*QueryFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*QueryFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*QueryFixtureQuery) Order

func (q *QueryFixtureQuery) Order(cols ...kallax.ColumnOrder) *QueryFixtureQuery

Order adds order clauses to the query for the given columns.

func (*QueryFixtureQuery) Select

func (q *QueryFixtureQuery) Select(columns ...kallax.SchemaField) *QueryFixtureQuery

Select adds columns to select in the query.

func (*QueryFixtureQuery) SelectNot

func (q *QueryFixtureQuery) SelectNot(columns ...kallax.SchemaField) *QueryFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*QueryFixtureQuery) Where

func (q *QueryFixtureQuery) Where(cond kallax.Condition) *QueryFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type QueryFixtureResultSet

type QueryFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

QueryFixtureResultSet is the set of results returned by a query to the database.

func NewQueryFixtureResultSet

func NewQueryFixtureResultSet(rs kallax.ResultSet) *QueryFixtureResultSet

NewQueryFixtureResultSet creates a new result set for rows of the type QueryFixture.

func (*QueryFixtureResultSet) All

func (rs *QueryFixtureResultSet) All() ([]*QueryFixture, error)

All returns all records on the result set and closes the result set.

func (*QueryFixtureResultSet) Close added in v0.12.0

func (rs *QueryFixtureResultSet) Close() error

Close closes the result set.

func (*QueryFixtureResultSet) Err added in v0.12.0

func (rs *QueryFixtureResultSet) Err() error

Err returns the last error occurred.

func (*QueryFixtureResultSet) ForEach

func (rs *QueryFixtureResultSet) ForEach(fn func(*QueryFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*QueryFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*QueryFixtureResultSet) Next

func (rs *QueryFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*QueryFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type QueryFixtureStore

type QueryFixtureStore struct {
	*kallax.Store
}

QueryFixtureStore is the entity to access the records of the type QueryFixture in the database.

func NewQueryFixtureStore

func NewQueryFixtureStore(db *sql.DB) *QueryFixtureStore

NewQueryFixtureStore creates a new instance of QueryFixtureStore using a SQL database.

func (*QueryFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*QueryFixtureStore) Delete

func (s *QueryFixtureStore) Delete(record *QueryFixture) error

Delete removes the given record from the database.

func (*QueryFixtureStore) Find

Find returns the set of results for the given query.

func (*QueryFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*QueryFixtureStore) Insert

func (s *QueryFixtureStore) Insert(record *QueryFixture) error

Insert inserts a QueryFixture in the database. A non-persisted object is required for this operation.

func (*QueryFixtureStore) MustCount

func (s *QueryFixtureStore) MustCount(q *QueryFixtureQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*QueryFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*QueryFixtureStore) MustFindOne

func (s *QueryFixtureStore) MustFindOne(q *QueryFixtureQuery) *QueryFixture

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*QueryFixtureStore) Reload

func (s *QueryFixtureStore) Reload(record *QueryFixture) error

Reload refreshes the QueryFixture with the data in the database and makes it writable.

func (*QueryFixtureStore) Save

func (s *QueryFixtureStore) Save(record *QueryFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*QueryFixtureStore) Transaction

func (s *QueryFixtureStore) Transaction(callback func(*QueryFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*QueryFixtureStore) Update

func (s *QueryFixtureStore) Update(record *QueryFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type Qux added in v0.13.0

type Qux struct {
	Schnooga string
	Balooga  int
	Boo      float64
}

type ResultSetFixture

type ResultSetFixture struct {
	kallax.Model `table:"resultset"`
	ID           kallax.ULID `pk:""`
	Foo          string
}

func NewResultSetFixture

func NewResultSetFixture(f string) (record *ResultSetFixture)

NewResultSetFixture returns a new instance of ResultSetFixture.

func (*ResultSetFixture) ColumnAddress

func (r *ResultSetFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*ResultSetFixture) GetID added in v0.13.0

func (r *ResultSetFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*ResultSetFixture) NewRelationshipRecord

func (r *ResultSetFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*ResultSetFixture) SetRelationship

func (r *ResultSetFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*ResultSetFixture) Value

func (r *ResultSetFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type ResultSetFixtureQuery

type ResultSetFixtureQuery struct {
	*kallax.BaseQuery
}

ResultSetFixtureQuery is the object used to create queries for the ResultSetFixture entity.

func NewResultSetFixtureQuery

func NewResultSetFixtureQuery() *ResultSetFixtureQuery

NewResultSetFixtureQuery returns a new instance of ResultSetFixtureQuery.

func (*ResultSetFixtureQuery) BatchSize

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*ResultSetFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*ResultSetFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*ResultSetFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*ResultSetFixtureQuery) Order

func (q *ResultSetFixtureQuery) Order(cols ...kallax.ColumnOrder) *ResultSetFixtureQuery

Order adds order clauses to the query for the given columns.

func (*ResultSetFixtureQuery) Select

func (q *ResultSetFixtureQuery) Select(columns ...kallax.SchemaField) *ResultSetFixtureQuery

Select adds columns to select in the query.

func (*ResultSetFixtureQuery) SelectNot

func (q *ResultSetFixtureQuery) SelectNot(columns ...kallax.SchemaField) *ResultSetFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*ResultSetFixtureQuery) Where

func (q *ResultSetFixtureQuery) Where(cond kallax.Condition) *ResultSetFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type ResultSetFixtureResultSet

type ResultSetFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

ResultSetFixtureResultSet is the set of results returned by a query to the database.

func NewResultSetFixtureResultSet

func NewResultSetFixtureResultSet(rs kallax.ResultSet) *ResultSetFixtureResultSet

NewResultSetFixtureResultSet creates a new result set for rows of the type ResultSetFixture.

func (*ResultSetFixtureResultSet) All

All returns all records on the result set and closes the result set.

func (*ResultSetFixtureResultSet) Close added in v0.12.0

func (rs *ResultSetFixtureResultSet) Close() error

Close closes the result set.

func (*ResultSetFixtureResultSet) Err added in v0.12.0

func (rs *ResultSetFixtureResultSet) Err() error

Err returns the last error occurred.

func (*ResultSetFixtureResultSet) ForEach

func (rs *ResultSetFixtureResultSet) ForEach(fn func(*ResultSetFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*ResultSetFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*ResultSetFixtureResultSet) Next

func (rs *ResultSetFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*ResultSetFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type ResultSetFixtureStore

type ResultSetFixtureStore struct {
	*kallax.Store
}

ResultSetFixtureStore is the entity to access the records of the type ResultSetFixture in the database.

func NewResultSetFixtureStore

func NewResultSetFixtureStore(db *sql.DB) *ResultSetFixtureStore

NewResultSetFixtureStore creates a new instance of ResultSetFixtureStore using a SQL database.

func (*ResultSetFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*ResultSetFixtureStore) Delete

func (s *ResultSetFixtureStore) Delete(record *ResultSetFixture) error

Delete removes the given record from the database.

func (*ResultSetFixtureStore) Find

Find returns the set of results for the given query.

func (*ResultSetFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*ResultSetFixtureStore) Insert

func (s *ResultSetFixtureStore) Insert(record *ResultSetFixture) error

Insert inserts a ResultSetFixture in the database. A non-persisted object is required for this operation.

func (*ResultSetFixtureStore) MustCount

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*ResultSetFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*ResultSetFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*ResultSetFixtureStore) Reload

func (s *ResultSetFixtureStore) Reload(record *ResultSetFixture) error

Reload refreshes the ResultSetFixture with the data in the database and makes it writable.

func (*ResultSetFixtureStore) Save

func (s *ResultSetFixtureStore) Save(record *ResultSetFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*ResultSetFixtureStore) Transaction

func (s *ResultSetFixtureStore) Transaction(callback func(*ResultSetFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*ResultSetFixtureStore) Update

func (s *ResultSetFixtureStore) Update(record *ResultSetFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type SchemaFixture

type SchemaFixture struct {
	kallax.Model `table:"schema"`
	ID           kallax.ULID `pk:""`
	ShouldIgnore string      `kallax:"-"`
	String       string
	Int          int
	Nested       *SchemaFixture
	Inline       struct {
		Inline string
	} `kallax:",inline"`
	MapOfString    map[string]string
	MapOfInterface map[string]interface{}
	MapOfSomeType  map[string]struct {
		Foo string
	}
}

func NewSchemaFixture

func NewSchemaFixture() (record *SchemaFixture)

NewSchemaFixture returns a new instance of SchemaFixture.

func (*SchemaFixture) ColumnAddress

func (r *SchemaFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*SchemaFixture) GetID added in v0.13.0

func (r *SchemaFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*SchemaFixture) NewRelationshipRecord

func (r *SchemaFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*SchemaFixture) SetRelationship

func (r *SchemaFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*SchemaFixture) Value

func (r *SchemaFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type SchemaFixtureQuery

type SchemaFixtureQuery struct {
	*kallax.BaseQuery
}

SchemaFixtureQuery is the object used to create queries for the SchemaFixture entity.

func NewSchemaFixtureQuery

func NewSchemaFixtureQuery() *SchemaFixtureQuery

NewSchemaFixtureQuery returns a new instance of SchemaFixtureQuery.

func (*SchemaFixtureQuery) BatchSize

func (q *SchemaFixtureQuery) BatchSize(size uint64) *SchemaFixtureQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*SchemaFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*SchemaFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*SchemaFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*SchemaFixtureQuery) Order

func (q *SchemaFixtureQuery) Order(cols ...kallax.ColumnOrder) *SchemaFixtureQuery

Order adds order clauses to the query for the given columns.

func (*SchemaFixtureQuery) Select

func (q *SchemaFixtureQuery) Select(columns ...kallax.SchemaField) *SchemaFixtureQuery

Select adds columns to select in the query.

func (*SchemaFixtureQuery) SelectNot

func (q *SchemaFixtureQuery) SelectNot(columns ...kallax.SchemaField) *SchemaFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*SchemaFixtureQuery) Where

func (q *SchemaFixtureQuery) Where(cond kallax.Condition) *SchemaFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

func (*SchemaFixtureQuery) WithNested

func (q *SchemaFixtureQuery) WithNested() *SchemaFixtureQuery

type SchemaFixtureResultSet

type SchemaFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

SchemaFixtureResultSet is the set of results returned by a query to the database.

func NewSchemaFixtureResultSet

func NewSchemaFixtureResultSet(rs kallax.ResultSet) *SchemaFixtureResultSet

NewSchemaFixtureResultSet creates a new result set for rows of the type SchemaFixture.

func (*SchemaFixtureResultSet) All

func (rs *SchemaFixtureResultSet) All() ([]*SchemaFixture, error)

All returns all records on the result set and closes the result set.

func (*SchemaFixtureResultSet) Close added in v0.12.0

func (rs *SchemaFixtureResultSet) Close() error

Close closes the result set.

func (*SchemaFixtureResultSet) Err added in v0.12.0

func (rs *SchemaFixtureResultSet) Err() error

Err returns the last error occurred.

func (*SchemaFixtureResultSet) ForEach

func (rs *SchemaFixtureResultSet) ForEach(fn func(*SchemaFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*SchemaFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*SchemaFixtureResultSet) Next

func (rs *SchemaFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*SchemaFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type SchemaFixtureStore

type SchemaFixtureStore struct {
	*kallax.Store
}

SchemaFixtureStore is the entity to access the records of the type SchemaFixture in the database.

func NewSchemaFixtureStore

func NewSchemaFixtureStore(db *sql.DB) *SchemaFixtureStore

NewSchemaFixtureStore creates a new instance of SchemaFixtureStore using a SQL database.

func (*SchemaFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*SchemaFixtureStore) Delete

func (s *SchemaFixtureStore) Delete(record *SchemaFixture) error

Delete removes the given record from the database.

func (*SchemaFixtureStore) Find

Find returns the set of results for the given query.

func (*SchemaFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*SchemaFixtureStore) Insert

func (s *SchemaFixtureStore) Insert(record *SchemaFixture) error

Insert inserts a SchemaFixture in the database. A non-persisted object is required for this operation.

func (*SchemaFixtureStore) MustCount

func (s *SchemaFixtureStore) MustCount(q *SchemaFixtureQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*SchemaFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*SchemaFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*SchemaFixtureStore) Reload

func (s *SchemaFixtureStore) Reload(record *SchemaFixture) error

Reload refreshes the SchemaFixture with the data in the database and makes it writable.

func (*SchemaFixtureStore) RemoveNested added in v0.12.0

func (s *SchemaFixtureStore) RemoveNested(record *SchemaFixture) error

RemoveNested removes from the database the given relationship of the model. It also resets the field Nested of the model.

func (*SchemaFixtureStore) Save

func (s *SchemaFixtureStore) Save(record *SchemaFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*SchemaFixtureStore) Transaction

func (s *SchemaFixtureStore) Transaction(callback func(*SchemaFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*SchemaFixtureStore) Update

func (s *SchemaFixtureStore) Update(record *SchemaFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type StoreFixture

type StoreFixture struct {
	kallax.Model `table:"store"`
	ID           kallax.ULID `pk:""`
	Foo          string
}

func NewStoreFixture

func NewStoreFixture() (record *StoreFixture)

NewStoreFixture returns a new instance of StoreFixture.

func (*StoreFixture) ColumnAddress

func (r *StoreFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*StoreFixture) GetID added in v0.13.0

func (r *StoreFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*StoreFixture) NewRelationshipRecord

func (r *StoreFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*StoreFixture) SetRelationship

func (r *StoreFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*StoreFixture) Value

func (r *StoreFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type StoreFixtureQuery

type StoreFixtureQuery struct {
	*kallax.BaseQuery
}

StoreFixtureQuery is the object used to create queries for the StoreFixture entity.

func NewStoreFixtureQuery

func NewStoreFixtureQuery() *StoreFixtureQuery

NewStoreFixtureQuery returns a new instance of StoreFixtureQuery.

func (*StoreFixtureQuery) BatchSize

func (q *StoreFixtureQuery) BatchSize(size uint64) *StoreFixtureQuery

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*StoreFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*StoreFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*StoreFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*StoreFixtureQuery) Order

func (q *StoreFixtureQuery) Order(cols ...kallax.ColumnOrder) *StoreFixtureQuery

Order adds order clauses to the query for the given columns.

func (*StoreFixtureQuery) Select

func (q *StoreFixtureQuery) Select(columns ...kallax.SchemaField) *StoreFixtureQuery

Select adds columns to select in the query.

func (*StoreFixtureQuery) SelectNot

func (q *StoreFixtureQuery) SelectNot(columns ...kallax.SchemaField) *StoreFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*StoreFixtureQuery) Where

func (q *StoreFixtureQuery) Where(cond kallax.Condition) *StoreFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type StoreFixtureResultSet

type StoreFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

StoreFixtureResultSet is the set of results returned by a query to the database.

func NewStoreFixtureResultSet

func NewStoreFixtureResultSet(rs kallax.ResultSet) *StoreFixtureResultSet

NewStoreFixtureResultSet creates a new result set for rows of the type StoreFixture.

func (*StoreFixtureResultSet) All

func (rs *StoreFixtureResultSet) All() ([]*StoreFixture, error)

All returns all records on the result set and closes the result set.

func (*StoreFixtureResultSet) Close added in v0.12.0

func (rs *StoreFixtureResultSet) Close() error

Close closes the result set.

func (*StoreFixtureResultSet) Err added in v0.12.0

func (rs *StoreFixtureResultSet) Err() error

Err returns the last error occurred.

func (*StoreFixtureResultSet) ForEach

func (rs *StoreFixtureResultSet) ForEach(fn func(*StoreFixture) error) error

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*StoreFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*StoreFixtureResultSet) Next

func (rs *StoreFixtureResultSet) Next() bool

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*StoreFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type StoreFixtureStore

type StoreFixtureStore struct {
	*kallax.Store
}

StoreFixtureStore is the entity to access the records of the type StoreFixture in the database.

func NewStoreFixtureStore

func NewStoreFixtureStore(db *sql.DB) *StoreFixtureStore

NewStoreFixtureStore creates a new instance of StoreFixtureStore using a SQL database.

func (*StoreFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*StoreFixtureStore) Delete

func (s *StoreFixtureStore) Delete(record *StoreFixture) error

Delete removes the given record from the database.

func (*StoreFixtureStore) Find

Find returns the set of results for the given query.

func (*StoreFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*StoreFixtureStore) Insert

func (s *StoreFixtureStore) Insert(record *StoreFixture) error

Insert inserts a StoreFixture in the database. A non-persisted object is required for this operation.

func (*StoreFixtureStore) MustCount

func (s *StoreFixtureStore) MustCount(q *StoreFixtureQuery) int64

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*StoreFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*StoreFixtureStore) MustFindOne

func (s *StoreFixtureStore) MustFindOne(q *StoreFixtureQuery) *StoreFixture

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*StoreFixtureStore) Reload

func (s *StoreFixtureStore) Reload(record *StoreFixture) error

Reload refreshes the StoreFixture with the data in the database and makes it writable.

func (*StoreFixtureStore) Save

func (s *StoreFixtureStore) Save(record *StoreFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*StoreFixtureStore) Transaction

func (s *StoreFixtureStore) Transaction(callback func(*StoreFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*StoreFixtureStore) Update

func (s *StoreFixtureStore) Update(record *StoreFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type StoreWithConstructFixture

type StoreWithConstructFixture struct {
	kallax.Model `table:"store_construct"`
	ID           kallax.ULID `pk:""`
	Foo          string
}

func NewStoreWithConstructFixture

func NewStoreWithConstructFixture(f string) (record *StoreWithConstructFixture)

NewStoreWithConstructFixture returns a new instance of StoreWithConstructFixture.

func (*StoreWithConstructFixture) ColumnAddress

func (r *StoreWithConstructFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*StoreWithConstructFixture) GetID added in v0.13.0

func (r *StoreWithConstructFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*StoreWithConstructFixture) NewRelationshipRecord

func (r *StoreWithConstructFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*StoreWithConstructFixture) SetRelationship

func (r *StoreWithConstructFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*StoreWithConstructFixture) Value

func (r *StoreWithConstructFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type StoreWithConstructFixtureQuery

type StoreWithConstructFixtureQuery struct {
	*kallax.BaseQuery
}

StoreWithConstructFixtureQuery is the object used to create queries for the StoreWithConstructFixture entity.

func NewStoreWithConstructFixtureQuery

func NewStoreWithConstructFixtureQuery() *StoreWithConstructFixtureQuery

NewStoreWithConstructFixtureQuery returns a new instance of StoreWithConstructFixtureQuery.

func (*StoreWithConstructFixtureQuery) BatchSize

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*StoreWithConstructFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*StoreWithConstructFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*StoreWithConstructFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*StoreWithConstructFixtureQuery) Order

func (q *StoreWithConstructFixtureQuery) Order(cols ...kallax.ColumnOrder) *StoreWithConstructFixtureQuery

Order adds order clauses to the query for the given columns.

func (*StoreWithConstructFixtureQuery) Select

func (q *StoreWithConstructFixtureQuery) Select(columns ...kallax.SchemaField) *StoreWithConstructFixtureQuery

Select adds columns to select in the query.

func (*StoreWithConstructFixtureQuery) SelectNot

func (q *StoreWithConstructFixtureQuery) SelectNot(columns ...kallax.SchemaField) *StoreWithConstructFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*StoreWithConstructFixtureQuery) Where

func (q *StoreWithConstructFixtureQuery) Where(cond kallax.Condition) *StoreWithConstructFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type StoreWithConstructFixtureResultSet

type StoreWithConstructFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

StoreWithConstructFixtureResultSet is the set of results returned by a query to the database.

func NewStoreWithConstructFixtureResultSet

func NewStoreWithConstructFixtureResultSet(rs kallax.ResultSet) *StoreWithConstructFixtureResultSet

NewStoreWithConstructFixtureResultSet creates a new result set for rows of the type StoreWithConstructFixture.

func (*StoreWithConstructFixtureResultSet) All

All returns all records on the result set and closes the result set.

func (*StoreWithConstructFixtureResultSet) Close added in v0.12.0

Close closes the result set.

func (*StoreWithConstructFixtureResultSet) Err added in v0.12.0

Err returns the last error occurred.

func (*StoreWithConstructFixtureResultSet) ForEach

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*StoreWithConstructFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*StoreWithConstructFixtureResultSet) Next

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*StoreWithConstructFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type StoreWithConstructFixtureStore

type StoreWithConstructFixtureStore struct {
	*kallax.Store
}

StoreWithConstructFixtureStore is the entity to access the records of the type StoreWithConstructFixture in the database.

func NewStoreWithConstructFixtureStore

func NewStoreWithConstructFixtureStore(db *sql.DB) *StoreWithConstructFixtureStore

NewStoreWithConstructFixtureStore creates a new instance of StoreWithConstructFixtureStore using a SQL database.

func (*StoreWithConstructFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*StoreWithConstructFixtureStore) Delete

Delete removes the given record from the database.

func (*StoreWithConstructFixtureStore) Find

Find returns the set of results for the given query.

func (*StoreWithConstructFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*StoreWithConstructFixtureStore) Insert

Insert inserts a StoreWithConstructFixture in the database. A non-persisted object is required for this operation.

func (*StoreWithConstructFixtureStore) MustCount

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*StoreWithConstructFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*StoreWithConstructFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*StoreWithConstructFixtureStore) Reload

Reload refreshes the StoreWithConstructFixture with the data in the database and makes it writable.

func (*StoreWithConstructFixtureStore) Save

func (s *StoreWithConstructFixtureStore) Save(record *StoreWithConstructFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*StoreWithConstructFixtureStore) Transaction

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*StoreWithConstructFixtureStore) Update

func (s *StoreWithConstructFixtureStore) Update(record *StoreWithConstructFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

type StoreWithNewFixture

type StoreWithNewFixture struct {
	kallax.Model `table:"store_new"`
	ID           kallax.ULID `pk:""`
	Foo          string
	Bar          string
}

func NewStoreWithNewFixture

func NewStoreWithNewFixture() (record *StoreWithNewFixture)

NewStoreWithNewFixture returns a new instance of StoreWithNewFixture.

func (*StoreWithNewFixture) ColumnAddress

func (r *StoreWithNewFixture) ColumnAddress(col string) (interface{}, error)

ColumnAddress returns the pointer to the value of the given column.

func (*StoreWithNewFixture) GetID added in v0.13.0

func (r *StoreWithNewFixture) GetID() kallax.Identifier

GetID returns the primary key of the model.

func (*StoreWithNewFixture) NewRelationshipRecord

func (r *StoreWithNewFixture) NewRelationshipRecord(field string) (kallax.Record, error)

NewRelationshipRecord returns a new record for the relatiobship in the given field.

func (*StoreWithNewFixture) SetRelationship

func (r *StoreWithNewFixture) SetRelationship(field string, rel interface{}) error

SetRelationship sets the given relationship in the given field.

func (*StoreWithNewFixture) Value

func (r *StoreWithNewFixture) Value(col string) (interface{}, error)

Value returns the value of the given column.

type StoreWithNewFixtureQuery

type StoreWithNewFixtureQuery struct {
	*kallax.BaseQuery
}

StoreWithNewFixtureQuery is the object used to create queries for the StoreWithNewFixture entity.

func NewStoreWithNewFixtureQuery

func NewStoreWithNewFixtureQuery() *StoreWithNewFixtureQuery

NewStoreWithNewFixtureQuery returns a new instance of StoreWithNewFixtureQuery.

func (*StoreWithNewFixtureQuery) BatchSize

BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.

func (*StoreWithNewFixtureQuery) Copy

Copy returns a new identical copy of the query. Remember queries are mutable so make a copy any time you need to reuse them.

func (*StoreWithNewFixtureQuery) Limit

Limit sets the max number of items to retrieve.

func (*StoreWithNewFixtureQuery) Offset

Offset sets the number of items to skip from the result set of items.

func (*StoreWithNewFixtureQuery) Order

func (q *StoreWithNewFixtureQuery) Order(cols ...kallax.ColumnOrder) *StoreWithNewFixtureQuery

Order adds order clauses to the query for the given columns.

func (*StoreWithNewFixtureQuery) Select

func (q *StoreWithNewFixtureQuery) Select(columns ...kallax.SchemaField) *StoreWithNewFixtureQuery

Select adds columns to select in the query.

func (*StoreWithNewFixtureQuery) SelectNot

func (q *StoreWithNewFixtureQuery) SelectNot(columns ...kallax.SchemaField) *StoreWithNewFixtureQuery

SelectNot excludes columns from being selected in the query.

func (*StoreWithNewFixtureQuery) Where

func (q *StoreWithNewFixtureQuery) Where(cond kallax.Condition) *StoreWithNewFixtureQuery

Where adds a condition to the query. All conditions added are concatenated using a logical AND.

type StoreWithNewFixtureResultSet

type StoreWithNewFixtureResultSet struct {
	ResultSet kallax.ResultSet
	// contains filtered or unexported fields
}

StoreWithNewFixtureResultSet is the set of results returned by a query to the database.

func NewStoreWithNewFixtureResultSet

func NewStoreWithNewFixtureResultSet(rs kallax.ResultSet) *StoreWithNewFixtureResultSet

NewStoreWithNewFixtureResultSet creates a new result set for rows of the type StoreWithNewFixture.

func (*StoreWithNewFixtureResultSet) All

All returns all records on the result set and closes the result set.

func (*StoreWithNewFixtureResultSet) Close added in v0.12.0

func (rs *StoreWithNewFixtureResultSet) Close() error

Close closes the result set.

func (*StoreWithNewFixtureResultSet) Err added in v0.12.0

Err returns the last error occurred.

func (*StoreWithNewFixtureResultSet) ForEach

ForEach iterates over the complete result set passing every record found to the given callback. It is possible to stop the iteration by returning `kallax.ErrStop` in the callback. Result set is always closed at the end.

func (*StoreWithNewFixtureResultSet) Get

Get retrieves the last fetched item from the result set and the last error.

func (*StoreWithNewFixtureResultSet) Next

Next fetches the next item in the result set and returns true if there is a next item. The result set is closed automatically when there are no more items.

func (*StoreWithNewFixtureResultSet) One

One returns the first record on the result set and closes the result set.

type StoreWithNewFixtureStore

type StoreWithNewFixtureStore struct {
	*kallax.Store
}

StoreWithNewFixtureStore is the entity to access the records of the type StoreWithNewFixture in the database.

func NewStoreWithNewFixtureStore

func NewStoreWithNewFixtureStore(db *sql.DB) *StoreWithNewFixtureStore

NewStoreWithNewFixtureStore creates a new instance of StoreWithNewFixtureStore using a SQL database.

func (*StoreWithNewFixtureStore) Count

Count returns the number of rows that would be retrieved with the given query.

func (*StoreWithNewFixtureStore) Delete

Delete removes the given record from the database.

func (*StoreWithNewFixtureStore) Find

Find returns the set of results for the given query.

func (*StoreWithNewFixtureStore) FindOne

FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.

func (*StoreWithNewFixtureStore) Insert

Insert inserts a StoreWithNewFixture in the database. A non-persisted object is required for this operation.

func (*StoreWithNewFixtureStore) MustCount

MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.

func (*StoreWithNewFixtureStore) MustFind

MustFind returns the set of results for the given query, but panics if there is any error.

func (*StoreWithNewFixtureStore) MustFindOne

MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.

func (*StoreWithNewFixtureStore) Reload

Reload refreshes the StoreWithNewFixture with the data in the database and makes it writable.

func (*StoreWithNewFixtureStore) Save

func (s *StoreWithNewFixtureStore) Save(record *StoreWithNewFixture) (updated bool, err error)

Save inserts the object if the record is not persisted, otherwise it updates it. Same rules of Update and Insert apply depending on the case.

func (*StoreWithNewFixtureStore) Transaction

func (s *StoreWithNewFixtureStore) Transaction(callback func(*StoreWithNewFixtureStore) error) error

Transaction executes the given callback in a transaction and rollbacks if an error is returned. The transaction is only open in the store passed as a parameter to the callback.

func (*StoreWithNewFixtureStore) Update

func (s *StoreWithNewFixtureStore) Update(record *StoreWithNewFixture, cols ...kallax.SchemaField) (updated int64, err error)

Update updates the given record on the database. If the columns are given, only these columns will be updated. Otherwise all of them will be. Be very careful with this, as you will have a potentially different object in memory but not on the database. Only writable records can be updated. Writable objects are those that have been just inserted or retrieved using a query with no custom select fields.

Jump to

Keyboard shortcuts

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