Documentation ¶
Index ¶
- Constants
- Variables
- func BaseVersionFromPatch(projectId, revision string) db.Q
- func ById(id string) db.Q
- func ByIds(ids []string) db.Q
- func ByLastKnownGoodConfig(projectId string) db.Q
- func ByLastVariantActivation(projectId, variant string) db.Q
- func ByMostRecentForRequester(projectId, requester string) db.Q
- func ByMostRecentNonignored(projectId string) db.Q
- func ByProjectId(projectId string) db.Q
- func ByProjectIdAndOrder(projectId string, revisionOrderNumber int) db.Q
- func ByProjectIdAndRevision(projectId, revision string) db.Q
- func ByProjectIdAndRevisionPrefix(projectId, revisionPrefix string) db.Q
- func Count(query db.Q) (int, error)
- func UpdateOne(query interface{}, update interface{}) error
- type BuildStatus
- type Version
Constants ¶
const (
Collection = "versions"
)
Variables ¶
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") )
var ( BuildStatusVariantKey = bsonutil.MustHaveTag(BuildStatus{}, "BuildVariant") BuildStatusActivatedKey = bsonutil.MustHaveTag(BuildStatus{}, "Activated") BuildStatusActivateAtKey = bsonutil.MustHaveTag(BuildStatus{}, "ActivateAt") BuildStatusBuildIdKey = bsonutil.MustHaveTag(BuildStatus{}, "BuildId") )
var All = db.Query(bson.D{})
All is a query for all versions.
Functions ¶
func BaseVersionFromPatch ¶
BaseVersionFromPatch finds the base version for a patch version.
func ByIds ¶
ByIds returns a db.Q object which will find any versions whose _id appears in the given list.
func ByLastKnownGoodConfig ¶
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 ¶
ByLastVariantActivation finds the most recent non-patch, non-ignored versions in a project that have a particular variant activated.
func ByMostRecentForRequester ¶
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 ¶
ByMostRecentNonignored finds all non-ignored versions within a project, ordered by most recently created to oldest.
func ByProjectId ¶
ByProjectId finds all non-patch versions within a project.
func ByProjectIdAndOrder ¶
ByProjectIdAndOrder finds non-patch versions for the given project with revision order numbers less than or equal to revisionOrderNumber.
func ByProjectIdAndRevision ¶
ByProjectIdAndRevision finds non-patch versions for the given project and revision.
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"` }