tests

package
Version: v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Code generated by https://github.com/src-d/go-kallax. DO NOT EDIT. 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{
	A: &schemaA{
		BaseSchema: kallax.NewBaseSchema(
			"a",
			"__a",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"B": kallax.NewForeignKey("a_id", false),
			},
			func() kallax.Record {
				return new(A)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
	},
	B: &schemaB{
		BaseSchema: kallax.NewBaseSchema(
			"b",
			"__b",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"A": kallax.NewForeignKey("a_id", true),
				"C": kallax.NewForeignKey("b_id", false),
			},
			func() kallax.Record {
				return new(B)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("a_id"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
		AFK:  kallax.NewSchemaField("a_id"),
	},
	Brand: &schemaBrand{
		BaseSchema: kallax.NewBaseSchema(
			"brands",
			"__brand",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(Brand)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
	},
	C: &schemaC{
		BaseSchema: kallax.NewBaseSchema(
			"c",
			"__c",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"B": kallax.NewForeignKey("b_id", true),
			},
			func() kallax.Record {
				return new(C)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("b_id"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
		BFK:  kallax.NewSchemaField("b_id"),
	},
	Car: &schemaCar{
		BaseSchema: kallax.NewBaseSchema(
			"cars",
			"__car",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Owner": kallax.NewForeignKey("owner_id", true),
				"Brand": kallax.NewForeignKey("brand_id", true),
			},
			func() kallax.Record {
				return new(Car)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("owner_id"),
			kallax.NewSchemaField("model_name"),
			kallax.NewSchemaField("brand_id"),
		),
		ID:        kallax.NewSchemaField("id"),
		OwnerFK:   kallax.NewSchemaField("owner_id"),
		ModelName: kallax.NewSchemaField("model_name"),
		BrandFK:   kallax.NewSchemaField("brand_id"),
	},
	Child: &schemaChild{
		BaseSchema: kallax.NewBaseSchema(
			"children",
			"__child",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(Child)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("parent_id"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("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"),
	},
	Nullable: &schemaNullable{
		BaseSchema: kallax.NewBaseSchema(
			"nullable",
			"__nullable",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(Nullable)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("t"),
			kallax.NewSchemaField("some_json"),
			kallax.NewSchemaField("scanner"),
		),
		ID: kallax.NewSchemaField("id"),
		T:  kallax.NewSchemaField("t"),
		SomeJSON: &schemaNullableSomeJSON{
			BaseSchemaField: kallax.NewSchemaField("some_json").(*kallax.BaseSchemaField),
			Foo:             kallax.NewJSONSchemaKey(kallax.JSONInt, "some_json", "Foo"),
		},
		Scanner: kallax.NewSchemaField("scanner"),
	},
	Parent: &schemaParent{
		BaseSchema: kallax.NewBaseSchema(
			"parents",
			"__parent",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Children": kallax.NewForeignKey("parent_id", false),
			},
			func() kallax.Record {
				return new(Parent)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
	},
	ParentNoPtr: &schemaParentNoPtr{
		BaseSchema: kallax.NewBaseSchema(
			"parents",
			"__parentnoptr",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Children": kallax.NewForeignKey("parent_id", false),
			},
			func() kallax.Record {
				return new(ParentNoPtr)
			},
			true,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
		),
		ID:   kallax.NewSchemaField("id"),
		Name: kallax.NewSchemaField("name"),
	},
	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"),
		OwnerFK: kallax.NewSchemaField("owner_id"),
	},
	QueryFixture: &schemaQueryFixture{
		BaseSchema: kallax.NewBaseSchema(
			"query",
			"__queryfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Relation":  kallax.NewForeignKey("owner_id", false),
				"Inverse":   kallax.NewForeignKey("inverse_id", true),
				"NRelation": kallax.NewForeignKey("owner_id", false),
			},
			func() kallax.Record {
				return new(QueryFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("inverse_id"),
			kallax.NewSchemaField("embedded"),
			kallax.NewSchemaField("inline"),
			kallax.NewSchemaField("map_of_string"),
			kallax.NewSchemaField("map_of_interface"),
			kallax.NewSchemaField("map_of_some_type"),
			kallax.NewSchemaField("foo"),
			kallax.NewSchemaField("string_property"),
			kallax.NewSchemaField("integer"),
			kallax.NewSchemaField("integer64"),
			kallax.NewSchemaField("float32"),
			kallax.NewSchemaField("boolean"),
			kallax.NewSchemaField("array_param"),
			kallax.NewSchemaField("slice_param"),
			kallax.NewSchemaField("alias_array_param"),
			kallax.NewSchemaField("alias_slice_param"),
			kallax.NewSchemaField("alias_string_param"),
			kallax.NewSchemaField("alias_int_param"),
			kallax.NewSchemaField("dummy_param"),
			kallax.NewSchemaField("alias_dummy_param"),
			kallax.NewSchemaField("slice_dummy_param"),
			kallax.NewSchemaField("idproperty_param"),
			kallax.NewSchemaField("interface_prop_param"),
			kallax.NewSchemaField("urlparam"),
			kallax.NewSchemaField("time_param"),
			kallax.NewSchemaField("alias_arr_alias_string_param"),
			kallax.NewSchemaField("alias_here_array_param"),
			kallax.NewSchemaField("array_alias_here_string_param"),
			kallax.NewSchemaField("scanner_valuer_param"),
		),
		ID:                        kallax.NewSchemaField("id"),
		InverseFK:                 kallax.NewSchemaField("inverse_id"),
		Embedded:                  kallax.NewSchemaField("embedded"),
		Inline:                    kallax.NewSchemaField("inline"),
		MapOfString:               kallax.NewSchemaField("map_of_string"),
		MapOfInterface:            kallax.NewSchemaField("map_of_interface"),
		MapOfSomeType:             kallax.NewSchemaField("map_of_some_type"),
		Foo:                       kallax.NewSchemaField("foo"),
		StringProperty:            kallax.NewSchemaField("string_property"),
		Integer:                   kallax.NewSchemaField("integer"),
		Integer64:                 kallax.NewSchemaField("integer64"),
		Float32:                   kallax.NewSchemaField("float32"),
		Boolean:                   kallax.NewSchemaField("boolean"),
		ArrayParam:                kallax.NewSchemaField("array_param"),
		SliceParam:                kallax.NewSchemaField("slice_param"),
		AliasArrayParam:           kallax.NewSchemaField("alias_array_param"),
		AliasSliceParam:           kallax.NewSchemaField("alias_slice_param"),
		AliasStringParam:          kallax.NewSchemaField("alias_string_param"),
		AliasIntParam:             kallax.NewSchemaField("alias_int_param"),
		DummyParam:                kallax.NewSchemaField("dummy_param"),
		AliasDummyParam:           kallax.NewSchemaField("alias_dummy_param"),
		SliceDummyParam:           kallax.NewSchemaField("slice_dummy_param"),
		IDPropertyParam:           kallax.NewSchemaField("idproperty_param"),
		InterfacePropParam:        kallax.NewSchemaField("interface_prop_param"),
		URLParam:                  kallax.NewSchemaField("urlparam"),
		TimeParam:                 kallax.NewSchemaField("time_param"),
		AliasArrAliasStringParam:  kallax.NewSchemaField("alias_arr_alias_string_param"),
		AliasHereArrayParam:       kallax.NewSchemaField("alias_here_array_param"),
		ArrayAliasHereStringParam: kallax.NewSchemaField("array_alias_here_string_param"),
		ScannerValuerParam:        kallax.NewSchemaField("scanner_valuer_param"),
	},
	QueryRelationFixture: &schemaQueryRelationFixture{
		BaseSchema: kallax.NewBaseSchema(
			"query_relation",
			"__queryrelationfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"Owner": kallax.NewForeignKey("owner_id", true),
			},
			func() kallax.Record {
				return new(QueryRelationFixture)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("owner_id"),
		),
		ID:      kallax.NewSchemaField("id"),
		Name:    kallax.NewSchemaField("name"),
		OwnerFK: kallax.NewSchemaField("owner_id"),
	},
	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),
				"Inverse": kallax.NewForeignKey("rel_id", true),
			},
			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"),
			kallax.NewSchemaField("rel_id"),
		),
		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"),
		InverseFK:      kallax.NewSchemaField("rel_id"),
	},
	SchemaRelationshipFixture: &schemaSchemaRelationshipFixture{
		BaseSchema: kallax.NewBaseSchema(
			"relationship",
			"__schemarelationshipfixture",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(SchemaRelationshipFixture)
			},
			false,
			kallax.NewSchemaField("id"),
		),
		ID: kallax.NewSchemaField("id"),
	},
	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"),
			kallax.NewSchemaField("slice_prop"),
			kallax.NewSchemaField("alias_slice_prop"),
		),
		ID:             kallax.NewSchemaField("id"),
		Foo:            kallax.NewSchemaField("foo"),
		SliceProp:      kallax.NewSchemaField("slice_prop"),
		AliasSliceProp: kallax.NewSchemaField("alias_slice_prop"),
	},
	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 A added in v1.3.0

type A struct {
	kallax.Model `table:"a" pk:"id,autoincr"`
	ID           int64
	Name         string
	B            *B
}

func NewA added in v1.3.0

func NewA(name string) (record *A)

NewA returns a new instance of A.

func (*A) ColumnAddress added in v1.3.0

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

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

func (*A) GetID added in v1.3.0

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

GetID returns the primary key of the model.

func (*A) NewRelationshipRecord added in v1.3.0

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

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

func (*A) SetRelationship added in v1.3.0

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

SetRelationship sets the given relationship in the given field.

func (*A) Value added in v1.3.0

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

Value returns the value of the given column.

type AQuery added in v1.3.0

type AQuery struct {
	*kallax.BaseQuery
}

AQuery is the object used to create queries for the A entity.

func NewAQuery added in v1.3.0

func NewAQuery() *AQuery

NewAQuery returns a new instance of AQuery.

func (*AQuery) BatchSize added in v1.3.0

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

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

func (*AQuery) Copy added in v1.3.0

func (q *AQuery) Copy() *AQuery

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 (*AQuery) FindByID added in v1.3.0

func (q *AQuery) FindByID(v ...int64) *AQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*AQuery) FindByName added in v1.3.0

