models

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: AGPL-3.0 Imports: 8 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

View Source
const (
	EventStatusNew       = EventStatus("new")
	EventStatusPosting   = EventStatus("posting")
	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("created_at"),
			kallax.NewSchemaField("updated_at"),
			kallax.NewSchemaField("review_event_id"),
			kallax.NewSchemaField("file"),
			kallax.NewSchemaField("line"),
			kallax.NewSchemaField("text"),
			kallax.NewSchemaField("confidence"),
			kallax.NewSchemaField("analyzer"),
		),
		ID:            kallax.NewSchemaField("id"),
		CreatedAt:     kallax.NewSchemaField("created_at"),
		UpdatedAt:     kallax.NewSchemaField("updated_at"),
		ReviewEventFK: kallax.NewSchemaField("review_event_id"),
		File:          kallax.NewSchemaField("file"),
		Line:          kallax.NewSchemaField("line"),
		Text:          kallax.NewSchemaField("text"),
		Confidence:    kallax.NewSchemaField("confidence"),
		Analyzer:      kallax.NewSchemaField("analyzer"),
	},
	Organization: &schemaOrganization{
		BaseSchema: kallax.NewBaseSchema(
			"organization",
			"__organization",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(Organization)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("provider"),
			kallax.NewSchemaField("internal_id"),
			kallax.NewSchemaField("config"),
		),
		ID:         kallax.NewSchemaField("id"),
		Provider:   kallax.NewSchemaField("provider"),
		InternalID: kallax.NewSchemaField("internal_id"),
		Config:     kallax.NewSchemaField("config"),
	},
	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"),
			kallax.NewSchemaField("organization_id"),
		),
		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"),
			XXX_NoUnkeyedLiteral: kallax.NewJSONSchemaKey(kallax.JSONAny, "push_event", "configuration", "-"),
			XXX_unrecognized:     kallax.NewJSONSchemaArray("push_event", "configuration", "-"),
			XXX_sizecache:        kallax.NewJSONSchemaKey(kallax.JSONInt, "push_event", "configuration", "-"),
		},
		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"),
		},
		OrganizationID: kallax.NewSchemaField("organization_id"),
	},
	ReviewEvent: &schemaReviewEvent{
		BaseSchema: kallax.NewBaseSchema(
			"review_event",
			"__reviewevent",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{
				"ReviewTarget": kallax.NewForeignKey("review_target_id", true),
			},
			func() kallax.Record {
				return new(ReviewEvent)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("status"),
			kallax.NewSchemaField("internal_id"),
			kallax.NewSchemaField("is_mergeable"),
			kallax.NewSchemaField("source"),
			kallax.NewSchemaField("configuration"),
			kallax.NewSchemaField("base"),
			kallax.NewSchemaField("head"),
			kallax.NewSchemaField("created_at"),
			kallax.NewSchemaField("updated_at"),
			kallax.NewSchemaField("review_target_id"),
		),
		ID:          kallax.NewSchemaField("id"),
		Status:      kallax.NewSchemaField("status"),
		InternalID:  kallax.NewSchemaField("internal_id"),
		IsMergeable: kallax.NewSchemaField("is_mergeable"),
		Source: &schemaReviewEventSource{
			BaseSchemaField:       kallax.NewSchemaField("source").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "source", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "source", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "source", "hash"),
		},
		Configuration: &schemaReviewEventConfiguration{
			BaseSchemaField:      kallax.NewSchemaField("configuration").(*kallax.BaseSchemaField),
			Fields:               kallax.NewJSONSchemaKey(kallax.JSONAny, "configuration", "fields"),
			XXX_NoUnkeyedLiteral: kallax.NewJSONSchemaKey(kallax.JSONAny, "configuration", "-"),
			XXX_unrecognized:     kallax.NewJSONSchemaArray("configuration", "-"),
			XXX_sizecache:        kallax.NewJSONSchemaKey(kallax.JSONInt, "configuration", "-"),
		},
		Base: &schemaReviewEventBase{
			BaseSchemaField:       kallax.NewSchemaField("base").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "base", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "base", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "base", "hash"),
		},
		Head: &schemaReviewEventHead{
			BaseSchemaField:       kallax.NewSchemaField("head").(*kallax.BaseSchemaField),
			InternalRepositoryURL: kallax.NewJSONSchemaKey(kallax.JSONText, "head", "internal_repository_url"),
			ReferenceName:         kallax.NewJSONSchemaKey(kallax.JSONText, "head", "reference_name"),
			Hash:                  kallax.NewJSONSchemaKey(kallax.JSONText, "head", "hash"),
		},
		CreatedAt:      kallax.NewSchemaField("created_at"),
		UpdatedAt:      kallax.NewSchemaField("updated_at"),
		ReviewTargetFK: kallax.NewSchemaField("review_target_id"),
	},
	ReviewTarget: &schemaReviewTarget{
		BaseSchema: kallax.NewBaseSchema(
			"review_target",
			"__reviewtarget",
			kallax.NewSchemaField("id"),
			kallax.ForeignKeys{},
			func() kallax.Record {
				return new(ReviewTarget)
			},
			false,
			kallax.NewSchemaField("id"),
			kallax.NewSchemaField("created_at"),
			kallax.NewSchemaField("updated_at"),
			kallax.NewSchemaField("provider"),
			kallax.NewSchemaField("internal_id"),
			kallax.NewSchemaField("repository_id"),
			kallax.NewSchemaField("number"),
		),
		ID:           kallax.NewSchemaField("id"),
		CreatedAt:    kallax.NewSchemaField("created_at"),
		UpdatedAt:    kallax.NewSchemaField("updated_at"),
		Provider:     kallax.NewSchemaField("provider"),
		InternalID:   kallax.NewSchemaField("internal_id"),
		RepositoryID: kallax.NewSchemaField("repository_id"),
		Number:       kallax.NewSchemaField("number"),
	},
}

