model

package
v2.6.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var Schema = &schema{
	Repository: &schemaRepository{
		BaseSchema: kallax.NewBaseSchema(
			"bitbucket",
			"__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("next"),
			kallax.NewSchemaField("scm"),
			kallax.NewSchemaField("website"),
			kallax.NewSchemaField("name"),
			kallax.NewSchemaField("links"),
			kallax.NewSchemaField("fork_policy"),
			kallax.NewSchemaField("uuid"),
			kallax.NewSchemaField("language"),
			kallax.NewSchemaField("created_on"),
			kallax.NewSchemaField("parent"),
			kallax.NewSchemaField("full_name"),
			kallax.NewSchemaField("has_issues"),
			kallax.NewSchemaField("owner"),
			kallax.NewSchemaField("updated_on"),
			kallax.NewSchemaField("size"),
			kallax.NewSchemaField("type"),
			kallax.NewSchemaField("slug"),
			kallax.NewSchemaField("is_private"),
			kallax.NewSchemaField("description"),
		),
		ID:        kallax.NewSchemaField("id"),
		CreatedAt: kallax.NewSchemaField("created_at"),
		UpdatedAt: kallax.NewSchemaField("updated_at"),
		Next:      kallax.NewSchemaField("next"),
		Scm:       kallax.NewSchemaField("scm"),
		Website:   kallax.NewSchemaField("website"),
		Name:      kallax.NewSchemaField("name"),
		Links: &schemaRepositoryLinks{
			BaseSchemaField: kallax.NewSchemaField("links").(*kallax.BaseSchemaField),
			Clone: &schemaRepositoryLinksClone{
				JSONSchemaArray: kallax.NewJSONSchemaArray("links", "clone"),
				Href:            kallax.NewJSONSchemaKey(kallax.JSONText, "links", "clone", "href"),
				Name:            kallax.NewJSONSchemaKey(kallax.JSONText, "links", "clone", "name"),
			},
		},
		ForkPolicy: kallax.NewSchemaField("fork_policy"),
		UUID:       kallax.NewSchemaField("uuid"),
		Language:   kallax.NewSchemaField("language"),
		CreatedOn:  kallax.NewSchemaField("created_on"),
		Parent: &schemaRepositoryParent{
			BaseSchemaField: kallax.NewSchemaField("parent").(*kallax.BaseSchemaField),
			Type:            kallax.NewJSONSchemaKey(kallax.JSONText, "parent", "type"),
			Name:            kallax.NewJSONSchemaKey(kallax.JSONText, "parent", "name"),
			FullName:        kallax.NewJSONSchemaKey(kallax.JSONText, "parent", "full_name"),
			UUID:            kallax.NewJSONSchemaKey(kallax.JSONText, "parent", "uuid"),
		},
		FullName:  kallax.NewSchemaField("full_name"),
		HasIssues: kallax.NewSchemaField("has_issues"),
		Owner: &schemaRepositoryOwner{
			BaseSchemaField: kallax.NewSchemaField("owner").(*kallax.BaseSchemaField),
			Username:        kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "username"),
			DisplayName:     kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "display_name"),
			Type:            kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "type"),
			UUID:            kallax.NewJSONSchemaKey(kallax.JSONText, "owner", "uuid"),
		},
		UpdatedOn:   kallax.NewSchemaField("updated_on"),
		Size:        kallax.NewSchemaField("size"),
		Type:        kallax.NewSchemaField("type"),
		Slug:        kallax.NewSchemaField("slug"),
		IsPrivate:   kallax.NewSchemaField("is_private"),
		Description: kallax.NewSchemaField("description"),
	},
}

Functions

This section is empty.

Types

type Parent

