Documentation ¶
Overview ¶
IMPORTANT! This is auto generated code by https://github.com/src-d/go-kallax Please, do not touch the code below, and if you do, do it under your own risk. Take into account that all the code you write here will be completely erased from earth the next time you generate the kallax models.
Index ¶
- Variables
- type Owner
- type Repository
- func (r *Repository) ColumnAddress(col string) (interface{}, error)
- func (r *Repository) GetID() kallax.Identifier
- func (r *Repository) NewRelationshipRecord(field string) (kallax.Record, error)
- func (r *Repository) SetRelationship(field string, rel interface{}) error
- func (r *Repository) Value(col string) (interface{}, error)
- type RepositoryQuery
- func (q *RepositoryQuery) BatchSize(size uint64) *RepositoryQuery
- func (q *RepositoryQuery) Copy() *RepositoryQuery
- func (q *RepositoryQuery) FindByCreatedAt(cond kallax.ScalarCond, v time.Time) *RepositoryQuery
- func (q *RepositoryQuery) FindByDescription(v string) *RepositoryQuery
- func (q *RepositoryQuery) FindByFork(v bool) *RepositoryQuery
- func (q *RepositoryQuery) FindByFullName(v string) *RepositoryQuery
- func (q *RepositoryQuery) FindByGithubID(cond kallax.ScalarCond, v int) *RepositoryQuery
- func (q *RepositoryQuery) FindByHTMLURL(v string) *RepositoryQuery
- func (q *RepositoryQuery) FindByID(v ...kallax.ULID) *RepositoryQuery
- func (q *RepositoryQuery) FindByName(v string) *RepositoryQuery
- func (q *RepositoryQuery) FindByPrivate(v bool) *RepositoryQuery
- func (q *RepositoryQuery) FindByUpdatedAt(cond kallax.ScalarCond, v time.Time) *RepositoryQuery
- func (q *RepositoryQuery) Limit(n uint64) *RepositoryQuery
- func (q *RepositoryQuery) Offset(n uint64) *RepositoryQuery
- func (q *RepositoryQuery) Order(cols ...kallax.ColumnOrder) *RepositoryQuery
- func (q *RepositoryQuery) Select(columns ...kallax.SchemaField) *RepositoryQuery
- func (q *RepositoryQuery) SelectNot(columns ...kallax.SchemaField) *RepositoryQuery
- func (q *RepositoryQuery) Where(cond kallax.Condition) *RepositoryQuery
- type RepositoryResultSet
- func (rs *RepositoryResultSet) All() ([]*Repository, error)
- func (rs *RepositoryResultSet) Close() error
- func (rs *RepositoryResultSet) Err() error
- func (rs *RepositoryResultSet) ForEach(fn func(*Repository) error) error
- func (rs *RepositoryResultSet) Get() (*Repository, error)
- func (rs *RepositoryResultSet) Next() bool
- func (rs *RepositoryResultSet) One() (*Repository, error)
- type RepositoryStore
- func (s *RepositoryStore) Count(q *RepositoryQuery) (int64, error)
- func (s *RepositoryStore) Delete(record *Repository) error
- func (s *RepositoryStore) Find(q *RepositoryQuery) (*RepositoryResultSet, error)
- func (s *RepositoryStore) FindOne(q *RepositoryQuery) (*Repository, error)
- func (s *RepositoryStore) Insert(record *Repository) error
- func (s *RepositoryStore) MustCount(q *RepositoryQuery) int64
- func (s *RepositoryStore) MustFind(q *RepositoryQuery) *RepositoryResultSet
- func (s *RepositoryStore) MustFindOne(q *RepositoryQuery) *Repository
- func (s *RepositoryStore) Reload(record *Repository) error
- func (s *RepositoryStore) Save(record *Repository) (updated bool, err error)
- func (s *RepositoryStore) Transaction(callback func(*RepositoryStore) error) error
- func (s *RepositoryStore) Update(record *Repository, cols ...kallax.SchemaField) (updated int64, err error)
Constants ¶
This section is empty.
Variables ¶
var Schema = &schema{ Repository: &schemaRepository{ BaseSchema: kallax.NewBaseSchema( "github", "__repository", kallax.NewSchemaField("id"), kallax.ForeignKeys{}, func() kallax.Record { return new(Repository) }, false, kallax.NewSchemaField("id"), kallax.NewSchemaField("created_at"), kallax.NewSchemaField("updated_at"), kallax.NewSchemaField("github_id"), kallax.NewSchemaField("name"), kallax.NewSchemaField("full_name"), kallax.NewSchemaField("owner"), kallax.NewSchemaField("private"), kallax.NewSchemaField("htmlurl"), kallax.NewSchemaField("description"), kallax.NewSchemaField("fork"), ), ID: kallax.NewSchemaField("id"), CreatedAt: kallax.NewSchemaField("created_at"), UpdatedAt: kallax.NewSchemaField("updated_at"), GithubID: kallax.NewSchemaField("github_id"), Name: kallax.NewSchemaField("name"), FullName: kallax.NewSchemaField("full_name"), Owner: &schemaRepositoryOwner{ BaseSchemaField: kallax.NewSchemaField("owner").(*kallax.BaseSchemaField), Login: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "login"), ID: kallax.NewJSONSchemaKey(kallax.JSONInt, "owner", "id"), AvatarURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "avatar_url"), GravatarID: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "gravatar_id"), URL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "url"), HTMLURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "html_url"), FollowersURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "followers_url"), FollowingURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "following_url"), GistsURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "gists_url"), StarredURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "starred_url"), SubscriptionsURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "subscriptions_url"), OrganizationsURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "organizations_url"), ReposURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "repos_url"), EventsURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "events_url"), ReceivedEventsURL: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "received_events_url"), Type: kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "type"), SiteAdmin: kallax.NewJSONSchemaKey(kallax.JSONBool, "owner", "site_admin"), }, Private: kallax.NewSchemaField("private"), HTMLURL: kallax.NewSchemaField("htmlurl"), Description: kallax.NewSchemaField("description"), Fork: kallax.NewSchemaField("fork"), }, }
Functions ¶
This section is empty.
Types ¶
type Owner ¶
type Owner struct { Login string `json:"login"` ID int `json:"id"` AvatarURL string `json:"avatar_url"` GravatarID string `json:"gravatar_id"` URL string `json:"url"` HTMLURL string `json:"html_url"` FollowersURL string `json:"followers_url"` FollowingURL string `json:"following_url"` GistsURL string `json:"gists_url"` StarredURL string `json:"starred_url"` SubscriptionsURL string `json:"subscriptions_url"` OrganizationsURL string `json:"organizations_url"` ReposURL string `json:"repos_url"` EventsURL string `json:"events_url"` ReceivedEventsURL string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` }
type Repository ¶
type Repository struct { ID kallax.ULID `json:"-" pk:""` kallax.Model `json:"-" table:"github"` kallax.Timestamps `json:"-" kallax:",inline"` GithubID int `json:"id"` Name string `json:"name"` FullName string `json:"full_name"` Owner Owner `json:"owner"` Private bool `json:"private"` HTMLURL string `json:"html_url"` Description string `json:"description"` Fork bool `json:"fork"` // API URLs URL string `json:"url" kallax:"-"` ForksURL string `json:"forks_url" kallax:"-"` KeysURL string `json:"keys_url" kallax:"-"` CollaboratorsURL string `json:"collaborators_url" kallax:"-"` TeamsURL string `json:"teams_url" kallax:"-"` HooksURL string `json:"hooks_url" kallax:"-"` IssueEventsURL string `json:"issue_events_url" kallax:"-"` EventsURL string `json:"events_url" kallax:"-"` AssigneesURL string `json:"assignees_url" kallax:"-"` BranchesURL string `json:"branches_url" kallax:"-"` TagsURL string `json:"tags_url" kallax:"-"` BlobsURL string `json:"blobs_url" kallax:"-"` GitTagsURL string `json:"git_tags_url" kallax:"-"` GitRefsURL string `json:"git_refs_url" kallax:"-"` TreesURL string `json:"trees_url" kallax:"-"` StatusesURL string `json:"statuses_url" kallax:"-"` LanguagesURL string `json:"languages_url" kallax:"-"` StargazersURL string `json:"stargazers_url" kallax:"-"` ContributorsURL string `json:"contributors_url" kallax:"-"` SubscribersURL string `json:"subscribers_url" kallax:"-"` SubscriptionURL string `json:"subscription_url" kallax:"-"` CommitsURL string `json:"commits_url" kallax:"-"` GitCommitsURL string `json:"git_commits_url" kallax:"-"` CommentsURL string `json:"comments_url" kallax:"-"` IssueCommentURL string `json:"issue_comment_url" kallax:"-"` ContentsURL string `json:"contents_url" kallax:"-"` CompareURL string `json:"compare_url" kallax:"-"` MergesURL string `json:"merges_url" kallax:"-"` ArchiveURL string `json:"archive_url" kallax:"-"` DownloadsURL string `json:"downloads_url" kallax:"-"` IssuesURL string `json:"issues_url" kallax:"-"` PullsURL string `json:"pulls_url" kallax:"-"` MilestonesURL string `json:"milestones_url" kallax:"-"` NotificationsURL string `json:"notifications_url" kallax:"-"` LabelsURL string `json:"labels_url" kallax:"-"` ReleasesURL string `json:"releases_url" kallax:"-"` DeploymentsURL string `json:"deployments_url" kallax:"-"` }
func NewRepository ¶
func NewRepository() (record *Repository)
NewRepository returns a new instance of Repository.
func (*Repository) ColumnAddress ¶
func (r *Repository) ColumnAddress(col string) (interface{}, error)
ColumnAddress returns the pointer to the value of the given column.
func (*Repository) GetID ¶
func (r *Repository) GetID() kallax.Identifier
GetID returns the primary key of the model.
func (*Repository) NewRelationshipRecord ¶
func (r *Repository) NewRelationshipRecord(field string) (kallax.Record, error)
NewRelationshipRecord returns a new record for the relatiobship in the given field.
func (*Repository) SetRelationship ¶
func (r *Repository) SetRelationship(field string, rel interface{}) error
SetRelationship sets the given relationship in the given field.
func (*Repository) Value ¶
func (r *Repository) Value(col string) (interface{}, error)
Value returns the value of the given column.
type RepositoryQuery ¶
type RepositoryQuery struct {
*kallax.BaseQuery
}
RepositoryQuery is the object used to create queries for the Repository entity.
func NewRepositoryQuery ¶
func NewRepositoryQuery() *RepositoryQuery
NewRepositoryQuery returns a new instance of RepositoryQuery.
func (*RepositoryQuery) BatchSize ¶
func (q *RepositoryQuery) BatchSize(size uint64) *RepositoryQuery
BatchSize sets the number of items to fetch per batch when there are 1:N relationships selected in the query.
func (*RepositoryQuery) Copy ¶
func (q *RepositoryQuery) Copy() *RepositoryQuery
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 (*RepositoryQuery) FindByCreatedAt ¶
func (q *RepositoryQuery) FindByCreatedAt(cond kallax.ScalarCond, v time.Time) *RepositoryQuery
FindByCreatedAt adds a new filter to the query that will require that the CreatedAt property is equal to the passed value
func (*RepositoryQuery) FindByDescription ¶
func (q *RepositoryQuery) FindByDescription(v string) *RepositoryQuery
FindByDescription adds a new filter to the query that will require that the Description property is equal to the passed value
func (*RepositoryQuery) FindByFork ¶
func (q *RepositoryQuery) FindByFork(v bool) *RepositoryQuery
FindByFork adds a new filter to the query that will require that the Fork property is equal to the passed value
func (*RepositoryQuery) FindByFullName ¶
func (q *RepositoryQuery) FindByFullName(v string) *RepositoryQuery
FindByFullName adds a new filter to the query that will require that the FullName property is equal to the passed value
func (*RepositoryQuery) FindByGithubID ¶
func (q *RepositoryQuery) FindByGithubID(cond kallax.ScalarCond, v int) *RepositoryQuery
FindByGithubID adds a new filter to the query that will require that the GithubID property is equal to the passed value
func (*RepositoryQuery) FindByHTMLURL ¶
func (q *RepositoryQuery) FindByHTMLURL(v string) *RepositoryQuery
FindByHTMLURL adds a new filter to the query that will require that the HTMLURL property is equal to the passed value
func (*RepositoryQuery) FindByID ¶
func (q *RepositoryQuery) FindByID(v ...kallax.ULID) *RepositoryQuery
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 (*RepositoryQuery) FindByName ¶
func (q *RepositoryQuery) FindByName(v string) *RepositoryQuery
FindByName adds a new filter to the query that will require that the Name property is equal to the passed value
func (*RepositoryQuery) FindByPrivate ¶
func (q *RepositoryQuery) FindByPrivate(v bool) *RepositoryQuery
FindByPrivate adds a new filter to the query that will require that the Private property is equal to the passed value
func (*RepositoryQuery) FindByUpdatedAt ¶
func (q *RepositoryQuery) FindByUpdatedAt(cond kallax.ScalarCond, v time.Time) *RepositoryQuery
FindByUpdatedAt adds a new filter to the query that will require that the UpdatedAt property is equal to the passed value
func (*RepositoryQuery) Limit ¶
func (q *RepositoryQuery) Limit(n uint64) *RepositoryQuery
Limit sets the max number of items to retrieve.
func (*RepositoryQuery) Offset ¶
func (q *RepositoryQuery) Offset(n uint64) *RepositoryQuery
Offset sets the number of items to skip from the result set of items.
func (*RepositoryQuery) Order ¶
func (q *RepositoryQuery) Order(cols ...kallax.ColumnOrder) *RepositoryQuery
Order adds order clauses to the query for the given columns.
func (*RepositoryQuery) Select ¶
func (q *RepositoryQuery) Select(columns ...kallax.SchemaField) *RepositoryQuery
Select adds columns to select in the query.
func (*RepositoryQuery) SelectNot ¶
func (q *RepositoryQuery) SelectNot(columns ...kallax.SchemaField) *RepositoryQuery
SelectNot excludes columns from being selected in the query.
func (*RepositoryQuery) Where ¶
func (q *RepositoryQuery) Where(cond kallax.Condition) *RepositoryQuery
Where adds a condition to the query. All conditions added are concatenated using a logical AND.
type RepositoryResultSet ¶
type RepositoryResultSet struct { ResultSet kallax.ResultSet // contains filtered or unexported fields }
RepositoryResultSet is the set of results returned by a query to the database.
func NewRepositoryResultSet ¶
func NewRepositoryResultSet(rs kallax.ResultSet) *RepositoryResultSet
NewRepositoryResultSet creates a new result set for rows of the type Repository.
func (*RepositoryResultSet) All ¶
func (rs *RepositoryResultSet) All() ([]*Repository, error)
All returns all records on the result set and closes the result set.
func (*RepositoryResultSet) Close ¶
func (rs *RepositoryResultSet) Close() error
Close closes the result set.
func (*RepositoryResultSet) Err ¶
func (rs *RepositoryResultSet) Err() error
Err returns the last error occurred.
func (*RepositoryResultSet) ForEach ¶
func (rs *RepositoryResultSet) ForEach(fn func(*Repository) 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 (*RepositoryResultSet) Get ¶
func (rs *RepositoryResultSet) Get() (*Repository, error)
Get retrieves the last fetched item from the result set and the last error.
func (*RepositoryResultSet) Next ¶
func (rs *RepositoryResultSet) 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 (*RepositoryResultSet) One ¶
func (rs *RepositoryResultSet) One() (*Repository, error)
One returns the first record on the result set and closes the result set.
type RepositoryStore ¶
type RepositoryStore struct {
*kallax.Store
}
RepositoryStore is the entity to access the records of the type Repository in the database.
func NewRepositoryStore ¶
func NewRepositoryStore(db *sql.DB) *RepositoryStore
NewRepositoryStore creates a new instance of RepositoryStore using a SQL database.
func (*RepositoryStore) Count ¶
func (s *RepositoryStore) Count(q *RepositoryQuery) (int64, error)
Count returns the number of rows that would be retrieved with the given query.
func (*RepositoryStore) Delete ¶
func (s *RepositoryStore) Delete(record *Repository) error
Delete removes the given record from the database.
func (*RepositoryStore) Find ¶
func (s *RepositoryStore) Find(q *RepositoryQuery) (*RepositoryResultSet, error)
Find returns the set of results for the given query.
func (*RepositoryStore) FindOne ¶
func (s *RepositoryStore) FindOne(q *RepositoryQuery) (*Repository, error)
FindOne returns the first row returned by the given query. `ErrNotFound` is returned if there are no results.
func (*RepositoryStore) Insert ¶
func (s *RepositoryStore) Insert(record *Repository) error
Insert inserts a Repository in the database. A non-persisted object is required for this operation.
func (*RepositoryStore) MustCount ¶
func (s *RepositoryStore) MustCount(q *RepositoryQuery) int64
MustCount returns the number of rows that would be retrieved with the given query, but panics if there is an error.
func (*RepositoryStore) MustFind ¶
func (s *RepositoryStore) MustFind(q *RepositoryQuery) *RepositoryResultSet
MustFind returns the set of results for the given query, but panics if there is any error.
func (*RepositoryStore) MustFindOne ¶
func (s *RepositoryStore) MustFindOne(q *RepositoryQuery) *Repository
MustFindOne returns the first row retrieved by the given query. It panics if there is an error or if there are no rows.
func (*RepositoryStore) Reload ¶
func (s *RepositoryStore) Reload(record *Repository) error
Reload refreshes the Repository with the data in the database and makes it writable.
func (*RepositoryStore) Save ¶
func (s *RepositoryStore) Save(record *Repository) (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 (*RepositoryStore) Transaction ¶
func (s *RepositoryStore) Transaction(callback func(*RepositoryStore) 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 (*RepositoryStore) Update ¶
func (s *RepositoryStore) Update(record *Repository, 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.