models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: AGPL-3.0 Imports: 7 Imported by: 3

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

View Source
const (
	EventStatusNew       = EventStatus("new")
	EventStatusProcessed = EventStatus("processed")
	EventStatusFailed    = EventStatus("failed")
)

Variables

View Source
var Schema = &schema{
	Comment: &schemaComment{
		BaseSchema: kallax.NewBaseSchema(
			"comment",
			"__comment",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"ReviewEvent": kallax.NewForeignKey("review_event_id", true),
			},
			func() kallax.Record {
				return new(Comment)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("review_event_id"),
			kallax.NewSchemaField("file"),
			kallax.NewSchemaField("line"),
			kallax.NewSchemaField("text"),
			kallax.NewSchemaField("confidence"),
		),
		ID:            kallax.NewSchemaField("id"),
		ReviewEventFK: kallax.NewSchemaField("review_event_id"),
		File:          kallax.NewSchemaField("file"),
		Line:          kallax.NewSchemaField("line"),
		Text:          kallax.NewSchemaField("text"),
		Confidence:    kallax.NewSchemaField("confidence"),
	},
	PushEvent: &schemaPushEvent{
		BaseSchema: kallax.NewBaseSchema(
			"push_event",
			"__pushevent",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(PushEvent)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("status"),
			kallax.NewSchemaField("provider"),
			kallax.NewSchemaField("internal_id"),
			kallax.NewSchemaField("created_at"),
			kallax.NewSchemaField("commits"),
			kallax.NewSchemaField("distinct_commits"),
			kallax.NewSchemaField("configuration"),
			kallax.NewSchemaField("base"),
			kallax.NewSchemaField("head"),
		),
		ID:              kallax.NewSchemaField("id"),
		Status:          kallax.NewSchemaField("status"),
		Provider:        kallax.NewSchemaField("provider"),
		InternalID:      kallax.NewSchemaField("internal_id"),
		CreatedAt:       kallax.NewSchemaField("created_at"),
		Commits:         kallax.NewSchemaField("commits"),
		DistinctCommits: kallax.NewSchemaField("distinct_commits"),
		Configuration: &schemaPushEventConfiguration{
			BaseSchemaField: kallax.NewSchemaField("configuration").(*kallax.BaseSchemaField),
			Fields:          kallax.NewJSONSchemaKey(kallax.JSONAny, "push_event", "configuration", "fields"),
		},
		Base: &schemaPushEventBase{
			BaseSchemaField:       kallax.NewSchemaField("base").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "base", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "base", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "base", "hash"),
		},
		Head: &schemaPushEventHead{
			BaseSchemaField:       kallax.NewSchemaField("head").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "head", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "head", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "push_event", "head", "hash"),
		},
	},
	ReviewEvent: &schemaReviewEvent{
		BaseSchema: kallax.NewBaseSchema(
			"review_event",
			"__reviewevent",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(ReviewEvent)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("status"),
			kallax.NewSchemaField("provider"),
			kallax.NewSchemaField("internal_id"),
			kallax.NewSchemaField("created_at"),
			kallax.NewSchemaField("updated_at"),
			kallax.NewSchemaField("is_mergeable"),
			kallax.NewSchemaField("source"),
			kallax.NewSchemaField("merge"),
			kallax.NewSchemaField("configuration"),
			kallax.NewSchemaField("repository_id"),
			kallax.NewSchemaField("number"),
			kallax.NewSchemaField("base"),
			kallax.NewSchemaField("head"),
		),
		ID:          kallax.NewSchemaField("id"),
		Status:      kallax.NewSchemaField("status"),
		Provider:    kallax.NewSchemaField("provider"),
		InternalID:  kallax.NewSchemaField("internal_id"),
		CreatedAt:   kallax.NewSchemaField("created_at"),
		UpdatedAt:   kallax.NewSchemaField("updated_at"),
		IsMergeable: kallax.NewSchemaField("is_mergeable"),
		Source: &schemaReviewEventSource{
			BaseSchemaField:       kallax.NewSchemaField("source").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "source", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "source", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "source", "hash"),
		},
		Merge: &schemaReviewEventMerge{
			BaseSchemaField:       kallax.NewSchemaField("merge").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "merge", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "merge", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "merge", "hash"),
		},
		Configuration: &schemaReviewEventConfiguration{
			BaseSchemaField: kallax.NewSchemaField("configuration").(*kallax.BaseSchemaField),
			Fields:          kallax.NewJSONSchemaKey(kallax.JSONAny, "review_event", "configuration", "fields"),
		},
		RepositoryID: kallax.NewSchemaField("repository_id"),
		Number:       kallax.NewSchemaField("number"),
		Base: &schemaReviewEventBase{
			BaseSchemaField:       kallax.NewSchemaField("base").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "base", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "base", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "base", "hash"),
		},
		Head: &schemaReviewEventHead{
			BaseSchemaField:       kallax.NewSchemaField("head").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "head", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "head", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "review_event", "head", "hash"),
		},
	},
}