Functions

This section is empty.

Types

type Comment

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

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

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) FindByAnalyzer added in v0.1.5

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

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

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) FindByCreatedAt added in v0.1.5

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

FindByCreatedAt adds a new filter to the query that will require that the CreatedAt 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) FindByUpdatedAt added in v0.1.5

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

FindByUpdatedAt adds a new filter to the query that will require that the UpdatedAt 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 Organization added in v0.8.0

type Organization struct {
	kallax.Model `pk:"id"`
	ID           kallax.ULID
	Provider     string
	InternalID   string
	Config       string
}

Organization is a persisted model for an Organization (e.g. a GitHub App installation). It contains settings for a group of repositories. The primary key should be (Provider,InternalID), but kallax does not support composite or string keys. It also does not support setting uniqueness on multiple columns.

func NewOrganization added in v0.8.0

func NewOrganization(provider string, internalID string, config string) (record *Organization)

NewOrganization returns a new instance of Organization.

func (*Organization) ColumnAddress added in v0.8.0

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

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

func (*Organization) GetID added in v0.8.0

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

GetID returns the primary key of the model.

func (*Organization) NewRelationshipRecord added in v0.8.0

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

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

func (*Organization) SetRelationship added in v0.8.0

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

SetRelationship sets the given relationship in the given field.

func (*Organization) Value added in v0.8.0

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

Value returns the value of the given column.

type OrganizationQuery added in v0.8.0

type OrganizationQuery struct {
	*kallax.BaseQuery
}

OrganizationQuery is the object used to create queries for the Organization entity.

func NewOrganizationQuery added in v0.8.0

func NewOrganizationQuery() *OrganizationQuery

NewOrganizationQuery returns a new instance of OrganizationQuery.

func (*OrganizationQuery) BatchSize added in v0.8.0

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

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