func (q *AQuery) FindByName(v string) *AQuery

FindByName adds a new filter to the query that will require that the Name property is equal to the passed value.

func (*AQuery) Limit added in v1.3.0

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

Limit sets the max number of items to retrieve.

func (*AQuery) Offset added in v1.3.0

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

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

func (*AQuery) Order added in v1.3.0

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

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

func (*AQuery) Select added in v1.3.0

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

Select adds columns to select in the query.

func (*AQuery) SelectNot added in v1.3.0

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

SelectNot excludes columns from being selected in the query.

func (*AQuery) Where added in v1.3.0

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

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

func (*AQuery) WithB added in v1.3.0

func (q *AQuery) WithB() *AQuery

type AResultSet added in v1.3.0

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

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

func NewAResultSet added in v1.3.0

func NewAResultSet(rs kallax.ResultSet) *AResultSet

NewAResultSet creates a new result set for rows of the type A.

func (*AResultSet) All added in v1.3.0

func (rs *AResultSet) All() ([]*A, error)

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

func (*AResultSet) Close added in v1.3.0

func (rs *AResultSet) Close() error

Close closes the result set.

func (*AResultSet) Err added in v1.3.0

func (rs *AResultSet) Err() error

Err returns the last error occurred.

func (*AResultSet) ForEach added in v1.3.0

