version

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Collection = "versions"
)

Variables

View Source
var (
	// bson fields for the version struct
	IdKey                  = bsonutil.MustHaveTag(Version{}, "Id")
	CreateTimeKey          = bsonutil.MustHaveTag(Version{}, "CreateTime")
	StartTimeKey           = bsonutil.MustHaveTag(Version{}, "StartTime")
	FinishTimeKey          = bsonutil.MustHaveTag(Version{}, "FinishTime")
	RevisionKey            = bsonutil.MustHaveTag(Version{}, "Revision")
	AuthorKey              = bsonutil.MustHaveTag(Version{}, "Author")
	AuthorEmailKey         = bsonutil.MustHaveTag(Version{}, "AuthorEmail")
	MessageKey             = bsonutil.MustHaveTag(Version{}, "Message")
	StatusKey              = bsonutil.MustHaveTag(Version{}, "Status")
	BuildIdsKey            = bsonutil.MustHaveTag(Version{}, "BuildIds")
	BuildVariantsKey       = bsonutil.MustHaveTag(Version{}, "BuildVariants")
	RevisionOrderNumberKey = bsonutil.MustHaveTag(Version{}, "RevisionOrderNumber")
	RequesterKey           = bsonutil.MustHaveTag(Version{}, "Requester")
	ConfigKey              = bsonutil.MustHaveTag(Version{}, "Config")
	IgnoredKey             = bsonutil.MustHaveTag(Version{}, "Ignored")
	OwnerNameKey           = bsonutil.MustHaveTag(Version{}, "Owner")
	RepoKey                = bsonutil.MustHaveTag(Version{}, "Repo")
	ProjectNameKey         = bsonutil.MustHaveTag(Version{}, "Branch")
	RepoKindKey            = bsonutil.MustHaveTag(Version{}, "RepoKind")
	ErrorsKey              = bsonutil.MustHaveTag(Version{}, "Errors")
	WarningsKey            = bsonutil.MustHaveTag(Version{}, "Warnings")
	IdentifierKey          = bsonutil.MustHaveTag(Version{}, "Identifier")
	RemoteKey              = bsonutil.MustHaveTag(Version{}, "Remote")
	RemoteURLKey           = bsonutil.MustHaveTag(Version{}, "RemotePath")
)
View Source
var (
	BuildStatusVariantKey    = bsonutil.MustHaveTag(BuildStatus{}, "BuildVariant")
	BuildStatusActivatedKey  = bsonutil.MustHaveTag(BuildStatus{}, "Activated")
	BuildStatusActivateAtKey = bsonutil.MustHaveTag(BuildStatus{}, "ActivateAt")
	BuildStatusBuildIdKey    = bsonutil.MustHaveTag(BuildStatus{}, "BuildId")
)
View Source
var All = db.Query(bson.D{})

All is a query for all versions.

Functions

func BaseVersionFromPatch

func BaseVersionFromPatch(projectId, revision string) db.Q

BaseVersionFromPatch finds the base version for a patch version.

func ById

func ById(id string) db.Q

ById returns a db.Q object which will filter on {_id : <the id param>}

func ByIds

func ByIds(ids []string) db.Q

ByIds returns a db.Q object which will find any versions whose _id appears in the given list.

func ByLastKnownGoodConfig

func ByLastKnownGoodConfig(projectId string) db.Q

ByLastKnownGoodConfig filters on versions with valid (i.e., have no errors) config for the given project. Does not apply a limit, so should generally be used with a FindOne.

func ByLastVariantActivation

func ByLastVariantActivation(projectId, variant string) db.Q

ByLastVariantActivation finds the most recent non-patch, non-ignored versions in a project that have a particular variant activated.

func ByMostRecentForRequester

func ByMostRecentForRequester(projectId, requester string) db.Q

ByProjectId finds all versions within a project, ordered by most recently created to oldest. The requester controls if it should search patch or non-patch versions.

func ByMostRecentNonignored

func ByMostRecentNonignored(projectId string) db.Q