func (*OrganizationQuery) Copy added in v0.8.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 (*OrganizationQuery) FindByConfig added in v0.8.0

func (q *OrganizationQuery) FindByConfig(v string) *OrganizationQuery

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

func (*OrganizationQuery) FindByID added in v0.8.0

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

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 (*OrganizationQuery) FindByInternalID added in v0.8.0

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

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

func (*OrganizationQuery) FindByProvider added in v0.8.0

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

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

func (*OrganizationQuery) Limit added in v0.8.0

Limit sets the max number of items to retrieve.

func (*OrganizationQuery) Offset added in v0.8.0

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

func (*OrganizationQuery) Order added in v0.8.0

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

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

func (*OrganizationQuery) Select added in v0.8.0

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

Select adds columns to select in the query.

func (*OrganizationQuery) SelectNot added in v0.8.0

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

SelectNot excludes columns from being selected in the query.

func (*OrganizationQuery) Where added in v0.8.0

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

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

type OrganizationResultSet added in v0.8.0

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

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

func NewOrganizationResultSet added in v0.8.0

func NewOrganizationResultSet(rs kallax.ResultSet) *OrganizationResultSet

NewOrganizationResultSet creates a new result set for rows of the type Organization.

func (*OrganizationResultSet) All added in v0.8.0

func (rs *OrganizationResultSet) All() ([]*Organization, error)

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

func (*OrganizationResultSet) Close added in v0.8.0

func (rs *OrganizationResultSet) Close() error

Close closes the result set.

func (*OrganizationResultSet) Err added in v0.8.0

func (rs *OrganizationResultSet) Err() error

Err returns the last error occurred.

func (*OrganizationResultSet) ForEach added in v0.8.0