func (rs *AResultSet) ForEach(fn func(*A) 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 (*AResultSet) Get added in v1.3.0

func (rs *AResultSet) Get() (*A, error)

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

func (*AResultSet) Next added in v1.3.0

func (rs *AResultSet) 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 (*AResultSet) One added in v1.3.0

func (rs *AResultSet) One() (*A, error)

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

type AStore added in v1.3.0

type AStore struct {
	*kallax.Store
}

AStore is the entity to access the records of the type A in the database.

func NewAStore added in v1.3.0

func NewAStore(db *sql.DB) *AStore

NewAStore creates a new instance of AStore using a SQL database.

func (*AStore) Count added in v1.3.0

func (s *AStore) Count(q *AQuery) (int64, error)

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

func (*AStore) Debug added in v1.3.0

func (s *AStore) Debug() *AStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*AStore) DebugWith added in v1.3.0

func (s *AStore) DebugWith(logger kallax.LoggerFunc) *AStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*AStore) Delete added in v1.3.0

func (s *AStore) Delete(record *A) error

Delete removes the given record from the database.

func (*AStore) DisableCacher added in v1.3.4

func (s *AStore) DisableCacher() *AStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*AStore) Find added in v1.3.0

func (s *AStore) Find(q *AQuery) (*AResultSet, error)

Find returns the set of results for the given query.

func (*AStore) FindAll added in v1.3.0

func (s *AStore) FindAll(q *AQuery) ([]*A, error)

FindAll returns a list of all the rows returned by the given query.

func (*AStore) FindOne added in v1.3.0

func (s *AStore) FindOne(q *AQuery) (*A, error)

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

func (*AStore) GenericStore added in v1.3.0