Functions

This section is empty.

Types

type Comment

type Comment struct {
	kallax.Model `pk:"id"`
	ID           kallax.ULID
	ReviewEvent  *ReviewEvent `fk:",inverse"`

	lookout.Comment `kallax:",inline"`
}

Comment is a persisted model for comment

func NewComment

func NewComment(r *ReviewEvent, c *pb.Comment) (record *Comment)

NewComment returns a new instance of Comment.

func (*Comment) ColumnAddress

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

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

func (*Comment) GetID

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

GetID returns the primary key of the model.

func (*Comment) NewRelationshipRecord

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

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

func (*Comment) SetRelationship

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

SetRelationship sets the given relationship in the given field.

func (*Comment) Value

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

Value returns the value of the given column.

type CommentQuery

type CommentQuery struct {
	*kallax.BaseQuery
}

CommentQuery is the object used to create queries for the Comment entity.

func NewCommentQuery

func NewCommentQuery() *CommentQuery

NewCommentQuery returns a new instance of CommentQuery.

func (*CommentQuery) BatchSize

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

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

func (*CommentQuery) Copy

func (q *CommentQuery) Copy() *CommentQuery

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 (*CommentQuery) FindByConfidence

func (q *CommentQuery) FindByConfidence(cond kallax.ScalarCond, v uint32) *CommentQuery

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

func (*CommentQuery) FindByFile

func (q *CommentQuery) FindByFile(v string) *CommentQuery

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

func (*CommentQuery) FindByID

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

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 (*CommentQuery) FindByLine

func (q *CommentQuery) FindByLine(cond kallax.ScalarCond, v int32) *CommentQuery

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

func (*CommentQuery) FindByReviewEvent

func (q *CommentQuery) FindByReviewEvent(v kallax.ULID) *CommentQuery

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

func (*CommentQuery) FindByText

func (q *CommentQuery) FindByText(v string) *CommentQuery

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

func (*CommentQuery) Limit

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

Limit sets the max number of items to retrieve.

func (*CommentQuery) Offset

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

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

func (*CommentQuery) Order

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

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

func (*CommentQuery) Select

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

Select adds columns to select in the query.

func (*CommentQuery) SelectNot

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

SelectNot excludes columns from being selected in the query.

func (*CommentQuery) Where

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

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

func (*CommentQuery) WithReviewEvent

func (q *CommentQuery) WithReviewEvent() *CommentQuery

type CommentResultSet

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

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

func NewCommentResultSet

func NewCommentResultSet(rs kallax.ResultSet) *CommentResultSet

NewCommentResultSet creates a new result set for rows of the type Comment.

func (*CommentResultSet) All

func (rs *CommentResultSet) All() ([]*Comment, error)

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

func (*CommentResultSet) Close

func (rs *CommentResultSet) Close() error

Close closes the result set.

func (*CommentResultSet) Err

func (rs *CommentResultSet) Err() error

Err returns the last error occurred.

func (*CommentResultSet) ForEach