func (rs *OrganizationResultSet) ForEach(fn func(*Organization) 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 (*OrganizationResultSet) Get added in v0.8.0

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

func (*OrganizationResultSet) Next added in v0.8.0

func (rs *OrganizationResultSet) 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 (*OrganizationResultSet) One added in v0.8.0

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

type OrganizationStore added in v0.8.0

type OrganizationStore struct {
	*kallax.Store
}

OrganizationStore is the entity to access the records of the type Organization in the database.

func NewOrganizationStore added in v0.8.0

func NewOrganizationStore(db *sql.DB) *OrganizationStore

NewOrganizationStore creates a new instance of OrganizationStore using a SQL database.

func (*OrganizationStore) Count added in v0.8.0

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

func (*OrganizationStore) Debug added in v0.8.0

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

func (*OrganizationStore) DebugWith added in v0.8.0

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

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

func (*OrganizationStore) Delete added in v0.8.0

func (s *OrganizationStore) Delete(record *Organization) error

Delete removes the given record from the database.

func (*OrganizationStore) DisableCacher added in v0.8.0

func (s *OrganizationStore) DisableCacher() *OrganizationStore

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

func (*OrganizationStore) Find added in v0.8.0

Find returns the set of results for the given query.

func (*OrganizationStore) FindAll added in v0.8.0

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

func (*OrganizationStore) FindOne added in v0.8.0

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

func (*OrganizationStore) GenericStore added in v0.8.0

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

GenericStore returns the generic store of this store.

func (*OrganizationStore) Insert added in v0.8.0

func (s *OrganizationStore) Insert(record *Organization) error

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

func (*OrganizationStore) MustCount added in v0.8.0

func (s *OrganizationStore) MustCount(q *OrganizationQuery) int64

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

func (*OrganizationStore) MustFind added in v0.8.0

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

func (*OrganizationStore) MustFindOne added in v0.8.0

func (s *OrganizationStore) MustFindOne(q *OrganizationQuery) *Organization

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

func (*OrganizationStore) Reload added in v0.8.0

func (s *OrganizationStore) Reload(record *Organization) error

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

func (*OrganizationStore) Save added in v0.8.0

func (s *OrganizationStore) Save(record *Organization) (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 (*OrganizationStore) SetGenericStore added in v0.8.0

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

SetGenericStore changes the generic store of this store.

func (*OrganizationStore) Transaction added in v0.8.0

func (s *OrganizationStore) Transaction(callback func(*OrganizationStore) 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 (*OrganizationStore) Update added in v0.8.0

func (s *OrganizationStore) Update(record *Organization, 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 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 *lookout.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) FindByOrganizationID added in v0.8.0

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

FindByOrganizationID adds a new filter to the query that will require that the OrganizationID 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
	InternalID   string

	// those fields can change with each push
	IsMergeable   bool
	Source        lookout.ReferencePointer
	Configuration types.Struct
	Base          lookout.ReferencePointer
	Head          lookout.ReferencePointer
	CreatedAt     time.Time
	UpdatedAt     time.Time

	// static part of review
	ReviewTarget *ReviewTarget `fk:",inverse"`
}

ReviewEvent is a persisted model for review event

func NewReviewEvent

func NewReviewEvent(e *lookout.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) FindByReviewTarget added in v0.1.5

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

FindByReviewTarget adds a new filter to the query that will require that the foreign key of ReviewTarget 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.

func (*ReviewEventQuery) WithReviewTarget added in v0.1.5

func (q *ReviewEventQuery) WithReviewTarget() *ReviewEventQuery

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.

type ReviewTarget added in v0.1.5

type ReviewTarget struct {
	kallax.Model `pk:"id"`
	ID           kallax.ULID
	kallax.Timestamps

	Provider     string
	InternalID   string
	RepositoryID uint32
	Number       uint32
}

ReviewTarget is a persisted model for a pull request

func NewReviewTarget added in v0.1.5

func NewReviewTarget(e *lookout.ReviewEvent) (record *ReviewTarget)

NewReviewTarget returns a new instance of ReviewTarget.

func (*ReviewTarget) ColumnAddress added in v0.1.5

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

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

func (*ReviewTarget) GetID added in v0.1.5

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

GetID returns the primary key of the model.

func (*ReviewTarget) NewRelationshipRecord added in v0.1.5

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

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

func (*ReviewTarget) SetRelationship added in v0.1.5

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

SetRelationship sets the given relationship in the given field.

func (*ReviewTarget) Value added in v0.1.5

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

Value returns the value of the given column.

type ReviewTargetQuery added in v0.1.5

type ReviewTargetQuery struct {
	*kallax.BaseQuery
}

ReviewTargetQuery is the object used to create queries for the ReviewTarget entity.

func NewReviewTargetQuery added in v0.1.5

func NewReviewTargetQuery() *ReviewTargetQuery

NewReviewTargetQuery returns a new instance of ReviewTargetQuery.

func (*ReviewTargetQuery) BatchSize added in v0.1.5

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

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

func (*ReviewTargetQuery) Copy added in v0.1.5

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 (*ReviewTargetQuery) FindByCreatedAt added in v0.1.5

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

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

func (*ReviewTargetQuery) FindByID added in v0.1.5

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

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 (*ReviewTargetQuery) FindByInternalID added in v0.1.5

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

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

func (*ReviewTargetQuery) FindByNumber added in v0.1.5

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

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

func (*ReviewTargetQuery) FindByProvider added in v0.1.5

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

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

func (*ReviewTargetQuery) FindByRepositoryID added in v0.1.5

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

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

func (*ReviewTargetQuery) FindByUpdatedAt added in v0.1.5

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

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

func (*ReviewTargetQuery) Limit added in v0.1.5

Limit sets the max number of items to retrieve.

func (*ReviewTargetQuery) Offset added in v0.1.5

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

func (*ReviewTargetQuery) Order added in v0.1.5

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

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

func (*ReviewTargetQuery) Select added in v0.1.5

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

Select adds columns to select in the query.

func (*ReviewTargetQuery) SelectNot added in v0.1.5

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

SelectNot excludes columns from being selected in the query.

func (*ReviewTargetQuery) Where added in v0.1.5

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

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

type ReviewTargetResultSet added in v0.1.5

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

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

func NewReviewTargetResultSet added in v0.1.5

func NewReviewTargetResultSet(rs kallax.ResultSet) *ReviewTargetResultSet

NewReviewTargetResultSet creates a new result set for rows of the type ReviewTarget.

func (*ReviewTargetResultSet) All added in v0.1.5

func (rs *ReviewTargetResultSet) All() ([]*ReviewTarget, error)

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

func (*ReviewTargetResultSet) Close added in v0.1.5

func (rs *ReviewTargetResultSet) Close() error

Close closes the result set.

func (*ReviewTargetResultSet) Err added in v0.1.5

func (rs *ReviewTargetResultSet) Err() error

Err returns the last error occurred.

func (*ReviewTargetResultSet) ForEach added in v0.1.5

func (rs *ReviewTargetResultSet) ForEach(fn func(*ReviewTarget) 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 (*ReviewTargetResultSet) Get added in v0.1.5

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

func (*ReviewTargetResultSet) Next added in v0.1.5

func (rs *ReviewTargetResultSet) 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 (*ReviewTargetResultSet) One added in v0.1.5

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

type ReviewTargetStore added in v0.1.5

type ReviewTargetStore struct {
	*kallax.Store
}

ReviewTargetStore is the entity to access the records of the type ReviewTarget in the database.

func NewReviewTargetStore added in v0.1.5

func NewReviewTargetStore(db *sql.DB) *ReviewTargetStore

NewReviewTargetStore creates a new instance of ReviewTargetStore using a SQL database.

func (*ReviewTargetStore) Count added in v0.1.5

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

func (*ReviewTargetStore) Debug added in v0.1.5

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

func (*ReviewTargetStore) DebugWith added in v0.1.5

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

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

func (*ReviewTargetStore) Delete added in v0.1.5

func (s *ReviewTargetStore) Delete(record *ReviewTarget) error

Delete removes the given record from the database.

func (*ReviewTargetStore) DisableCacher added in v0.1.5

func (s *ReviewTargetStore) DisableCacher() *ReviewTargetStore

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

func (*ReviewTargetStore) Find added in v0.1.5

Find returns the set of results for the given query.

func (*ReviewTargetStore) FindAll added in v0.1.5

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

func (*ReviewTargetStore) FindOne added in v0.1.5

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

func (*ReviewTargetStore) GenericStore added in v0.1.5

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

GenericStore returns the generic store of this store.

func (*ReviewTargetStore) Insert added in v0.1.5

func (s *ReviewTargetStore) Insert(record *ReviewTarget) error

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

func (*ReviewTargetStore) MustCount added in v0.1.5

func (s *ReviewTargetStore) MustCount(q *ReviewTargetQuery) int64

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

func (*ReviewTargetStore) MustFind added in v0.1.5

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

func (*ReviewTargetStore) MustFindOne added in v0.1.5

func (s *ReviewTargetStore) MustFindOne(q *ReviewTargetQuery) *ReviewTarget

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

func (*ReviewTargetStore) Reload added in v0.1.5

func (s *ReviewTargetStore) Reload(record *ReviewTarget) error

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

func (*ReviewTargetStore) Save added in v0.1.5

func (s *ReviewTargetStore) Save(record *ReviewTarget) (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 (*ReviewTargetStore) SetGenericStore added in v0.1.5

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

SetGenericStore changes the generic store of this store.

func (*ReviewTargetStore) Transaction added in v0.1.5

func (s *ReviewTargetStore) Transaction(callback func(*ReviewTargetStore) 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 (*ReviewTargetStore) Update added in v0.1.5

func (s *ReviewTargetStore) Update(record *ReviewTarget, 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