func (s *AStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

func (*AStore) Insert added in v1.3.0

func (s *AStore) Insert(record *A) error

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

func (*AStore) MustCount added in v1.3.0

func (s *AStore) MustCount(q *AQuery) int64

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

func (*AStore) MustFind added in v1.3.0

func (s *AStore) MustFind(q *AQuery) *AResultSet

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

func (*AStore) MustFindOne added in v1.3.0

func (s *AStore) MustFindOne(q *AQuery) *A

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

func (*AStore) Reload added in v1.3.0

func (s *AStore) Reload(record *A) error

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

func (*AStore) RemoveB added in v1.3.0

func (s *AStore) RemoveB(record *A) error

RemoveB removes from the database the given relationship of the model. It also resets the field B of the model.

func (*AStore) Save added in v1.3.0

func (s *AStore) Save(record *A) (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 (*AStore) SetGenericStore added in v1.3.0

func (s *AStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

func (*AStore) Transaction added in v1.3.0

func (s *AStore) Transaction(callback func(*AStore) 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 (*AStore) Update added in v1.3.0

func (s *AStore) Update(record *A, 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 AliasHereArray added in v1.0.0

type AliasHereArray [3]string

type AliasHereString added in v1.0.0

type AliasHereString string

type AliasID added in v1.0.0

type AliasID kallax.ULID

type AliasSliceString added in v1.0.0

type AliasSliceString []string

type B added in v1.3.0

type B struct {
	kallax.Model `table:"b" pk:"id,autoincr"`
	ID           int64
	Name         string
	A            *A `fk:",inverse"`
	C            *C
}

func NewB added in v1.3.0

func NewB(name string, a *A) (record *B)

NewB returns a new instance of B.

func (*B) ColumnAddress added in v1.3.0

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

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

func (*B) GetID added in v1.3.0

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

GetID returns the primary key of the model.

func (*B) NewRelationshipRecord added in v1.3.0

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

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

func (*B) SetRelationship added in v1.3.0

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

SetRelationship sets the given relationship in the given field.

func (*B) Value added in v1.3.0

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

Value returns the value of the given column.

type BQuery added in v1.3.0

type BQuery struct {
	*kallax.BaseQuery
}

BQuery is the object used to create queries for the B entity.

func NewBQuery added in v1.3.0

func NewBQuery() *BQuery

NewBQuery returns a new instance of BQuery.

func (*BQuery) BatchSize added in v1.3.0

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

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

func (*BQuery) Copy added in v1.3.0

func (q *BQuery) Copy() *BQuery

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 (*BQuery) FindByA added in v1.3.0

func (q *BQuery) FindByA(v int64) *BQuery

FindByA adds a new filter to the query that will require that the foreign key of A is equal to the passed value.

func (*BQuery) FindByID added in v1.3.0

func (q *BQuery) FindByID(v ...int64) *BQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*BQuery) FindByName added in v1.3.0

func (q *BQuery) FindByName(v string) *BQuery

FindByName adds a new filter to the query that will require that the Name property is equal to the passed value.

func (*BQuery) Limit added in v1.3.0

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

Limit sets the max number of items to retrieve.

func (*BQuery) Offset added in v1.3.0

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

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

func (*BQuery) Order added in v1.3.0

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

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

func (*BQuery) Select added in v1.3.0

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

Select adds columns to select in the query.

func (*BQuery) SelectNot added in v1.3.0

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

SelectNot excludes columns from being selected in the query.

func (*BQuery) Where added in v1.3.0

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

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

func (*BQuery) WithA added in v1.3.0

func (q *BQuery) WithA() *BQuery

func (*BQuery) WithC added in v1.3.0

func (q *BQuery) WithC() *BQuery

type BResultSet added in v1.3.0

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

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

func NewBResultSet added in v1.3.0

func NewBResultSet(rs kallax.ResultSet) *BResultSet

NewBResultSet creates a new result set for rows of the type B.

func (*BResultSet) All added in v1.3.0

func (rs *BResultSet) All() ([]*B, error)

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

func (*BResultSet) Close added in v1.3.0

func (rs *BResultSet) Close() error

Close closes the result set.

func (*BResultSet) Err added in v1.3.0

func (rs *BResultSet) Err() error

Err returns the last error occurred.

func (*BResultSet) ForEach added in v1.3.0

func (rs *BResultSet) ForEach(fn func(*B) 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 (*BResultSet) Get added in v1.3.0

func (rs *BResultSet) Get() (*B, error)

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

func (*BResultSet) Next added in v1.3.0

func (rs *BResultSet) 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 (*BResultSet) One added in v1.3.0

func (rs *BResultSet) One() (*B, error)

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

type BStore added in v1.3.0

type BStore struct {
	*kallax.Store
}

BStore is the entity to access the records of the type B in the database.

func NewBStore added in v1.3.0

func NewBStore(db *sql.DB) *BStore

NewBStore creates a new instance of BStore using a SQL database.

func (*BStore) Count added in v1.3.0

func (s *BStore) Count(q *BQuery) (int64, error)

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

func (*BStore) Debug added in v1.3.0

func (s *BStore) Debug() *BStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*BStore) DebugWith added in v1.3.0

func (s *BStore) DebugWith(logger kallax.LoggerFunc) *BStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*BStore) Delete added in v1.3.0

func (s *BStore) Delete(record *B) error

Delete removes the given record from the database.

func (*BStore) DisableCacher added in v1.3.4

func (s *BStore) DisableCacher() *BStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*BStore) Find added in v1.3.0

func (s *BStore) Find(q *BQuery) (*BResultSet, error)

Find returns the set of results for the given query.

func (*BStore) FindAll added in v1.3.0

func (s *BStore) FindAll(q *BQuery) ([]*B, error)

FindAll returns a list of all the rows returned by the given query.

func (*BStore) FindOne added in v1.3.0

func (s *BStore) FindOne(q *BQuery) (*B, error)

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

func (*BStore) GenericStore added in v1.3.0

func (s *BStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

func (*BStore) Insert added in v1.3.0

func (s *BStore) Insert(record *B) error

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

func (*BStore) MustCount added in v1.3.0

func (s *BStore) MustCount(q *BQuery) int64

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

func (*BStore) MustFind added in v1.3.0

func (s *BStore) MustFind(q *BQuery) *BResultSet

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

func (*BStore) MustFindOne added in v1.3.0

func (s *BStore) MustFindOne(q *BQuery) *B

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

func (*BStore) Reload added in v1.3.0

func (s *BStore) Reload(record *B) error

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

func (*BStore) RemoveC added in v1.3.0

func (s *BStore) RemoveC(record *B) error

RemoveC removes from the database the given relationship of the model. It also resets the field C of the model.

func (*BStore) Save added in v1.3.0

func (s *BStore) Save(record *B) (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 (*BStore) SetGenericStore added in v1.3.0

func (s *BStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

func (*BStore) Transaction added in v1.3.0

func (s *BStore) Transaction(callback func(*BStore) 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 (*BStore) Update added in v1.3.0

func (s *BStore) Update(record *B, 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 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 Brand added in v1.3.0

type Brand struct {
	kallax.Model `table:"brands"`
	ID           kallax.ULID `pk:""`
	Name         string
}

func NewBrand added in v1.3.0

func NewBrand(name string) (record *Brand)

NewBrand returns a new instance of Brand.

func (*Brand) ColumnAddress added in v1.3.0

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

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

func (*Brand) GetID added in v1.3.0

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

GetID returns the primary key of the model.

func (*Brand) NewRelationshipRecord added in v1.3.0

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

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

func (*Brand) SetRelationship added in v1.3.0

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

SetRelationship sets the given relationship in the given field.

func (*Brand) Value added in v1.3.0

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

Value returns the value of the given column.

type BrandQuery added in v1.3.0

type BrandQuery struct {
	*kallax.BaseQuery
}

BrandQuery is the object used to create queries for the Brand entity.

func NewBrandQuery added in v1.3.0

func NewBrandQuery() *BrandQuery

NewBrandQuery returns a new instance of BrandQuery.

func (*BrandQuery) BatchSize added in v1.3.0

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

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

func (*BrandQuery) Copy added in v1.3.0

func (q *BrandQuery) Copy() *BrandQuery

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 (*BrandQuery) FindByID added in v1.3.0

func (q *BrandQuery) FindByID(v ...kallax.ULID) *BrandQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*BrandQuery) FindByName added in v1.3.0

func (q *BrandQuery) FindByName(v string) *BrandQuery

FindByName adds a new filter to the query that will require that the Name property is equal to the passed value.

func (*BrandQuery) Limit added in v1.3.0

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

Limit sets the max number of items to retrieve.

func (*BrandQuery) Offset added in v1.3.0

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

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

func (*BrandQuery) Order added in v1.3.0

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

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

func (*BrandQuery) Select added in v1.3.0

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

Select adds columns to select in the query.

func (*BrandQuery) SelectNot added in v1.3.0

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

SelectNot excludes columns from being selected in the query.

func (*BrandQuery) Where added in v1.3.0

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

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

type BrandResultSet added in v1.3.0

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

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

func NewBrandResultSet added in v1.3.0

func NewBrandResultSet(rs kallax.ResultSet) *BrandResultSet

NewBrandResultSet creates a new result set for rows of the type Brand.

func (*BrandResultSet) All added in v1.3.0

func (rs *BrandResultSet) All() ([]*Brand, error)

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

func (*BrandResultSet) Close added in v1.3.0

func (rs *BrandResultSet) Close() error

Close closes the result set.

func (*BrandResultSet) Err added in v1.3.0

func (rs *BrandResultSet) Err() error

Err returns the last error occurred.

func (*BrandResultSet) ForEach added in v1.3.0

func (rs *BrandResultSet) ForEach(fn func(*Brand) 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 (*BrandResultSet) Get added in v1.3.0

func (rs *BrandResultSet) Get() (*Brand, error)

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

func (*BrandResultSet) Next added in v1.3.0

func (rs *BrandResultSet) 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 (*BrandResultSet) One added in v1.3.0

func (rs *BrandResultSet) One() (*Brand, error)

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

type BrandStore added in v1.3.0

type BrandStore struct {
	*kallax.Store
}

BrandStore is the entity to access the records of the type Brand in the database.

func NewBrandStore added in v1.3.0

func NewBrandStore(db *sql.DB) *BrandStore

NewBrandStore creates a new instance of BrandStore using a SQL database.

func (*BrandStore) Count added in v1.3.0

func (s *BrandStore) Count(q *BrandQuery) (int64, error)

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

func (*BrandStore) Debug added in v1.3.0

func (s *BrandStore) Debug() *BrandStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*BrandStore) DebugWith added in v1.3.0

func (s *BrandStore) DebugWith(logger kallax.LoggerFunc) *BrandStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*BrandStore) Delete added in v1.3.0

func (s *BrandStore) Delete(record *Brand) error

Delete removes the given record from the database.

func (*BrandStore) DisableCacher added in v1.3.4

func (s *BrandStore) DisableCacher() *BrandStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*BrandStore) Find added in v1.3.0

func (s *BrandStore) Find(q *BrandQuery) (*BrandResultSet, error)

Find returns the set of results for the given query.

func (*BrandStore) FindAll added in v1.3.0

func (s *BrandStore) FindAll(q *BrandQuery) ([]*Brand, error)

FindAll returns a list of all the rows returned by the given query.

func (*BrandStore) FindOne added in v1.3.0

func (s *BrandStore) FindOne(q *BrandQuery) (*Brand, error)

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

func (*BrandStore) GenericStore added in v1.3.0

func (s *BrandStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

func (*BrandStore) Insert added in v1.3.0

func (s *BrandStore) Insert(record *Brand) error

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

func (*BrandStore) MustCount added in v1.3.0

func (s *BrandStore) MustCount(q *BrandQuery) int64

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

func (*BrandStore) MustFind added in v1.3.0

func (s *BrandStore) MustFind(q *BrandQuery) *BrandResultSet

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

func (*BrandStore) MustFindOne added in v1.3.0

func (s *BrandStore) MustFindOne(q *BrandQuery) *Brand

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

func (*BrandStore) Reload added in v1.3.0

func (s *BrandStore) Reload(record *Brand) error

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

func (*BrandStore) Save added in v1.3.0

func (s *BrandStore) Save(record *Brand) (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 (*BrandStore) SetGenericStore added in v1.3.0

func (s *BrandStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

func (*BrandStore) Transaction added in v1.3.0

func (s *BrandStore) Transaction(callback func(*BrandStore) 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 (*BrandStore) Update added in v1.3.0

func (s *BrandStore) Update(record *Brand, 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 C added in v1.3.0

type C struct {
	kallax.Model `table:"c" pk:"id,autoincr"`
	ID           int64
	Name         string
	B            *B `fk:",inverse"`
}

func NewC added in v1.3.0

func NewC(name string, b *B) (record *C)

NewC returns a new instance of C.

func (*C) ColumnAddress added in v1.3.0

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

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

func (*C) GetID added in v1.3.0

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

GetID returns the primary key of the model.

func (*C) NewRelationshipRecord added in v1.3.0

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

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

func (*C) SetRelationship added in v1.3.0

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

SetRelationship sets the given relationship in the given field.

func (*C) Value added in v1.3.0

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

Value returns the value of the given column.

type CQuery added in v1.3.0

type CQuery struct {
	*kallax.BaseQuery
}

CQuery is the object used to create queries for the C entity.

func NewCQuery added in v1.3.0

func NewCQuery() *CQuery

NewCQuery returns a new instance of CQuery.

func (*CQuery) BatchSize added in v1.3.0

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

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

func (*CQuery) Copy added in v1.3.0

func (q *CQuery) Copy() *CQuery

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 (*CQuery) FindByB added in v1.3.0

func (q *CQuery) FindByB(v int64) *CQuery

FindByB adds a new filter to the query that will require that the foreign key of B is equal to the passed value.

func (*CQuery) FindByID added in v1.3.0

func (q *CQuery) FindByID(v ...int64) *CQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*CQuery) FindByName added in v1.3.0

func (q *CQuery) FindByName(v string) *CQuery

FindByName adds a new filter to the query that will require that the Name property is equal to the passed value.

func (*CQuery) Limit added in v1.3.0

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

Limit sets the max number of items to retrieve.

func (*CQuery) Offset added in v1.3.0

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

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

func (*CQuery) Order added in v1.3.0

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

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

func (*CQuery) Select added in v1.3.0

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

Select adds columns to select in the query.

func (*CQuery) SelectNot added in v1.3.0

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

SelectNot excludes columns from being selected in the query.

func (*CQuery) Where added in v1.3.0

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

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

func (*CQuery) WithB added in v1.3.0

func (q *CQuery) WithB() *CQuery

type CResultSet added in v1.3.0

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

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

func NewCResultSet added in v1.3.0

func NewCResultSet(rs kallax.ResultSet) *CResultSet

NewCResultSet creates a new result set for rows of the type C.

func (*CResultSet) All added in v1.3.0

func (rs *CResultSet) All() ([]*C, error)

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

func (*CResultSet) Close added in v1.3.0

func (rs *CResultSet) Close() error

Close closes the result set.

func (*CResultSet) Err added in v1.3.0

func (rs *CResultSet) Err() error

Err returns the last error occurred.

func (*CResultSet) ForEach added in v1.3.0

func (rs *CResultSet) ForEach(fn func(*C) 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 (*CResultSet) Get added in v1.3.0

func (rs *CResultSet) Get() (*C, error)

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

func (*CResultSet) Next added in v1.3.0

func (rs *CResultSet) 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 (*CResultSet) One added in v1.3.0

func (rs *CResultSet) One() (*C, error)

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

type CStore added in v1.3.0

type CStore struct {
	*kallax.Store
}

CStore is the entity to access the records of the type C in the database.

func NewCStore added in v1.3.0

func NewCStore(db *sql.DB) *CStore

NewCStore creates a new instance of CStore using a SQL database.

func (*CStore) Count added in v1.3.0

func (s *CStore) Count(q *CQuery) (int64, error)

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

func (*CStore) Debug added in v1.3.0

func (s *CStore) Debug() *CStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*CStore) DebugWith added in v1.3.0

func (s *CStore) DebugWith(logger kallax.LoggerFunc) *CStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*CStore) Delete added in v1.3.0

func (s *CStore) Delete(record *C) error

Delete removes the given record from the database.

func (*CStore) DisableCacher added in v1.3.4

func (s *CStore) DisableCacher() *CStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*CStore) Find added in v1.3.0

func (s *CStore) Find(q *CQuery) (*CResultSet, error)

Find returns the set of results for the given query.

func (*CStore) FindAll added in v1.3.0

func (s *CStore) FindAll(q *CQuery) ([]*C, error)

FindAll returns a list of all the rows returned by the given query.

func (*CStore) FindOne added in v1.3.0

func (s *CStore) FindOne(q *CQuery) (*C, error)

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

func (*CStore) GenericStore added in v1.3.0

func (s *CStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

func (*CStore) Insert added in v1.3.0

func (s *CStore) Insert(record *C) error

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

func (*CStore) MustCount added in v1.3.0

func (s *CStore) MustCount(q *CQuery) int64

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

func (*CStore) MustFind added in v1.3.0

func (s *CStore) MustFind(q *CQuery) *CResultSet

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

func (*CStore) MustFindOne added in v1.3.0

func (s *CStore) MustFindOne(q *CQuery) *C

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

func (*CStore) Reload added in v1.3.0

func (s *CStore) Reload(record *C) error

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

func (*CStore) Save added in v1.3.0

func (s *CStore) Save(record *C) (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 (*CStore) SetGenericStore added in v1.3.0

func (s *CStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

func (*CStore) Transaction added in v1.3.0

func (s *CStore) Transaction(callback func(*CStore) 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 (*CStore) Update added in v1.3.0

func (s *CStore) Update(record *C, 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 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
	Brand        Brand `fk:"brand_id,inverse"`
	// 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) FindByBrand added in v1.3.0

func (q *CarQuery) FindByBrand(v kallax.ULID) *CarQuery

FindByBrand adds a new filter to the query that will require that the foreign key of Brand is equal to the passed value.

func (*CarQuery) FindByID added in v1.0.0

func (q *CarQuery) FindByID(v ...kallax.ULID) *CarQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*CarQuery) FindByModelName added in v1.0.0

func (q *CarQuery) FindByModelName(v string) *CarQuery

FindByModelName adds a new filter to the query that will require that the ModelName property is equal to the passed value.

func (*CarQuery) FindByOwner added in v1.1.0

func (q *CarQuery) FindByOwner(v int64) *CarQuery

FindByOwner adds a new filter to the query that will require that the foreign key of Owner is equal to the passed value.

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) WithBrand added in v1.3.0

func (q *CarQuery) WithBrand() *CarQuery

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) Debug added in v1.1.4

func (s *CarStore) Debug() *CarStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*CarStore) DebugWith added in v1.1.4

func (s *CarStore) DebugWith(logger kallax.LoggerFunc) *CarStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

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) DisableCacher added in v1.3.4

func (s *CarStore) DisableCacher() *CarStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

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) FindAll added in v1.2.1

func (s *CarStore) FindAll(q *CarQuery) ([]*Car, error)

FindAll returns a list of all the rows returned by 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) GenericStore added in v1.1.0

func (s *CarStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

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) SetGenericStore added in v1.1.0

func (s *CarStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

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 Child added in v1.2.8

type Child struct {
	kallax.Model `table:"children"`
	ID           int64 `pk:"autoincr"`
	Name         string
}

func NewChild added in v1.2.8

func NewChild() (record *Child)

NewChild returns a new instance of Child.

func (*Child) ColumnAddress added in v1.2.8

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

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

func (*Child) GetID added in v1.2.8

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

GetID returns the primary key of the model.

func (*Child) NewRelationshipRecord added in v1.2.8

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

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

func (*Child) SetRelationship added in v1.2.8

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

SetRelationship sets the given relationship in the given field.

func (*Child) Value added in v1.2.8

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

Value returns the value of the given column.

type ChildQuery added in v1.2.8

type ChildQuery struct {
	*kallax.BaseQuery
}

ChildQuery is the object used to create queries for the Child entity.

func NewChildQuery added in v1.2.8

func NewChildQuery() *ChildQuery

NewChildQuery returns a new instance of ChildQuery.

func (*ChildQuery) BatchSize added in v1.2.8

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

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

func (*ChildQuery) Copy added in v1.2.8

func (q *ChildQuery) Copy() *ChildQuery

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 (*ChildQuery) FindByID added in v1.2.8

func (q *ChildQuery) FindByID(v ...int64) *ChildQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

func (*ChildQuery) FindByName added in v1.2.8

func (q *ChildQuery) FindByName(v string) *ChildQuery

FindByName adds a new filter to the query that will require that the Name property is equal to the passed value.

func (*ChildQuery) Limit added in v1.2.8

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

Limit sets the max number of items to retrieve.

func (*ChildQuery) Offset added in v1.2.8

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

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

func (*ChildQuery) Order added in v1.2.8

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

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

func (*ChildQuery) Select added in v1.2.8

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

Select adds columns to select in the query.

func (*ChildQuery) SelectNot added in v1.2.8

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

SelectNot excludes columns from being selected in the query.

func (*ChildQuery) Where added in v1.2.8

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

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

type ChildResultSet added in v1.2.8

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

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

func NewChildResultSet added in v1.2.8

func NewChildResultSet(rs kallax.ResultSet) *ChildResultSet

NewChildResultSet creates a new result set for rows of the type Child.

func (*ChildResultSet) All added in v1.2.8

func (rs *ChildResultSet) All() ([]*Child, error)

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

func (*ChildResultSet) Close added in v1.2.8

func (rs *ChildResultSet) Close() error

Close closes the result set.

func (*ChildResultSet) Err added in v1.2.8

func (rs *ChildResultSet) Err() error

Err returns the last error occurred.

func (*ChildResultSet) ForEach added in v1.2.8

func (rs *ChildResultSet) ForEach(fn func(*Child) 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 (*ChildResultSet) Get added in v1.2.8

func (rs *ChildResultSet) Get() (*Child, error)

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

func (*ChildResultSet) Next added in v1.2.8

func (rs *ChildResultSet) 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 (*ChildResultSet) One added in v1.2.8

func (rs *ChildResultSet) One() (*Child, error)

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

type ChildStore added in v1.2.8

type ChildStore struct {
	*kallax.Store
}

ChildStore is the entity to access the records of the type Child in the database.

func NewChildStore added in v1.2.8

func NewChildStore(db *sql.DB) *ChildStore

NewChildStore creates a new instance of ChildStore using a SQL database.

func (*ChildStore) Count added in v1.2.8

func (s *ChildStore) Count(q *ChildQuery) (int64, error)

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

func (*ChildStore) Debug added in v1.2.8

func (s *ChildStore) Debug() *ChildStore

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*ChildStore) DebugWith added in v1.2.8

func (s *ChildStore) DebugWith(logger kallax.LoggerFunc) *ChildStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*ChildStore) Delete added in v1.2.8

func (s *ChildStore) Delete(record *Child) error

Delete removes the given record from the database.

func (*ChildStore) DisableCacher added in v1.3.4

func (s *ChildStore) DisableCacher() *ChildStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*ChildStore) Find added in v1.2.8

func (s *ChildStore) Find(q *ChildQuery) (*ChildResultSet, error)

Find returns the set of results for the given query.

func (*ChildStore) FindAll added in v1.2.8

func (s *ChildStore) FindAll(q *ChildQuery) ([]*Child, error)

FindAll returns a list of all the rows returned by the given query.

func (*ChildStore) FindOne added in v1.2.8

func (s *ChildStore) FindOne(q *ChildQuery) (*Child, error)

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

func (*ChildStore) GenericStore added in v1.2.8

func (s *ChildStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

func (*ChildStore) Insert added in v1.2.8

func (s *ChildStore) Insert(record *Child) error

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

func (*ChildStore) MustCount added in v1.2.8

func (s *ChildStore) MustCount(q *ChildQuery) int64

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

func (*ChildStore) MustFind added in v1.2.8

func (s *ChildStore) MustFind(q *ChildQuery) *ChildResultSet

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

func (*ChildStore) MustFindOne added in v1.2.8

func (s *ChildStore) MustFindOne(q *ChildQuery) *Child

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

func (*ChildStore) Reload added in v1.2.8

func (s *ChildStore) Reload(record *Child) error

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

func (*ChildStore) Save added in v1.2.8

func (s *ChildStore) Save(record *Child) (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 (*ChildStore) SetGenericStore added in v1.2.8

func (s *ChildStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

func (*ChildStore) Transaction added in v1.2.8

func (s *ChildStore) Transaction(callback func(*ChildStore) 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 (*ChildStore) Update added in v1.2.8

func (s *ChildStore) Update(record *Child, 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) FindByID added in v1.0.0

func (q *EventsAllFixtureQuery) FindByID(v ...kallax.ULID) *EventsAllFixtureQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

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) Debug added in v1.1.4

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*EventsAllFixtureStore) DebugWith added in v1.1.4

func (s *EventsAllFixtureStore) DebugWith(logger kallax.LoggerFunc) *EventsAllFixtureStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

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) DisableCacher added in v1.3.4

func (s *EventsAllFixtureStore) DisableCacher() *EventsAllFixtureStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*EventsAllFixtureStore) Find added in v0.13.0

Find returns the set of results for the given query.

func (*EventsAllFixtureStore) FindAll added in v1.2.1

FindAll returns a list of all the rows returned by 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) GenericStore added in v1.1.0

func (s *EventsAllFixtureStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

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) SetGenericStore added in v1.1.0

func (s *EventsAllFixtureStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

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) FindByID added in v1.0.0

func (q *EventsFixtureQuery) FindByID(v ...kallax.ULID) *EventsFixtureQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

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) Debug added in v1.1.4

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*EventsFixtureStore) DebugWith added in v1.1.4