type Parent struct {
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
	} `json:"links" kallax:"-"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	UUID     string `json:"uuid"`
}

type Repositories

type Repositories []*Repository

type Repository

type Repository struct {
	ID                kallax.ULID `pk:""`
	kallax.Model      `table:"bitbucket"`
	kallax.Timestamps `kallax:",inline"`

	Next    string
	Scm     string `json:"scm"`
	Website string `json:"website"`
	HasWiki bool   `json:"has_wiki" kallax:"-"`
	Name    string `json:"name"`
	Links   struct {
		Watchers struct {
			Href string `json:"href" kallax:"-"`
		} `json:"watchers" kallax:"-"`
		Branches struct {
			Href string `json:"href" kallax:"-"`
		} `json:"branches" kallax:"-"`
		Tags struct {
			Href string `json:"href" kallax:"-"`
		} `json:"tags" kallax:"-"`
		Commits struct {
			Href string `json:"href" kallax:"-"`
		} `json:"commits" kallax:"-"`
		Clone []struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"clone"`
		Self struct {
			Href string `json:"href" kallax:"-"`
		} `json:"self" kallax:"-"`
		HTML struct {
			Href string `json:"href" kallax:"-"`
		} `json:"html" kallax:"-"`
		Avatar struct {
			Href string `json:"href" kallax:"-"`
		} `json:"avatar" kallax:"-"`
		Hooks struct {
			Href string `json:"href" kallax:"-"`
		} `json:"hooks" kallax:"-"`
		Forks struct {
			Href string `json:"href" kallax:"-"`
		} `json:"forks" kallax:"-"`
		Downloads struct {
			Href string `json:"href" kallax:"-"`
		} `json:"downloads" kallax:"-"`
		Pullrequests struct {
			Href string `json:"href" kallax:"-"`
		} `json:"pullrequests" kallax:"-"`
	} `json:"links"`
	ForkPolicy string  `json:"fork_policy"`
	UUID       string  `json:"uuid"`
	Language   string  `json:"language"`
	CreatedOn  string  `json:"created_on"`
	Parent     *Parent `json:"parent"`
	FullName   string  `json:"full_name"`
	HasIssues  bool    `json:"has_issues"`
	Owner      struct {
		Username    string `json:"username"`
		DisplayName string `json:"display_name"`
		Type        string `json:"type"`
		UUID        string `json:"uuid"`
		Links       struct {
			Self struct {
				Href string `json:"href" kallax:"-"`
			} `json:"self"  kallax:"-"`
			HTML struct {
				Href string `json:"href"  kallax:"-"`
			} `json:"html"  kallax:"-"`
			Avatar struct {
				Href string `json:"href"  kallax:"-"`
			} `json:"avatar"  kallax:"-"`
		} `json:"links"  kallax:"-"`
	} `json:"owner"`
	UpdatedOn   string `json:"updated_on"`
	Size        int    `json:"size"`
	Type        string `json:"type"`
	Slug        string `json:"slug"`
	IsPrivate   bool   `json:"is_private"`
	Description string `json:"description"`
}

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) FindByCreatedOn

func (q *RepositoryQuery) FindByCreatedOn(v string) *RepositoryQuery

FindByCreatedOn adds a new filter to the query that will require that the CreatedOn 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) FindByForkPolicy

func (q *RepositoryQuery) FindByForkPolicy(v string) *RepositoryQuery

FindByForkPolicy adds a new filter to the query that will require that the ForkPolicy 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) FindByHasIssues

func (q *RepositoryQuery) FindByHasIssues(v bool) *RepositoryQuery

FindByHasIssues adds a new filter to the query that will require that the HasIssues 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) FindByIsPrivate

func (q *RepositoryQuery) FindByIsPrivate(v bool) *RepositoryQuery

FindByIsPrivate adds a new filter to the query that will require that the IsPrivate property is equal to the passed value

func (*RepositoryQuery) FindByLanguage

func (q *RepositoryQuery) FindByLanguage(v string) *RepositoryQuery

FindByLanguage adds a new filter to the query that will require that the Language property is equal to the passed value

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) FindByNext

func (q *RepositoryQuery) FindByNext(v string) *RepositoryQuery

FindByNext adds a new filter to the query that will require that the Next property is equal to the passed value

func (*RepositoryQuery) FindByScm

func (q *RepositoryQuery) FindByScm(v string) *RepositoryQuery

FindByScm adds a new filter to the query that will require that the Scm property is equal to the passed value

func (*RepositoryQuery) FindBySize

func (q *RepositoryQuery) FindBySize(cond kallax.ScalarCond, v int) *RepositoryQuery

FindBySize adds a new filter to the query that will require that the Size property is equal to the passed value

func (*RepositoryQuery) FindBySlug

func (q *RepositoryQuery) FindBySlug(v string) *RepositoryQuery

FindBySlug adds a new filter to the query that will require that the Slug property is equal to the passed value

func (*RepositoryQuery) FindByType

func (q *RepositoryQuery) FindByType(v string) *RepositoryQuery

FindByType adds a new filter to the query that will require that the Type property is equal to the passed value

func (*RepositoryQuery) FindByUUID

func (q *RepositoryQuery) FindByUUID(v string) *RepositoryQuery

FindByUUID adds a new filter to the query that will require that the UUID 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) FindByUpdatedOn

func (q *RepositoryQuery) FindByUpdatedOn(v string) *RepositoryQuery

FindByUpdatedOn adds a new filter to the query that will require that the UpdatedOn property is equal to the passed value

func (*RepositoryQuery) FindByWebsite

func (q *RepositoryQuery) FindByWebsite(v string) *RepositoryQuery

FindByWebsite adds a new filter to the query that will require that the Website 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

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

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.

Jump to

Keyboard shortcuts

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