func (rs *CommentResultSet) ForEach(fn func(*Comment) 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 (*CommentResultSet) Get

func (rs *CommentResultSet) Get() (*Comment, error)

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

func (*CommentResultSet) Next

func (rs *CommentResultSet) 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 (*CommentResultSet) One

func (rs *CommentResultSet) One() (*Comment, error)

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

type CommentStore

type CommentStore struct {
	*kallax.Store
}

CommentStore is the entity to access the records of the type Comment in the database.

func NewCommentStore

func NewCommentStore(db *sql.DB) *CommentStore

NewCommentStore creates a new instance of CommentStore using a SQL database.

func (*CommentStore) Count

func (s *CommentStore) Count(q *CommentQuery) (int64, error)

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

func (*CommentStore) Debug

func (s *CommentStore) Debug() *CommentStore

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

func (*CommentStore) DebugWith

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

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

func (*CommentStore) Delete

func (s *CommentStore) Delete(record *Comment) error

Delete removes the given record from the database.

func (*CommentStore) DisableCacher

func (s *CommentStore) DisableCacher() *CommentStore

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

func (*CommentStore) Find

Find returns the set of results for the given query.

func (*CommentStore) FindAll

func (s *CommentStore) FindAll(q *CommentQuery) ([]*Comment, error)

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

func (*CommentStore) FindOne

func (s *CommentStore) FindOne(q *CommentQuery) (*Comment, error)

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

func (*CommentStore) GenericStore

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

GenericStore returns the generic store of this store.

func (*CommentStore) Insert

func (s *CommentStore) Insert(record *Comment) error

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

func (*CommentStore) MustCount

func (s *CommentStore) MustCount(q *CommentQuery) int64

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

func (*CommentStore) MustFind

func (s *CommentStore) MustFind(q *CommentQuery) *CommentResultSet

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

func (*CommentStore) MustFindOne

func (s *CommentStore) MustFindOne(q *CommentQuery) *Comment

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

func (*CommentStore) Reload

func (s *CommentStore) Reload(record *Comment) error

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

func (*CommentStore) Save

func (s *CommentStore) Save(record *Comment) (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 (*CommentStore) SetGenericStore

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

SetGenericStore changes the generic store of this store.

func (*CommentStore) Transaction

func (s *CommentStore) Transaction(callback func(*CommentStore) 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 (*CommentStore) Update

func (s *CommentStore) Update(record *Comment, 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 EventStatus

type EventStatus string

type PushEvent

type PushEvent struct {
	kallax.Model `pk:"id"`
	ID           kallax.ULID
	Status       EventStatus

	// can't be pointer or kallax panics
	lookout.PushEvent `kallax:",inline"`
}

PushEvent is a persisted model for review event

func NewPushEvent

func NewPushEvent(e *pb.PushEvent) (record *PushEvent)

NewPushEvent returns a new instance of PushEvent.

func (*PushEvent) ColumnAddress

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

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

func (*PushEvent) GetID

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

GetID returns the primary key of the model.

func (*PushEvent) NewRelationshipRecord

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

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

func (*PushEvent) SetRelationship

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

SetRelationship sets the given relationship in the given field.

func (*PushEvent) Value

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

Value returns the value of the given column.

type PushEventQuery

type PushEventQuery struct {
	*kallax.BaseQuery
}

PushEventQuery is the object used to create queries for the PushEvent entity.

func NewPushEventQuery

func NewPushEventQuery() *PushEventQuery

NewPushEventQuery returns a new instance of PushEventQuery.

func (*PushEventQuery) BatchSize

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

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

func (*PushEventQuery) Copy

func (q *PushEventQuery) Copy() *PushEventQuery

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 (*PushEventQuery) FindByCommits

func (q *PushEventQuery) FindByCommits(cond kallax.ScalarCond, v uint32) *PushEventQuery

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

func (*PushEventQuery) FindByCreatedAt

func (q *PushEventQuery) FindByCreatedAt(cond kallax.ScalarCond, v time.Time) *PushEventQuery

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

func (*PushEventQuery) FindByDistinctCommits

func (q *PushEventQuery) FindByDistinctCommits(cond kallax.ScalarCond, v uint32) *PushEventQuery

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

func (*PushEventQuery) FindByID

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

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 (*PushEventQuery) FindByInternalID

func (q *PushEventQuery) FindByInternalID(v string) *PushEventQuery

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

func (*PushEventQuery) FindByProvider

func (q *PushEventQuery) FindByProvider(v string) *PushEventQuery

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

func (*PushEventQuery) FindByStatus

func (q *PushEventQuery) FindByStatus(v EventStatus) *PushEventQuery

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

func (*PushEventQuery) Limit

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

Limit sets the max number of items to retrieve.

func (*PushEventQuery) Offset

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

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

func (*PushEventQuery) Order

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

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

func (*PushEventQuery) Select

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

Select adds columns to select in the query.

func (*PushEventQuery) SelectNot

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

SelectNot excludes columns from being selected in the query.

func (*PushEventQuery) Where

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

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

type PushEventResultSet

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

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

func NewPushEventResultSet

func NewPushEventResultSet(rs kallax.ResultSet) *PushEventResultSet

NewPushEventResultSet creates a new result set for rows of the type PushEvent.

func (*PushEventResultSet) All

func (rs *PushEventResultSet) All() ([]*PushEvent, error)

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

func (*PushEventResultSet) Close

func (rs *PushEventResultSet) Close() error

Close closes the result set.

func (*PushEventResultSet) Err

func (rs *PushEventResultSet) Err() error

Err returns the last error occurred.

func (*PushEventResultSet) ForEach

func (rs *PushEventResultSet) ForEach(fn func(*PushEvent) 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 (*PushEventResultSet) Get

func (rs *PushEventResultSet) Get() (*PushEvent, error)

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

func (*PushEventResultSet) Next

func (rs *PushEventResultSet) 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 (*PushEventResultSet) One

func (rs *PushEventResultSet) One() (*PushEvent, error)

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

type PushEventStore

type PushEventStore struct {
	*kallax.Store
}

PushEventStore is the entity to access the records of the type PushEvent in the database.

func NewPushEventStore

func NewPushEventStore(db *sql.DB) *PushEventStore

NewPushEventStore creates a new instance of PushEventStore using a SQL database.

func (*PushEventStore) Count

func (s *PushEventStore) Count(q *PushEventQuery) (int64, error)

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

func (*PushEventStore) Debug

func (s *PushEventStore) Debug() *PushEventStore

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

func (*PushEventStore) DebugWith

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

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

func (*PushEventStore) Delete

func (s *PushEventStore) Delete(record *PushEvent) error

Delete removes the given record from the database.

func (*PushEventStore) DisableCacher

func (s *PushEventStore) DisableCacher() *PushEventStore

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

func (*PushEventStore) Find

Find returns the set of results for the given query.

func (*PushEventStore) FindAll

func (s *PushEventStore) FindAll(q *PushEventQuery) ([]*PushEvent, error)

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

func (*PushEventStore) FindOne

func (s *PushEventStore) FindOne(q *PushEventQuery) (*PushEvent, error)

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

func (*PushEventStore) GenericStore

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

GenericStore returns the generic store of this store.

func (*PushEventStore) Insert

func (s *PushEventStore) Insert(record *PushEvent) error

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

func (*PushEventStore) MustCount

func (s *PushEventStore) MustCount(q *PushEventQuery) int64

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

func (*PushEventStore) MustFind

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

func (*PushEventStore) MustFindOne

func (s *PushEventStore) MustFindOne(q *PushEventQuery) *PushEvent

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

func (*PushEventStore) Reload

func (s *PushEventStore) Reload(record *PushEvent) error

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

func (*PushEventStore) Save

func (s *PushEventStore) Save(record *PushEvent) (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 (*PushEventStore) SetGenericStore

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

SetGenericStore changes the generic store of this store.

func (*PushEventStore) Transaction

func (s *PushEventStore) Transaction(callback func(*PushEventStore) 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 (*PushEventStore) Update

func (s *PushEventStore) Update(record *PushEvent, 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 ReviewEvent

type ReviewEvent struct {
	kallax.Model `pk:"id"`
	ID           kallax.ULID
	Status       EventStatus

	// can't be pointer or kallax panics
	lookout.ReviewEvent `kallax:",inline"`
}

ReviewEvent is a persisted model for review event

func NewReviewEvent

func NewReviewEvent(e *pb.ReviewEvent) (record *ReviewEvent)

NewReviewEvent returns a new instance of ReviewEvent.

func (*ReviewEvent) ColumnAddress

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

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

func (*ReviewEvent) GetID

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

GetID returns the primary key of the model.

func (*ReviewEvent) NewRelationshipRecord

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

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

func (*ReviewEvent) SetRelationship

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

SetRelationship sets the given relationship in the given field.

func (*ReviewEvent) Value

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

Value returns the value of the given column.

type ReviewEventQuery

type ReviewEventQuery struct {
	*kallax.BaseQuery
}

ReviewEventQuery is the object used to create queries for the ReviewEvent entity.

func NewReviewEventQuery

func NewReviewEventQuery() *ReviewEventQuery

NewReviewEventQuery returns a new instance of ReviewEventQuery.

func (*ReviewEventQuery) BatchSize

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

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

func (*ReviewEventQuery) 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 (*ReviewEventQuery) FindByCreatedAt

func (q *ReviewEventQuery) FindByCreatedAt(cond kallax.ScalarCond, v time.Time) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByID

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

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 (*ReviewEventQuery) FindByInternalID

func (q *ReviewEventQuery) FindByInternalID(v string) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByIsMergeable

func (q *ReviewEventQuery) FindByIsMergeable(v bool) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByNumber

func (q *ReviewEventQuery) FindByNumber(cond kallax.ScalarCond, v uint32) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByProvider

func (q *ReviewEventQuery) FindByProvider(v string) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByRepositoryID

func (q *ReviewEventQuery) FindByRepositoryID(cond kallax.ScalarCond, v uint32) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByStatus

func (q *ReviewEventQuery) FindByStatus(v EventStatus) *ReviewEventQuery

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

func (*ReviewEventQuery) FindByUpdatedAt

func (q *ReviewEventQuery) FindByUpdatedAt(cond kallax.ScalarCond, v time.Time) *ReviewEventQuery

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

func (*ReviewEventQuery) Limit

Limit sets the max number of items to retrieve.

func (*ReviewEventQuery) Offset

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

func (*ReviewEventQuery) Order

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

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

func (*ReviewEventQuery) Select

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

Select adds columns to select in the query.

func (*ReviewEventQuery) SelectNot

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

SelectNot excludes columns from being selected in the query.

func (*ReviewEventQuery) Where

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

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

type ReviewEventResultSet

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

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

func NewReviewEventResultSet

func NewReviewEventResultSet(rs kallax.ResultSet) *ReviewEventResultSet

NewReviewEventResultSet creates a new result set for rows of the type ReviewEvent.

func (*ReviewEventResultSet) All

func (rs *ReviewEventResultSet) All() ([]*ReviewEvent, error)

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

func (*ReviewEventResultSet) Close

func (rs *ReviewEventResultSet) Close() error

Close closes the result set.

func (*ReviewEventResultSet) Err

func (rs *ReviewEventResultSet) Err() error

Err returns the last error occurred.

func (*ReviewEventResultSet) ForEach

func (rs *ReviewEventResultSet) ForEach(fn func(*ReviewEvent) 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 (*ReviewEventResultSet) Get

func (rs *ReviewEventResultSet) Get() (*ReviewEvent, error)

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

func (*ReviewEventResultSet) Next

func (rs *ReviewEventResultSet) 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 (*ReviewEventResultSet) One

func (rs *ReviewEventResultSet) One() (*ReviewEvent, error)

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

type ReviewEventStore

type ReviewEventStore struct {
	*kallax.Store
}

ReviewEventStore is the entity to access the records of the type ReviewEvent in the database.

func NewReviewEventStore

func NewReviewEventStore(db *sql.DB) *ReviewEventStore

NewReviewEventStore creates a new instance of ReviewEventStore using a SQL database.

func (*ReviewEventStore) Count

func (s *ReviewEventStore) Count(q *ReviewEventQuery) (int64, error)

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

func (*ReviewEventStore) Debug

func (s *ReviewEventStore) Debug() *ReviewEventStore

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

func (*ReviewEventStore) DebugWith

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

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

func (*ReviewEventStore) Delete

func (s *ReviewEventStore) Delete(record *ReviewEvent) error

Delete removes the given record from the database.

func (*ReviewEventStore) DisableCacher

func (s *ReviewEventStore) DisableCacher() *ReviewEventStore

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

func (*ReviewEventStore) Find

Find returns the set of results for the given query.

func (*ReviewEventStore) FindAll

func (s *ReviewEventStore) FindAll(q *ReviewEventQuery) ([]*ReviewEvent, error)

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

func (*ReviewEventStore) FindOne

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

func (*ReviewEventStore) GenericStore

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

GenericStore returns the generic store of this store.

func (*ReviewEventStore) Insert

func (s *ReviewEventStore) Insert(record *ReviewEvent) error

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

func (*ReviewEventStore) MustCount

func (s *ReviewEventStore) MustCount(q *ReviewEventQuery) int64

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

func (*ReviewEventStore) MustFind

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

func (*ReviewEventStore) MustFindOne

func (s *ReviewEventStore) MustFindOne(q *ReviewEventQuery) *ReviewEvent

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

func (*ReviewEventStore) Reload

func (s *ReviewEventStore) Reload(record *ReviewEvent) error

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

func (*ReviewEventStore) Save

func (s *ReviewEventStore) Save(record *ReviewEvent) (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 (*ReviewEventStore) SetGenericStore

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

SetGenericStore changes the generic store of this store.

func (*ReviewEventStore) Transaction

func (s *ReviewEventStore) Transaction(callback func(*ReviewEventStore) 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 (*ReviewEventStore) Update

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

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

Jump to

Keyboard shortcuts

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