func (s *EventsFixtureStore) DebugWith(logger kallax.LoggerFunc) *EventsFixtureStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*EventsFixtureStore) Delete

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

Delete removes the given record from the database.

func (*EventsFixtureStore) DisableCacher added in v1.3.4

func (s *EventsFixtureStore) DisableCacher() *EventsFixtureStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*EventsFixtureStore) Find

Find returns the set of results for the given query.

func (*EventsFixtureStore) FindAll added in v1.2.1

FindAll returns a list of all the rows returned by 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) GenericStore added in v1.1.0

func (s *EventsFixtureStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

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) SetGenericStore added in v1.1.0

func (s *EventsFixtureStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

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) FindByID added in v1.0.0

func (q *EventsSaveFixtureQuery) FindByID(v ...kallax.ULID) *EventsSaveFixtureQuery

FindByID adds a new filter to the query that will require that the ID property is equal to one of the passed values; if no passed values, it will do nothing.

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) Debug added in v1.1.4

Debug returns a new store that will print all SQL statements to stdout using the log.Printf function.

func (*EventsSaveFixtureStore) DebugWith added in v1.1.4

func (s *EventsSaveFixtureStore) DebugWith(logger kallax.LoggerFunc) *EventsSaveFixtureStore

DebugWith returns a new store that will print all SQL statements using the given logger function.

func (*EventsSaveFixtureStore) Delete

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

Delete removes the given record from the database.

func (*EventsSaveFixtureStore) DisableCacher added in v1.3.4

func (s *EventsSaveFixtureStore) DisableCacher() *EventsSaveFixtureStore

DisableCacher turns off prepared statements, which can be useful in some scenarios.

func (*EventsSaveFixtureStore) Find

Find returns the set of results for the given query.

func (*EventsSaveFixtureStore) FindAll added in v1.2.1

FindAll returns a list of all the rows returned by 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) GenericStore added in v1.1.0

func (s *EventsSaveFixtureStore) GenericStore() *kallax.Store

GenericStore returns the generic store of this store.

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) SetGenericStore added in v1.1.0

func (s *EventsSaveFixtureStore) SetGenericStore(store *kallax.Store)

SetGenericStore changes the generic store of this store.

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 v