ByMostRecentNonignored finds all non-ignored versions within a project, ordered by most recently created to oldest.

func ByProjectId

func ByProjectId(projectId string) db.Q

ByProjectId finds all non-patch versions within a project.

func ByProjectIdAndOrder

func ByProjectIdAndOrder(projectId string, revisionOrderNumber int) db.Q

ByProjectIdAndOrder finds non-patch versions for the given project with revision order numbers less than or equal to revisionOrderNumber.

func ByProjectIdAndRevision

func ByProjectIdAndRevision(projectId, revision string) db.Q

ByProjectIdAndRevision finds non-patch versions for the given project and revision.

func ByProjectIdAndRevisionPrefix

func ByProjectIdAndRevisionPrefix(projectId, revisionPrefix string) db.Q

func Count

func Count(query db.Q) (int, error)

Count returns the number of hosts that satisfy the given query.

func UpdateOne

func UpdateOne(query interface{}, update interface{}) error

UpdateOne updates one version.

Types

type BuildStatus

type BuildStatus struct {
	BuildVariant string    `bson:"build_variant" json:"id"`
	Activated    bool      `bson:"activated" json:"activated"`
	ActivateAt   time.Time `bson:"activate_at,omitempty" json:"activate_at,omitempty"`
	BuildId      string    `bson:"build_id,omitempty" json:"build_id,omitempty"`
}

BuildStatus stores metadata relating to each build

type Version

type Version struct {
	Id                  string        `bson:"_id" json:"id,omitempty"`
	CreateTime          time.Time     `bson:"create_time" json:"create_time,omitempty"`
	StartTime           time.Time     `bson:"start_time" json:"start_time,omitempty"`
	FinishTime          time.Time     `bson:"finish_time" json:"finish_time,omitempty"`
	Revision            string        `bson:"gitspec" json:"revision,omitempty"`
	Author              string        `bson:"author" json:"author,omitempty"`
	AuthorEmail         string        `bson:"author_email" json:"author_email,omitempty"`
	Message             string        `bson:"message" json:"message,omitempty"`
	Status              string        `bson:"status" json:"status,omitempty"`
	RevisionOrderNumber int           `bson:"order,omitempty" json:"order,omitempty"`
	Config              string        `bson:"config" json:"config,omitempty"`
	Ignored             bool          `bson:"ignored" json:"ignored"`
	Owner               string        `bson:"owner_name" json:"owner_name,omitempty"`
	Repo                string        `bson:"repo_name" json:"repo_name,omitempty"`
	Branch              string        `bson:"branch_name" json:"branch_name, omitempty"`
	RepoKind            string        `bson:"repo_kind" json:"repo_kind,omitempty"`
	BuildVariants       []BuildStatus `bson:"build_variants_status,omitempty" json:"build_variants_status,omitempty"`

	// This is technically redundant, but a lot of code relies on it, so I'm going to leave it
	BuildIds []string `bson:"builds" json:"builds,omitempty"`

	Identifier string `bson:"identifier" json:"identifier,omitempty"`
	Remote     bool   `bson:"remote" json:"remote,omitempty"`
	RemotePath string `bson:"remote_path" json:"remote_path,omitempty"`
	// version requester - this is used to help tell the
	// reason this version was created. e.g. it could be
	// because the repotracker requested it (via tracking the
	// repository) or it was triggered by a developer
	// patch request
	Requester string `bson:"r" json:"requester,omitempty"`
	// version errors - this is used to keep track of any errors that were
	// encountered in the process of creating a version. If there are no errors
	// this field is omitted in the database
	Errors   []string `bson:"errors,omitempty" json:"errors,omitempty"`
	Warnings []string `bson:"warnings,omitempty" json:"warnings,omitempty"`
}

func Find

func Find(query db.Q) ([]Version, error)

func FindOne

func FindOne(query db.Q) (*Version, error)

func (*Version) Insert

func (self *Version) Insert() error

func (*Version) UpdateBuildVariants

func (self *Version) UpdateBuildVariants() error

Jump to

Keyboard shortcuts

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