id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
135,300 | fabric8-services/fabric8-wit | criteria/binary_expression.go | reparent | func reparent(parent BinaryExpression) Expression {
parent.Left().setParent(parent)
parent.Right().setParent(parent)
return parent
} | go | func reparent(parent BinaryExpression) Expression {
parent.Left().setParent(parent)
parent.Right().setParent(parent)
return parent
} | [
"func",
"reparent",
"(",
"parent",
"BinaryExpression",
")",
"Expression",
"{",
"parent",
".",
"Left",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
"\n",
"parent",
".",
"Right",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
"\n",
"return",
"parent",
... | // make sure the children have the correct parent | [
"make",
"sure",
"the",
"children",
"have",
"the",
"correct",
"parent"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/criteria/binary_expression.go#L31-L35 |
135,301 | fabric8-services/fabric8-wit | controller/work_item_link_types.go | NewWorkItemLinkTypesController | func NewWorkItemLinkTypesController(service *goa.Service, db application.DB, config WorkItemLinkTypesControllerConfiguration) *WorkItemLinkTypesController {
return &WorkItemLinkTypesController{
Controller: service.NewController("WorkItemLinkTypesController"),
db: db,
config: config,
}
} | go | func NewWorkItemLinkTypesController(service *goa.Service, db application.DB, config WorkItemLinkTypesControllerConfiguration) *WorkItemLinkTypesController {
return &WorkItemLinkTypesController{
Controller: service.NewController("WorkItemLinkTypesController"),
db: db,
config: config,
}
} | [
"func",
"NewWorkItemLinkTypesController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"WorkItemLinkTypesControllerConfiguration",
")",
"*",
"WorkItemLinkTypesController",
"{",
"return",
"&",
"WorkItemLinkTypesController"... | // NewWorkItemLinkTypesController creates a work-item-link-type controller. | [
"NewWorkItemLinkTypesController",
"creates",
"a",
"work",
"-",
"item",
"-",
"link",
"-",
"type",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link_types.go#L29-L35 |
135,302 | fabric8-services/fabric8-wit | remoteworkitem/trackerquery_repository.go | NewTrackerQueryRepository | func NewTrackerQueryRepository(db *gorm.DB) *GormTrackerQueryRepository {
return &GormTrackerQueryRepository{
db: db,
witr: workitem.NewWorkItemTypeRepository(db),
wir: workitem.NewWorkItemRepository(db),
}
} | go | func NewTrackerQueryRepository(db *gorm.DB) *GormTrackerQueryRepository {
return &GormTrackerQueryRepository{
db: db,
witr: workitem.NewWorkItemTypeRepository(db),
wir: workitem.NewWorkItemRepository(db),
}
} | [
"func",
"NewTrackerQueryRepository",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"GormTrackerQueryRepository",
"{",
"return",
"&",
"GormTrackerQueryRepository",
"{",
"db",
":",
"db",
",",
"witr",
":",
"workitem",
".",
"NewWorkItemTypeRepository",
"(",
"db",
")"... | // NewTrackerQueryRepository constructs a TrackerQueryRepository | [
"NewTrackerQueryRepository",
"constructs",
"a",
"TrackerQueryRepository"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackerquery_repository.go#L32-L38 |
135,303 | fabric8-services/fabric8-wit | remoteworkitem/trackerquery_repository.go | Create | func (r *GormTrackerQueryRepository) Create(ctx context.Context, tq TrackerQuery) (*TrackerQuery, error) {
wiType, err := r.witr.Load(ctx, tq.WorkItemTypeID)
if err != nil {
return nil, errors.NewBadParameterError("WorkItemTypeID", tq.WorkItemTypeID)
}
allowedWIT, err := r.wir.CheckTypeAndSpaceShareTemplate(ctx,... | go | func (r *GormTrackerQueryRepository) Create(ctx context.Context, tq TrackerQuery) (*TrackerQuery, error) {
wiType, err := r.witr.Load(ctx, tq.WorkItemTypeID)
if err != nil {
return nil, errors.NewBadParameterError("WorkItemTypeID", tq.WorkItemTypeID)
}
allowedWIT, err := r.wir.CheckTypeAndSpaceShareTemplate(ctx,... | [
"func",
"(",
"r",
"*",
"GormTrackerQueryRepository",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"tq",
"TrackerQuery",
")",
"(",
"*",
"TrackerQuery",
",",
"error",
")",
"{",
"wiType",
",",
"err",
":=",
"r",
".",
"witr",
".",
"Load",
"(",... | // Create creates a new tracker query in the repository
// returns BadParameterError, ConversionError or InternalError | [
"Create",
"creates",
"a",
"new",
"tracker",
"query",
"in",
"the",
"repository",
"returns",
"BadParameterError",
"ConversionError",
"or",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackerquery_repository.go#L62-L81 |
135,304 | fabric8-services/fabric8-wit | remoteworkitem/trackerquery_repository.go | Load | func (r *GormTrackerQueryRepository) Load(ctx context.Context, ID uuid.UUID) (*TrackerQuery, error) {
defer goa.MeasureSince([]string{"goa", "db", "trackerquery", "load"}, time.Now())
res := TrackerQuery{}
tx := r.db.Where("id = ?", ID).Find(&res)
if tx.RecordNotFound() {
log.Error(ctx, map[string]interface{}{
... | go | func (r *GormTrackerQueryRepository) Load(ctx context.Context, ID uuid.UUID) (*TrackerQuery, error) {
defer goa.MeasureSince([]string{"goa", "db", "trackerquery", "load"}, time.Now())
res := TrackerQuery{}
tx := r.db.Where("id = ?", ID).Find(&res)
if tx.RecordNotFound() {
log.Error(ctx, map[string]interface{}{
... | [
"func",
"(",
"r",
"*",
"GormTrackerQueryRepository",
")",
"Load",
"(",
"ctx",
"context",
".",
"Context",
",",
"ID",
"uuid",
".",
"UUID",
")",
"(",
"*",
"TrackerQuery",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string"... | // Load returns the tracker query for the given id
// returns NotFoundError, ConversionError or InternalError | [
"Load",
"returns",
"the",
"tracker",
"query",
"for",
"the",
"given",
"id",
"returns",
"NotFoundError",
"ConversionError",
"or",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackerquery_repository.go#L85-L103 |
135,305 | fabric8-services/fabric8-wit | remoteworkitem/trackerquery_repository.go | List | func (r *GormTrackerQueryRepository) List(ctx context.Context, spaceID uuid.UUID) ([]TrackerQuery, error) {
defer goa.MeasureSince([]string{"goa", "db", "trackerquery", "query"}, time.Now())
var objs []TrackerQuery
err := r.db.Where("space_id = ?", spaceID).Find(&objs).Error
if err != nil && err != gorm.ErrRecordNo... | go | func (r *GormTrackerQueryRepository) List(ctx context.Context, spaceID uuid.UUID) ([]TrackerQuery, error) {
defer goa.MeasureSince([]string{"goa", "db", "trackerquery", "query"}, time.Now())
var objs []TrackerQuery
err := r.db.Where("space_id = ?", spaceID).Find(&objs).Error
if err != nil && err != gorm.ErrRecordNo... | [
"func",
"(",
"r",
"*",
"GormTrackerQueryRepository",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"spaceID",
"uuid",
".",
"UUID",
")",
"(",
"[",
"]",
"TrackerQuery",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]"... | // List returns tracker queries that belong to a space | [
"List",
"returns",
"tracker",
"queries",
"that",
"belong",
"to",
"a",
"space"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackerquery_repository.go#L141-L149 |
135,306 | fabric8-services/fabric8-wit | controller/work_item_link_type.go | NewWorkItemLinkTypeController | func NewWorkItemLinkTypeController(service *goa.Service, db application.DB, config WorkItemLinkTypeControllerConfiguration) *WorkItemLinkTypeController {
return &WorkItemLinkTypeController{
Controller: service.NewController("WorkItemLinkTypeController"),
db: db,
config: config,
}
} | go | func NewWorkItemLinkTypeController(service *goa.Service, db application.DB, config WorkItemLinkTypeControllerConfiguration) *WorkItemLinkTypeController {
return &WorkItemLinkTypeController{
Controller: service.NewController("WorkItemLinkTypeController"),
db: db,
config: config,
}
} | [
"func",
"NewWorkItemLinkTypeController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"WorkItemLinkTypeControllerConfiguration",
")",
"*",
"WorkItemLinkTypeController",
"{",
"return",
"&",
"WorkItemLinkTypeController",
... | // NewWorkItemLinkTypeController creates a work-item-link-type controller. | [
"NewWorkItemLinkTypeController",
"creates",
"a",
"work",
"-",
"item",
"-",
"link",
"-",
"type",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link_type.go#L32-L38 |
135,307 | fabric8-services/fabric8-wit | controller/work_item_link_type.go | ConvertWorkItemLinkTypeFromModel | func ConvertWorkItemLinkTypeFromModel(request *http.Request, modelLinkType link.WorkItemLinkType) app.WorkItemLinkTypeSingle {
spaceTemplateRelatedURL := rest.AbsoluteURL(request, app.SpaceTemplateHref(modelLinkType.SpaceTemplateID.String()))
spaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(space.SystemSpac... | go | func ConvertWorkItemLinkTypeFromModel(request *http.Request, modelLinkType link.WorkItemLinkType) app.WorkItemLinkTypeSingle {
spaceTemplateRelatedURL := rest.AbsoluteURL(request, app.SpaceTemplateHref(modelLinkType.SpaceTemplateID.String()))
spaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(space.SystemSpac... | [
"func",
"ConvertWorkItemLinkTypeFromModel",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"modelLinkType",
"link",
".",
"WorkItemLinkType",
")",
"app",
".",
"WorkItemLinkTypeSingle",
"{",
"spaceTemplateRelatedURL",
":=",
"rest",
".",
"AbsoluteURL",
"(",
"request",... | // ConvertWorkItemLinkTypeFromModel converts a work item link type from model to REST representation | [
"ConvertWorkItemLinkTypeFromModel",
"converts",
"a",
"work",
"item",
"link",
"type",
"from",
"model",
"to",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link_type.go#L96-L124 |
135,308 | fabric8-services/fabric8-wit | controller/work_item_link_type.go | ConvertWorkItemLinkTypeToModel | func ConvertWorkItemLinkTypeToModel(appLinkType app.WorkItemLinkTypeSingle) (*link.WorkItemLinkType, error) {
modelLinkType := link.WorkItemLinkType{}
if appLinkType.Data == nil {
return nil, errors.NewBadParameterError("data", nil).Expected("not <nil>")
}
if appLinkType.Data.Attributes == nil {
return nil, err... | go | func ConvertWorkItemLinkTypeToModel(appLinkType app.WorkItemLinkTypeSingle) (*link.WorkItemLinkType, error) {
modelLinkType := link.WorkItemLinkType{}
if appLinkType.Data == nil {
return nil, errors.NewBadParameterError("data", nil).Expected("not <nil>")
}
if appLinkType.Data.Attributes == nil {
return nil, err... | [
"func",
"ConvertWorkItemLinkTypeToModel",
"(",
"appLinkType",
"app",
".",
"WorkItemLinkTypeSingle",
")",
"(",
"*",
"link",
".",
"WorkItemLinkType",
",",
"error",
")",
"{",
"modelLinkType",
":=",
"link",
".",
"WorkItemLinkType",
"{",
"}",
"\n",
"if",
"appLinkType",... | // ConvertWorkItemLinkTypeToModel converts the incoming app representation of a work item link type to the model layout.
// Values are only overwrriten if they are set in "in", otherwise the values in "out" remain. | [
"ConvertWorkItemLinkTypeToModel",
"converts",
"the",
"incoming",
"app",
"representation",
"of",
"a",
"work",
"item",
"link",
"type",
"to",
"the",
"model",
"layout",
".",
"Values",
"are",
"only",
"overwrriten",
"if",
"they",
"are",
"set",
"in",
"in",
"otherwise",... | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link_type.go#L128-L193 |
135,309 | fabric8-services/fabric8-wit | rendering/markup_render.go | IsMarkupSupported | func IsMarkupSupported(markup string) bool {
if markup == SystemMarkupDefault || markup == SystemMarkupMarkdown {
return true
}
return false
} | go | func IsMarkupSupported(markup string) bool {
if markup == SystemMarkupDefault || markup == SystemMarkupMarkdown {
return true
}
return false
} | [
"func",
"IsMarkupSupported",
"(",
"markup",
"string",
")",
"bool",
"{",
"if",
"markup",
"==",
"SystemMarkupDefault",
"||",
"markup",
"==",
"SystemMarkupMarkdown",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsMarkupSupported indicates if the given markup is supported | [
"IsMarkupSupported",
"indicates",
"if",
"the",
"given",
"markup",
"is",
"supported"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rendering/markup_render.go#L11-L16 |
135,310 | fabric8-services/fabric8-wit | rendering/markup_render.go | RenderMarkupToHTML | func RenderMarkupToHTML(content, markup string) string {
switch markup {
case SystemMarkupPlainText:
return html.EscapeString(content)
case SystemMarkupMarkdown:
unsafe := MarkdownCommonHighlighter([]byte(content))
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA... | go | func RenderMarkupToHTML(content, markup string) string {
switch markup {
case SystemMarkupPlainText:
return html.EscapeString(content)
case SystemMarkupMarkdown:
unsafe := MarkdownCommonHighlighter([]byte(content))
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA... | [
"func",
"RenderMarkupToHTML",
"(",
"content",
",",
"markup",
"string",
")",
"string",
"{",
"switch",
"markup",
"{",
"case",
"SystemMarkupPlainText",
":",
"return",
"html",
".",
"EscapeString",
"(",
"content",
")",
"\n",
"case",
"SystemMarkupMarkdown",
":",
"unsa... | // RenderMarkupToHTML converts the given `content` in HTML using the markup tool corresponding to the given `markup` argument
// or return nil if no tool for the given `markup` is available, or returns an `error` if the command was not found or failed. | [
"RenderMarkupToHTML",
"converts",
"the",
"given",
"content",
"in",
"HTML",
"using",
"the",
"markup",
"tool",
"corresponding",
"to",
"the",
"given",
"markup",
"argument",
"or",
"return",
"nil",
"if",
"no",
"tool",
"for",
"the",
"given",
"markup",
"is",
"availab... | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rendering/markup_render.go#L20-L40 |
135,311 | fabric8-services/fabric8-wit | rest/url.go | AbsoluteURL | func AbsoluteURL(req *http.Request, relative string) string {
scheme := "http"
if req.URL != nil && req.URL.Scheme == "https" { // isHTTPS
scheme = "https"
}
xForwardProto := req.Header.Get("X-Forwarded-Proto")
if xForwardProto != "" {
scheme = xForwardProto
}
return fmt.Sprintf("%s://%s%s", scheme, req.Host... | go | func AbsoluteURL(req *http.Request, relative string) string {
scheme := "http"
if req.URL != nil && req.URL.Scheme == "https" { // isHTTPS
scheme = "https"
}
xForwardProto := req.Header.Get("X-Forwarded-Proto")
if xForwardProto != "" {
scheme = xForwardProto
}
return fmt.Sprintf("%s://%s%s", scheme, req.Host... | [
"func",
"AbsoluteURL",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"relative",
"string",
")",
"string",
"{",
"scheme",
":=",
"\"",
"\"",
"\n",
"if",
"req",
".",
"URL",
"!=",
"nil",
"&&",
"req",
".",
"URL",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
... | // AbsoluteURL prefixes a relative URL with absolute address | [
"AbsoluteURL",
"prefixes",
"a",
"relative",
"URL",
"with",
"absolute",
"address"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rest/url.go#L16-L26 |
135,312 | fabric8-services/fabric8-wit | rest/url.go | AbsoluteURLAsURL | func AbsoluteURLAsURL(req *http.Request, relative string) (*url.URL, error) {
return url.Parse(AbsoluteURL(req, relative))
} | go | func AbsoluteURLAsURL(req *http.Request, relative string) (*url.URL, error) {
return url.Parse(AbsoluteURL(req, relative))
} | [
"func",
"AbsoluteURLAsURL",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"relative",
"string",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"return",
"url",
".",
"Parse",
"(",
"AbsoluteURL",
"(",
"req",
",",
"relative",
")",
")",
"\n",
... | // AbsoluteURLAsURL returns the result of AbsoluteURL parsed into a URL
// structure and a potential parsing error. | [
"AbsoluteURLAsURL",
"returns",
"the",
"result",
"of",
"AbsoluteURL",
"parsed",
"into",
"a",
"URL",
"structure",
"and",
"a",
"potential",
"parsing",
"error",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rest/url.go#L30-L32 |
135,313 | fabric8-services/fabric8-wit | rest/url.go | ReadBody | func ReadBody(body io.ReadCloser) string {
buf := new(bytes.Buffer)
buf.ReadFrom(body)
return buf.String()
} | go | func ReadBody(body io.ReadCloser) string {
buf := new(bytes.Buffer)
buf.ReadFrom(body)
return buf.String()
} | [
"func",
"ReadBody",
"(",
"body",
"io",
".",
"ReadCloser",
")",
"string",
"{",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"buf",
".",
"ReadFrom",
"(",
"body",
")",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] | // ReadBody reads body from a ReadCloser and returns it as a string | [
"ReadBody",
"reads",
"body",
"from",
"a",
"ReadCloser",
"and",
"returns",
"it",
"as",
"a",
"string"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rest/url.go#L44-L48 |
135,314 | fabric8-services/fabric8-wit | rest/url.go | CloseResponse | func CloseResponse(response *http.Response) {
ioutil.ReadAll(response.Body)
response.Body.Close()
} | go | func CloseResponse(response *http.Response) {
ioutil.ReadAll(response.Body)
response.Body.Close()
} | [
"func",
"CloseResponse",
"(",
"response",
"*",
"http",
".",
"Response",
")",
"{",
"ioutil",
".",
"ReadAll",
"(",
"response",
".",
"Body",
")",
"\n",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}"
] | // CloseResponse reads the body and close the response. To be used to prevent file descriptor leaks. | [
"CloseResponse",
"reads",
"the",
"body",
"and",
"close",
"the",
"response",
".",
"To",
"be",
"used",
"to",
"prevent",
"file",
"descriptor",
"leaks",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rest/url.go#L51-L54 |
135,315 | fabric8-services/fabric8-wit | remoteworkitem/github.go | listIssues | func (f *githubIssueFetcher) listIssues(query string, opts *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error) {
return f.client.Search.Issues(query, opts)
} | go | func (f *githubIssueFetcher) listIssues(query string, opts *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error) {
return f.client.Search.Issues(query, opts)
} | [
"func",
"(",
"f",
"*",
"githubIssueFetcher",
")",
"listIssues",
"(",
"query",
"string",
",",
"opts",
"*",
"github",
".",
"SearchOptions",
")",
"(",
"*",
"github",
".",
"IssuesSearchResult",
",",
"*",
"github",
".",
"Response",
",",
"error",
")",
"{",
"re... | // ListIssues list all issues | [
"ListIssues",
"list",
"all",
"issues"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/github.go#L29-L31 |
135,316 | fabric8-services/fabric8-wit | remoteworkitem/github.go | Fetch | func (g *GithubTracker) Fetch(githubAuthToken string) chan TrackerItemContent {
f := githubIssueFetcher{}
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: githubAuthToken},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
f.client = github.NewClient(tc)
return g.fetch(&f)
} | go | func (g *GithubTracker) Fetch(githubAuthToken string) chan TrackerItemContent {
f := githubIssueFetcher{}
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: githubAuthToken},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
f.client = github.NewClient(tc)
return g.fetch(&f)
} | [
"func",
"(",
"g",
"*",
"GithubTracker",
")",
"Fetch",
"(",
"githubAuthToken",
"string",
")",
"chan",
"TrackerItemContent",
"{",
"f",
":=",
"githubIssueFetcher",
"{",
"}",
"\n",
"ts",
":=",
"oauth2",
".",
"StaticTokenSource",
"(",
"&",
"oauth2",
".",
"Token",... | // Fetch tracker items from Github | [
"Fetch",
"tracker",
"items",
"from",
"Github"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/github.go#L34-L42 |
135,317 | fabric8-services/fabric8-wit | controller/comments.go | NewCommentsController | func NewCommentsController(service *goa.Service, db application.DB, config CommentsControllerConfiguration) *CommentsController {
return NewNotifyingCommentsController(service, db, ¬ification.DevNullChannel{}, config)
} | go | func NewCommentsController(service *goa.Service, db application.DB, config CommentsControllerConfiguration) *CommentsController {
return NewNotifyingCommentsController(service, db, ¬ification.DevNullChannel{}, config)
} | [
"func",
"NewCommentsController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"CommentsControllerConfiguration",
")",
"*",
"CommentsController",
"{",
"return",
"NewNotifyingCommentsController",
"(",
"service",
",",
... | // NewCommentsController creates a comments controller. | [
"NewCommentsController",
"creates",
"a",
"comments",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L44-L46 |
135,318 | fabric8-services/fabric8-wit | controller/comments.go | NewNotifyingCommentsController | func NewNotifyingCommentsController(service *goa.Service, db application.DB, notificationChannel notification.Channel, config CommentsControllerConfiguration) *CommentsController {
n := notificationChannel
if n == nil {
n = ¬ification.DevNullChannel{}
}
return &CommentsController{
Controller: service.NewCo... | go | func NewNotifyingCommentsController(service *goa.Service, db application.DB, notificationChannel notification.Channel, config CommentsControllerConfiguration) *CommentsController {
n := notificationChannel
if n == nil {
n = ¬ification.DevNullChannel{}
}
return &CommentsController{
Controller: service.NewCo... | [
"func",
"NewNotifyingCommentsController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"notificationChannel",
"notification",
".",
"Channel",
",",
"config",
"CommentsControllerConfiguration",
")",
"*",
"CommentsController",
"{"... | // NewNotifyingCommentsController creates a comments controller with notification broadcast. | [
"NewNotifyingCommentsController",
"creates",
"a",
"comments",
"controller",
"with",
"notification",
"broadcast",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L49-L60 |
135,319 | fabric8-services/fabric8-wit | controller/comments.go | Update | func (c *CommentsController) Update(ctx *app.UpdateCommentsContext) error {
identityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
}
cm, wi, userIsCreator, err := c.loadComment(ctx.Context, ctx.CommentID, *identityID)
if err != nil {
... | go | func (c *CommentsController) Update(ctx *app.UpdateCommentsContext) error {
identityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
}
cm, wi, userIsCreator, err := c.loadComment(ctx.Context, ctx.CommentID, *identityID)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"CommentsController",
")",
"Update",
"(",
"ctx",
"*",
"app",
".",
"UpdateCommentsContext",
")",
"error",
"{",
"identityID",
",",
"err",
":=",
"login",
".",
"ContextIdentity",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Update does PATCH comment | [
"Update",
"does",
"PATCH",
"comment"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L86-L115 |
135,320 | fabric8-services/fabric8-wit | controller/comments.go | Delete | func (c *CommentsController) Delete(ctx *app.DeleteCommentsContext) error {
identityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
}
cm, wi, userIsCreator, err := c.loadComment(ctx.Context, ctx.CommentID, *identityID)
if err != nil {
... | go | func (c *CommentsController) Delete(ctx *app.DeleteCommentsContext) error {
identityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
}
cm, wi, userIsCreator, err := c.loadComment(ctx.Context, ctx.CommentID, *identityID)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"CommentsController",
")",
"Delete",
"(",
"ctx",
"*",
"app",
".",
"DeleteCommentsContext",
")",
"error",
"{",
"identityID",
",",
"err",
":=",
"login",
".",
"ContextIdentity",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Delete does DELETE comment | [
"Delete",
"does",
"DELETE",
"comment"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L147-L173 |
135,321 | fabric8-services/fabric8-wit | controller/comments.go | ConvertComments | func ConvertComments(request *http.Request, comments []comment.Comment, additional ...CommentConvertFunc) []*app.Comment {
var cs = []*app.Comment{}
for _, c := range comments {
cs = append(cs, ConvertComment(request, c, additional...))
}
return cs
} | go | func ConvertComments(request *http.Request, comments []comment.Comment, additional ...CommentConvertFunc) []*app.Comment {
var cs = []*app.Comment{}
for _, c := range comments {
cs = append(cs, ConvertComment(request, c, additional...))
}
return cs
} | [
"func",
"ConvertComments",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comments",
"[",
"]",
"comment",
".",
"Comment",
",",
"additional",
"...",
"CommentConvertFunc",
")",
"[",
"]",
"*",
"app",
".",
"Comment",
"{",
"var",
"cs",
"=",
"[",
"]",
"*... | // ConvertComments converts between internal and external REST representation | [
"ConvertComments",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L180-L186 |
135,322 | fabric8-services/fabric8-wit | controller/comments.go | ConvertCommentsResourceID | func ConvertCommentsResourceID(request *http.Request, comments []comment.Comment, additional ...CommentConvertFunc) []*app.Comment {
var cs = []*app.Comment{}
for _, c := range comments {
cs = append(cs, ConvertCommentResourceID(request, c, additional...))
}
return cs
} | go | func ConvertCommentsResourceID(request *http.Request, comments []comment.Comment, additional ...CommentConvertFunc) []*app.Comment {
var cs = []*app.Comment{}
for _, c := range comments {
cs = append(cs, ConvertCommentResourceID(request, c, additional...))
}
return cs
} | [
"func",
"ConvertCommentsResourceID",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comments",
"[",
"]",
"comment",
".",
"Comment",
",",
"additional",
"...",
"CommentConvertFunc",
")",
"[",
"]",
"*",
"app",
".",
"Comment",
"{",
"var",
"cs",
"=",
"[",
... | // ConvertCommentsResourceID converts between internal and external REST representation, ResourceIdentificationObject only | [
"ConvertCommentsResourceID",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation",
"ResourceIdentificationObject",
"only"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L189-L195 |
135,323 | fabric8-services/fabric8-wit | controller/comments.go | ConvertCommentResourceID | func ConvertCommentResourceID(request *http.Request, comment comment.Comment, additional ...CommentConvertFunc) *app.Comment {
c := &app.Comment{
Type: APIStringTypeComments,
ID: &comment.ID,
}
for _, add := range additional {
add(request, &comment, c)
}
return c
} | go | func ConvertCommentResourceID(request *http.Request, comment comment.Comment, additional ...CommentConvertFunc) *app.Comment {
c := &app.Comment{
Type: APIStringTypeComments,
ID: &comment.ID,
}
for _, add := range additional {
add(request, &comment, c)
}
return c
} | [
"func",
"ConvertCommentResourceID",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comment",
"comment",
".",
"Comment",
",",
"additional",
"...",
"CommentConvertFunc",
")",
"*",
"app",
".",
"Comment",
"{",
"c",
":=",
"&",
"app",
".",
"Comment",
"{",
"T... | // ConvertCommentResourceID converts between internal and external REST representation, ResourceIdentificationObject only | [
"ConvertCommentResourceID",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation",
"ResourceIdentificationObject",
"only"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L198-L207 |
135,324 | fabric8-services/fabric8-wit | controller/comments.go | ConvertComment | func ConvertComment(request *http.Request, comment comment.Comment, additional ...CommentConvertFunc) *app.Comment {
relatedURL := rest.AbsoluteURL(request, app.CommentsHref(comment.ID))
relatedCreatorLink := rest.AbsoluteURL(request, fmt.Sprintf("%s/%s", usersEndpoint, comment.Creator))
c := &app.Comment{
Type: A... | go | func ConvertComment(request *http.Request, comment comment.Comment, additional ...CommentConvertFunc) *app.Comment {
relatedURL := rest.AbsoluteURL(request, app.CommentsHref(comment.ID))
relatedCreatorLink := rest.AbsoluteURL(request, fmt.Sprintf("%s/%s", usersEndpoint, comment.Creator))
c := &app.Comment{
Type: A... | [
"func",
"ConvertComment",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comment",
"comment",
".",
"Comment",
",",
"additional",
"...",
"CommentConvertFunc",
")",
"*",
"app",
".",
"Comment",
"{",
"relatedURL",
":=",
"rest",
".",
"AbsoluteURL",
"(",
"requ... | // ConvertComment converts between internal and external REST representation | [
"ConvertComment",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L210-L260 |
135,325 | fabric8-services/fabric8-wit | controller/comments.go | CommentIncludeParentWorkItem | func CommentIncludeParentWorkItem(ctx context.Context, c *comment.Comment) CommentConvertFunc {
return func(request *http.Request, comment *comment.Comment, data *app.Comment) {
HrefFunc := func(obj interface{}) string {
return fmt.Sprintf(app.WorkitemHref("%v"), obj)
}
CommentIncludeParent(request, comment, ... | go | func CommentIncludeParentWorkItem(ctx context.Context, c *comment.Comment) CommentConvertFunc {
return func(request *http.Request, comment *comment.Comment, data *app.Comment) {
HrefFunc := func(obj interface{}) string {
return fmt.Sprintf(app.WorkitemHref("%v"), obj)
}
CommentIncludeParent(request, comment, ... | [
"func",
"CommentIncludeParentWorkItem",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"comment",
".",
"Comment",
")",
"CommentConvertFunc",
"{",
"return",
"func",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comment",
"*",
"comment",
".",
"Comm... | // CommentIncludeParentWorkItem includes a "parent" relation to a WorkItem | [
"CommentIncludeParentWorkItem",
"includes",
"a",
"parent",
"relation",
"to",
"a",
"WorkItem"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L266-L273 |
135,326 | fabric8-services/fabric8-wit | controller/comments.go | CommentIncludeParent | func CommentIncludeParent(request *http.Request, comment *comment.Comment, data *app.Comment, href HrefFunc, parentType string) {
data.Relationships.Parent = &app.RelationGeneric{
Data: &app.GenericData{
Type: &parentType,
ID: ptr.String(comment.ParentID.String()),
},
Links: &app.GenericLinks{
Self: p... | go | func CommentIncludeParent(request *http.Request, comment *comment.Comment, data *app.Comment, href HrefFunc, parentType string) {
data.Relationships.Parent = &app.RelationGeneric{
Data: &app.GenericData{
Type: &parentType,
ID: ptr.String(comment.ParentID.String()),
},
Links: &app.GenericLinks{
Self: p... | [
"func",
"CommentIncludeParent",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"comment",
"*",
"comment",
".",
"Comment",
",",
"data",
"*",
"app",
".",
"Comment",
",",
"href",
"HrefFunc",
",",
"parentType",
"string",
")",
"{",
"data",
".",
"Relationship... | // CommentIncludeParent adds the "parent" relationship to this Comment | [
"CommentIncludeParent",
"adds",
"the",
"parent",
"relationship",
"to",
"this",
"Comment"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/comments.go#L276-L286 |
135,327 | fabric8-services/fabric8-wit | rest/http.go | Do | func (d *HttpClientDoer) Do(ctx context.Context, req *http.Request) (*http.Response, error) {
return d.HttpClient.Do(req)
} | go | func (d *HttpClientDoer) Do(ctx context.Context, req *http.Request) (*http.Response, error) {
return d.HttpClient.Do(req)
} | [
"func",
"(",
"d",
"*",
"HttpClientDoer",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"return",
"d",
".",
"HttpClient",
".",
"Do",
"(",
... | // Do overrides Do method of the default goa client Doer. It's needed for mocking http clients in tests. | [
"Do",
"overrides",
"Do",
"method",
"of",
"the",
"default",
"goa",
"client",
"Doer",
".",
"It",
"s",
"needed",
"for",
"mocking",
"http",
"clients",
"in",
"tests",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/rest/http.go#L31-L33 |
135,328 | fabric8-services/fabric8-wit | controller/user.go | ListSpaces | func (c *UserController) ListSpaces(ctx *app.ListSpacesUserContext) error {
client, err := newAuthClient(ctx, c.config, c.httpOptions...)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, err)
}
res, err := client.ListResourcesUser(goasupport.ForwardContextRequestID(ctx), authservice.ListResourcesUserPath(), ... | go | func (c *UserController) ListSpaces(ctx *app.ListSpacesUserContext) error {
client, err := newAuthClient(ctx, c.config, c.httpOptions...)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, err)
}
res, err := client.ListResourcesUser(goasupport.ForwardContextRequestID(ctx), authservice.ListResourcesUserPath(), ... | [
"func",
"(",
"c",
"*",
"UserController",
")",
"ListSpaces",
"(",
"ctx",
"*",
"app",
".",
"ListSpacesUserContext",
")",
"error",
"{",
"client",
",",
"err",
":=",
"newAuthClient",
"(",
"ctx",
",",
"c",
".",
"config",
",",
"c",
".",
"httpOptions",
"...",
... | // ListSpaces returns the list of spaces in which the user has a role | [
"ListSpaces",
"returns",
"the",
"list",
"of",
"spaces",
"in",
"which",
"the",
"user",
"has",
"a",
"role"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/user.go#L118-L156 |
135,329 | fabric8-services/fabric8-wit | spacetemplate/template.go | Equal | func (s SpaceTemplate) Equal(u convert.Equaler) bool {
other, ok := u.(SpaceTemplate)
if !ok {
return false
}
if !uuid.Equal(s.ID, other.ID) {
return false
}
if s.Name != other.Name {
return false
}
if s.Version != other.Version {
return false
}
if !convert.CascadeEqual(s.Lifecycle, other.Lifecycle) {... | go | func (s SpaceTemplate) Equal(u convert.Equaler) bool {
other, ok := u.(SpaceTemplate)
if !ok {
return false
}
if !uuid.Equal(s.ID, other.ID) {
return false
}
if s.Name != other.Name {
return false
}
if s.Version != other.Version {
return false
}
if !convert.CascadeEqual(s.Lifecycle, other.Lifecycle) {... | [
"func",
"(",
"s",
"SpaceTemplate",
")",
"Equal",
"(",
"u",
"convert",
".",
"Equaler",
")",
"bool",
"{",
"other",
",",
"ok",
":=",
"u",
".",
"(",
"SpaceTemplate",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"uui... | // Equal returns true if two SpaceTemplate objects are equal; otherwise false is
// returned. | [
"Equal",
"returns",
"true",
"if",
"two",
"SpaceTemplate",
"objects",
"are",
"equal",
";",
"otherwise",
"false",
"is",
"returned",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/template.go#L69-L93 |
135,330 | fabric8-services/fabric8-wit | errors/errors.go | FromStatusCode | func FromStatusCode(statusCode int, format string, args ...interface{}) error {
msg := fmt.Sprintf(format, args...)
switch statusCode {
case http.StatusNotFound:
return NewNotFoundErrorFromString(msg)
case http.StatusBadRequest:
return NewBadParameterErrorFromString(msg)
case http.StatusConflict:
return NewV... | go | func FromStatusCode(statusCode int, format string, args ...interface{}) error {
msg := fmt.Sprintf(format, args...)
switch statusCode {
case http.StatusNotFound:
return NewNotFoundErrorFromString(msg)
case http.StatusBadRequest:
return NewBadParameterErrorFromString(msg)
case http.StatusConflict:
return NewV... | [
"func",
"FromStatusCode",
"(",
"statusCode",
"int",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"switch",
"statusCode",
"{",
"c... | // FromStatusCode returns an error from the given HTTP status code, using the message and args | [
"FromStatusCode",
"returns",
"an",
"error",
"from",
"the",
"given",
"HTTP",
"status",
"code",
"using",
"the",
"message",
"and",
"args"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L25-L41 |
135,331 | fabric8-services/fabric8-wit | errors/errors.go | IsInternalError | func IsInternalError(err error) (bool, error) {
e, ok := errs.Cause(err).(InternalError)
if !ok {
return false, nil
}
return true, e
} | go | func IsInternalError(err error) (bool, error) {
e, ok := errs.Cause(err).(InternalError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsInternalError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"InternalError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil",
"\n"... | // IsInternalError returns true if the cause of the given error can be
// converted to an InternalError, which is returned as the second result. | [
"IsInternalError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"InternalError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L63-L69 |
135,332 | fabric8-services/fabric8-wit | errors/errors.go | IsUnauthorizedError | func IsUnauthorizedError(err error) (bool, error) {
e, ok := errs.Cause(err).(UnauthorizedError)
if !ok {
return false, nil
}
return true, e
} | go | func IsUnauthorizedError(err error) (bool, error) {
e, ok := errs.Cause(err).(UnauthorizedError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsUnauthorizedError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"UnauthorizedError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil"... | // IsUnauthorizedError returns true if the cause of the given error can be
// converted to an UnauthorizedError, which is returned as the second result. | [
"IsUnauthorizedError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"UnauthorizedError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L78-L84 |
135,333 | fabric8-services/fabric8-wit | errors/errors.go | IsForbiddenError | func IsForbiddenError(err error) (bool, error) {
e, ok := errs.Cause(err).(ForbiddenError)
if !ok {
return false, nil
}
return true, e
} | go | func IsForbiddenError(err error) (bool, error) {
e, ok := errs.Cause(err).(ForbiddenError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsForbiddenError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"ForbiddenError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil",
"\... | // IsForbiddenError returns true if the cause of the given error can be
// converted to an ForbiddenError, which is returned as the second result. | [
"IsForbiddenError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"ForbiddenError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L93-L99 |
135,334 | fabric8-services/fabric8-wit | errors/errors.go | IsDataConflictError | func IsDataConflictError(err error) (bool, error) {
e, ok := errs.Cause(err).(DataConflictError)
if !ok {
return false, nil
}
return true, e
} | go | func IsDataConflictError(err error) (bool, error) {
e, ok := errs.Cause(err).(DataConflictError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsDataConflictError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"DataConflictError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil"... | // IsDataConflictError returns true if the cause of the given error can be
// converted to an IsDataConflictError, which is returned as the second result. | [
"IsDataConflictError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"IsDataConflictError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L137-L143 |
135,335 | fabric8-services/fabric8-wit | errors/errors.go | IsVersionConflictError | func IsVersionConflictError(err error) (bool, error) {
e, ok := errs.Cause(err).(VersionConflictError)
if !ok {
return false, nil
}
return true, e
} | go | func IsVersionConflictError(err error) (bool, error) {
e, ok := errs.Cause(err).(VersionConflictError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsVersionConflictError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"VersionConflictError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
... | // IsVersionConflictError returns true if the cause of the given error can be
// converted to an VersionConflictError, which is returned as the second result. | [
"IsVersionConflictError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"VersionConflictError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L152-L158 |
135,336 | fabric8-services/fabric8-wit | errors/errors.go | NewBadParameterError | func NewBadParameterError(param string, actual interface{}) BadParameterError {
return BadParameterError{parameter: param, value: actual}
} | go | func NewBadParameterError(param string, actual interface{}) BadParameterError {
return BadParameterError{parameter: param, value: actual}
} | [
"func",
"NewBadParameterError",
"(",
"param",
"string",
",",
"actual",
"interface",
"{",
"}",
")",
"BadParameterError",
"{",
"return",
"BadParameterError",
"{",
"parameter",
":",
"param",
",",
"value",
":",
"actual",
"}",
"\n",
"}"
] | // NewBadParameterError returns the custom defined error of type NewBadParameterError. | [
"NewBadParameterError",
"returns",
"the",
"custom",
"defined",
"error",
"of",
"type",
"NewBadParameterError",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L189-L191 |
135,337 | fabric8-services/fabric8-wit | errors/errors.go | IsBadParameterError | func IsBadParameterError(err error) (bool, error) {
e, ok := errs.Cause(err).(BadParameterError)
if !ok {
return false, nil
}
return true, e
} | go | func IsBadParameterError(err error) (bool, error) {
e, ok := errs.Cause(err).(BadParameterError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsBadParameterError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"BadParameterError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil"... | // IsBadParameterError returns true if the cause of the given error can be
// converted to an BadParameterError, which is returned as the second result. | [
"IsBadParameterError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"BadParameterError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L200-L206 |
135,338 | fabric8-services/fabric8-wit | errors/errors.go | IsConversionError | func IsConversionError(err error) (bool, error) {
e, ok := errs.Cause(err).(ConversionError)
if !ok {
return false, nil
}
return true, e
} | go | func IsConversionError(err error) (bool, error) {
e, ok := errs.Cause(err).(ConversionError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsConversionError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"ConversionError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil",
... | // IsConversionError returns true if the cause of the given error can be
// converted to an ConversionError, which is returned as the second result. | [
"IsConversionError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"ConversionError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L215-L221 |
135,339 | fabric8-services/fabric8-wit | errors/errors.go | IsNotFoundError | func IsNotFoundError(err error) (bool, error) {
e, ok := errs.Cause(err).(NotFoundError)
if !ok {
return false, nil
}
return true, e
} | go | func IsNotFoundError(err error) (bool, error) {
e, ok := errs.Cause(err).(NotFoundError)
if !ok {
return false, nil
}
return true, e
} | [
"func",
"IsNotFoundError",
"(",
"err",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"e",
",",
"ok",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
".",
"(",
"NotFoundError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"nil",
"\n"... | // IsNotFoundError returns true if the cause of the given error can be
// converted to an NotFoundError, which is returned as the second result. | [
"IsNotFoundError",
"returns",
"true",
"if",
"the",
"cause",
"of",
"the",
"given",
"error",
"can",
"be",
"converted",
"to",
"an",
"NotFoundError",
"which",
"is",
"returned",
"as",
"the",
"second",
"result",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/errors/errors.go#L254-L260 |
135,340 | fabric8-services/fabric8-wit | account/context_information.go | Equal | func (f ContextInformation) Equal(u convert.Equaler) bool {
other, ok := u.(ContextInformation)
if !ok {
return false
}
return reflect.DeepEqual(f, other)
} | go | func (f ContextInformation) Equal(u convert.Equaler) bool {
other, ok := u.(ContextInformation)
if !ok {
return false
}
return reflect.DeepEqual(f, other)
} | [
"func",
"(",
"f",
"ContextInformation",
")",
"Equal",
"(",
"u",
"convert",
".",
"Equaler",
")",
"bool",
"{",
"other",
",",
"ok",
":=",
"u",
".",
"(",
"ContextInformation",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",... | // Equal returns true if two ContextInformation objects are equal; otherwise false is returned. | [
"Equal",
"returns",
"true",
"if",
"two",
"ContextInformation",
"objects",
"are",
"equal",
";",
"otherwise",
"false",
"is",
"returned",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/account/context_information.go#L20-L26 |
135,341 | fabric8-services/fabric8-wit | controller/work_item_link.go | NewWorkItemLinkController | func NewWorkItemLinkController(service *goa.Service, db application.DB, config WorkItemLinkControllerConfig) *WorkItemLinkController {
return &WorkItemLinkController{
Controller: service.NewController("WorkItemLinkController"),
db: db,
config: config,
}
} | go | func NewWorkItemLinkController(service *goa.Service, db application.DB, config WorkItemLinkControllerConfig) *WorkItemLinkController {
return &WorkItemLinkController{
Controller: service.NewController("WorkItemLinkController"),
db: db,
config: config,
}
} | [
"func",
"NewWorkItemLinkController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"WorkItemLinkControllerConfig",
")",
"*",
"WorkItemLinkController",
"{",
"return",
"&",
"WorkItemLinkController",
"{",
"Controller",
... | // NewWorkItemLinkController creates a work-item-link controller. | [
"NewWorkItemLinkController",
"creates",
"a",
"work",
"-",
"item",
"-",
"link",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L35-L41 |
135,342 | fabric8-services/fabric8-wit | controller/work_item_link.go | newWorkItemLinkContext | func newWorkItemLinkContext(ctx context.Context, service *goa.Service, appl application.Application, db application.DB, request *http.Request, responseWriter http.ResponseWriter, linkFunc hrefLinkFunc, currentUserIdentityID *uuid.UUID) *workItemLinkContext {
return &workItemLinkContext{
Request: reques... | go | func newWorkItemLinkContext(ctx context.Context, service *goa.Service, appl application.Application, db application.DB, request *http.Request, responseWriter http.ResponseWriter, linkFunc hrefLinkFunc, currentUserIdentityID *uuid.UUID) *workItemLinkContext {
return &workItemLinkContext{
Request: reques... | [
"func",
"newWorkItemLinkContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
"*",
"goa",
".",
"Service",
",",
"appl",
"application",
".",
"Application",
",",
"db",
"application",
".",
"DB",
",",
"request",
"*",
"http",
".",
"Request",
",",
"res... | // newWorkItemLinkContext returns a new workItemLinkContext | [
"newWorkItemLinkContext",
"returns",
"a",
"new",
"workItemLinkContext"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L63-L74 |
135,343 | fabric8-services/fabric8-wit | controller/work_item_link.go | getTypesOfLinks | func getTypesOfLinks(ctx context.Context, appl application.Application, req *http.Request, linksDataArr []*app.WorkItemLinkData) ([]*app.WorkItemLinkTypeData, error) {
// Build our "set" of distinct type IDs
idMap := map[uuid.UUID]struct{}{}
idArr := []uuid.UUID{}
for _, linkData := range linksDataArr {
id := lin... | go | func getTypesOfLinks(ctx context.Context, appl application.Application, req *http.Request, linksDataArr []*app.WorkItemLinkData) ([]*app.WorkItemLinkTypeData, error) {
// Build our "set" of distinct type IDs
idMap := map[uuid.UUID]struct{}{}
idArr := []uuid.UUID{}
for _, linkData := range linksDataArr {
id := lin... | [
"func",
"getTypesOfLinks",
"(",
"ctx",
"context",
".",
"Context",
",",
"appl",
"application",
".",
"Application",
",",
"req",
"*",
"http",
".",
"Request",
",",
"linksDataArr",
"[",
"]",
"*",
"app",
".",
"WorkItemLinkData",
")",
"(",
"[",
"]",
"*",
"app",... | // getTypesOfLinks returns an array of distinct work item link types for the
// given work item links | [
"getTypesOfLinks",
"returns",
"an",
"array",
"of",
"distinct",
"work",
"item",
"link",
"types",
"for",
"the",
"given",
"work",
"item",
"links"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L78-L104 |
135,344 | fabric8-services/fabric8-wit | controller/work_item_link.go | getWorkItemsOfLinks | func getWorkItemsOfLinks(ctx context.Context, appl application.Application, req *http.Request, linksDataArr []*app.WorkItemLinkData) ([]*app.WorkItem, error) {
// Build our "set" of distinct work item IDs
idMap := map[uuid.UUID]struct{}{}
idArr := []uuid.UUID{}
for _, linkData := range linksDataArr {
src := linkD... | go | func getWorkItemsOfLinks(ctx context.Context, appl application.Application, req *http.Request, linksDataArr []*app.WorkItemLinkData) ([]*app.WorkItem, error) {
// Build our "set" of distinct work item IDs
idMap := map[uuid.UUID]struct{}{}
idArr := []uuid.UUID{}
for _, linkData := range linksDataArr {
src := linkD... | [
"func",
"getWorkItemsOfLinks",
"(",
"ctx",
"context",
".",
"Context",
",",
"appl",
"application",
".",
"Application",
",",
"req",
"*",
"http",
".",
"Request",
",",
"linksDataArr",
"[",
"]",
"*",
"app",
".",
"WorkItemLinkData",
")",
"(",
"[",
"]",
"*",
"a... | // getWorkItemsOfLinks returns an array of distinct work items as they appear as
// source or target in the given work item links. | [
"getWorkItemsOfLinks",
"returns",
"an",
"array",
"of",
"distinct",
"work",
"items",
"as",
"they",
"appear",
"as",
"source",
"or",
"target",
"in",
"the",
"given",
"work",
"item",
"links",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L108-L143 |
135,345 | fabric8-services/fabric8-wit | controller/work_item_link.go | enrichLinkSingle | func enrichLinkSingle(ctx context.Context, appl application.Application, req *http.Request, appLinks *app.WorkItemLinkSingle) error {
// Include link type
//modelLinkType, err := ctx.Application.WorkItemLinkTypes().Load(ctx.Context, appLinks.Data.Relationships.LinkType.Data.ID)
modelLinkType, err := appl.WorkItemLin... | go | func enrichLinkSingle(ctx context.Context, appl application.Application, req *http.Request, appLinks *app.WorkItemLinkSingle) error {
// Include link type
//modelLinkType, err := ctx.Application.WorkItemLinkTypes().Load(ctx.Context, appLinks.Data.Relationships.LinkType.Data.ID)
modelLinkType, err := appl.WorkItemLin... | [
"func",
"enrichLinkSingle",
"(",
"ctx",
"context",
".",
"Context",
",",
"appl",
"application",
".",
"Application",
",",
"req",
"*",
"http",
".",
"Request",
",",
"appLinks",
"*",
"app",
".",
"WorkItemLinkSingle",
")",
"error",
"{",
"// Include link type",
"//mo... | // enrichLinkSingle includes related resources in the link's "included" array | [
"enrichLinkSingle",
"includes",
"related",
"resources",
"in",
"the",
"link",
"s",
"included",
"array"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L146-L186 |
135,346 | fabric8-services/fabric8-wit | controller/work_item_link.go | enrichLinkList | func enrichLinkList(ctx context.Context, appl application.Application, req *http.Request, linkArr *app.WorkItemLinkList) error {
// include link types
typeDataArr, err := getTypesOfLinks(ctx, appl, req, linkArr.Data)
if err != nil {
return errs.WithStack(err)
}
// Convert slice of objects to slice of interface (... | go | func enrichLinkList(ctx context.Context, appl application.Application, req *http.Request, linkArr *app.WorkItemLinkList) error {
// include link types
typeDataArr, err := getTypesOfLinks(ctx, appl, req, linkArr.Data)
if err != nil {
return errs.WithStack(err)
}
// Convert slice of objects to slice of interface (... | [
"func",
"enrichLinkList",
"(",
"ctx",
"context",
".",
"Context",
",",
"appl",
"application",
".",
"Application",
",",
"req",
"*",
"http",
".",
"Request",
",",
"linkArr",
"*",
"app",
".",
"WorkItemLinkList",
")",
"error",
"{",
"// include link types",
"typeData... | // enrichLinkList includes related resources in the linkArr's "included" element | [
"enrichLinkList",
"includes",
"related",
"resources",
"in",
"the",
"linkArr",
"s",
"included",
"element"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L189-L214 |
135,347 | fabric8-services/fabric8-wit | controller/work_item_link.go | Delete | func (c *WorkItemLinkController) Delete(ctx *app.DeleteWorkItemLinkContext) error {
currentUserIdentityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(err.Error()))
}
authorized, err := c.checkIfUserIsSpaceCollaboratorOrWorkItemCreator(ctx, c... | go | func (c *WorkItemLinkController) Delete(ctx *app.DeleteWorkItemLinkContext) error {
currentUserIdentityID, err := login.ContextIdentity(ctx)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(err.Error()))
}
authorized, err := c.checkIfUserIsSpaceCollaboratorOrWorkItemCreator(ctx, c... | [
"func",
"(",
"c",
"*",
"WorkItemLinkController",
")",
"Delete",
"(",
"ctx",
"*",
"app",
".",
"DeleteWorkItemLinkContext",
")",
"error",
"{",
"currentUserIdentityID",
",",
"err",
":=",
"login",
".",
"ContextIdentity",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",... | //
// Delete runs the delete action | [
"Delete",
"runs",
"the",
"delete",
"action"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L310-L329 |
135,348 | fabric8-services/fabric8-wit | controller/work_item_link.go | ConvertLinkFromModel | func ConvertLinkFromModel(request *http.Request, t link.WorkItemLink) app.WorkItemLinkSingle {
linkSelfURL := rest.AbsoluteURL(request, app.WorkItemLinkHref(t.ID.String()))
linkTypeRelatedURL := rest.AbsoluteURL(request, app.WorkItemLinkTypeHref(t.LinkTypeID.String()))
sourceRelatedURL := rest.AbsoluteURL(request, ... | go | func ConvertLinkFromModel(request *http.Request, t link.WorkItemLink) app.WorkItemLinkSingle {
linkSelfURL := rest.AbsoluteURL(request, app.WorkItemLinkHref(t.ID.String()))
linkTypeRelatedURL := rest.AbsoluteURL(request, app.WorkItemLinkTypeHref(t.LinkTypeID.String()))
sourceRelatedURL := rest.AbsoluteURL(request, ... | [
"func",
"ConvertLinkFromModel",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"t",
"link",
".",
"WorkItemLink",
")",
"app",
".",
"WorkItemLinkSingle",
"{",
"linkSelfURL",
":=",
"rest",
".",
"AbsoluteURL",
"(",
"request",
",",
"app",
".",
"WorkItemLinkHref"... | // ConvertLinkFromModel converts a work item from model to REST representation | [
"ConvertLinkFromModel",
"converts",
"a",
"work",
"item",
"from",
"model",
"to",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_link.go#L353-L404 |
135,349 | fabric8-services/fabric8-wit | controller/workitemtype.go | NewWorkitemtypeController | func NewWorkitemtypeController(service *goa.Service, db application.DB, config workItemTypeControllerConfiguration) *WorkitemtypeController {
return &WorkitemtypeController{
Controller: service.NewController("WorkitemtypeController"),
db: db,
config: config,
}
} | go | func NewWorkitemtypeController(service *goa.Service, db application.DB, config workItemTypeControllerConfiguration) *WorkitemtypeController {
return &WorkitemtypeController{
Controller: service.NewController("WorkitemtypeController"),
db: db,
config: config,
}
} | [
"func",
"NewWorkitemtypeController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"workItemTypeControllerConfiguration",
")",
"*",
"WorkitemtypeController",
"{",
"return",
"&",
"WorkitemtypeController",
"{",
"Controll... | // NewWorkitemtypeController creates a workitemtype controller. | [
"NewWorkitemtypeController",
"creates",
"a",
"workitemtype",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/workitemtype.go#L31-L37 |
135,350 | fabric8-services/fabric8-wit | controller/workitemtype.go | ConvertWorkItemTypeFromModel | func ConvertWorkItemTypeFromModel(request *http.Request, t *workitem.WorkItemType) app.WorkItemTypeData {
spaceTemplateRelatedURL := rest.AbsoluteURL(request, app.SpaceTemplateHref(t.SpaceTemplateID.String()))
spaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(space.SystemSpace.String()))
var converted = app... | go | func ConvertWorkItemTypeFromModel(request *http.Request, t *workitem.WorkItemType) app.WorkItemTypeData {
spaceTemplateRelatedURL := rest.AbsoluteURL(request, app.SpaceTemplateHref(t.SpaceTemplateID.String()))
spaceRelatedURL := rest.AbsoluteURL(request, app.SpaceHref(space.SystemSpace.String()))
var converted = app... | [
"func",
"ConvertWorkItemTypeFromModel",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"t",
"*",
"workitem",
".",
"WorkItemType",
")",
"app",
".",
"WorkItemTypeData",
"{",
"spaceTemplateRelatedURL",
":=",
"rest",
".",
"AbsoluteURL",
"(",
"request",
",",
"app"... | // ConvertWorkItemTypeFromModel converts from models to app representation | [
"ConvertWorkItemTypeFromModel",
"converts",
"from",
"models",
"to",
"app",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/workitemtype.go#L59-L102 |
135,351 | fabric8-services/fabric8-wit | controller/workitemtype.go | ConvertFieldTypeFromModel | func ConvertFieldTypeFromModel(t workitem.FieldType) app.FieldType {
result := app.FieldType{}
result.Kind = string(t.GetKind())
switch modelFieldType := t.(type) {
case workitem.ListType:
result.ComponentType = ptr.String(string(modelFieldType.ComponentType.GetKind()))
if modelFieldType.DefaultValue != nil {
... | go | func ConvertFieldTypeFromModel(t workitem.FieldType) app.FieldType {
result := app.FieldType{}
result.Kind = string(t.GetKind())
switch modelFieldType := t.(type) {
case workitem.ListType:
result.ComponentType = ptr.String(string(modelFieldType.ComponentType.GetKind()))
if modelFieldType.DefaultValue != nil {
... | [
"func",
"ConvertFieldTypeFromModel",
"(",
"t",
"workitem",
".",
"FieldType",
")",
"app",
".",
"FieldType",
"{",
"result",
":=",
"app",
".",
"FieldType",
"{",
"}",
"\n",
"result",
".",
"Kind",
"=",
"string",
"(",
"t",
".",
"GetKind",
"(",
")",
")",
"\n"... | // converts the field type from model to app representation | [
"converts",
"the",
"field",
"type",
"from",
"model",
"to",
"app",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/workitemtype.go#L105-L127 |
135,352 | fabric8-services/fabric8-wit | area/area.go | MakeChildOf | func (m *Area) MakeChildOf(parent Area) {
if m.ID == uuid.Nil {
m.ID = uuid.NewV4()
}
m.Path = append(parent.Path, m.ID)
} | go | func (m *Area) MakeChildOf(parent Area) {
if m.ID == uuid.Nil {
m.ID = uuid.NewV4()
}
m.Path = append(parent.Path, m.ID)
} | [
"func",
"(",
"m",
"*",
"Area",
")",
"MakeChildOf",
"(",
"parent",
"Area",
")",
"{",
"if",
"m",
".",
"ID",
"==",
"uuid",
".",
"Nil",
"{",
"m",
".",
"ID",
"=",
"uuid",
".",
"NewV4",
"(",
")",
"\n",
"}",
"\n",
"m",
".",
"Path",
"=",
"append",
... | // MakeChildOf does all the path magic to make the current area a child of the
// given parent area. | [
"MakeChildOf",
"does",
"all",
"the",
"path",
"magic",
"to",
"make",
"the",
"current",
"area",
"a",
"child",
"of",
"the",
"given",
"parent",
"area",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L37-L42 |
135,353 | fabric8-services/fabric8-wit | area/area.go | LoadMultiple | func (m *GormAreaRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "getmultiple"}, time.Now())
var objs []Area
if len(ids) == 0 {
return objs, nil
}
for i := 0; i < len(ids); i++ {
m.db = m.db.Or("id = ?", ids[i])
}
tx := m.d... | go | func (m *GormAreaRepository) LoadMultiple(ctx context.Context, ids []uuid.UUID) ([]Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "getmultiple"}, time.Now())
var objs []Area
if len(ids) == 0 {
return objs, nil
}
for i := 0; i < len(ids); i++ {
m.db = m.db.Or("id = ?", ids[i])
}
tx := m.d... | [
"func",
"(",
"m",
"*",
"GormAreaRepository",
")",
"LoadMultiple",
"(",
"ctx",
"context",
".",
"Context",
",",
"ids",
"[",
"]",
"uuid",
".",
"UUID",
")",
"(",
"[",
"]",
"Area",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"... | // Load multiple areas | [
"Load",
"multiple",
"areas"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L151-L165 |
135,354 | fabric8-services/fabric8-wit | area/area.go | ListChildren | func (m *GormAreaRepository) ListChildren(ctx context.Context, parentArea *Area) ([]Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "querychild"}, time.Now())
var objs []Area
tx := m.db.Where("path ~ ($1 || '.*{1}')::lquery", parentArea.Path.Convert()).Find(&objs)
if tx.RecordNotFound() {
ret... | go | func (m *GormAreaRepository) ListChildren(ctx context.Context, parentArea *Area) ([]Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "querychild"}, time.Now())
var objs []Area
tx := m.db.Where("path ~ ($1 || '.*{1}')::lquery", parentArea.Path.Convert()).Find(&objs)
if tx.RecordNotFound() {
ret... | [
"func",
"(",
"m",
"*",
"GormAreaRepository",
")",
"ListChildren",
"(",
"ctx",
"context",
".",
"Context",
",",
"parentArea",
"*",
"Area",
")",
"(",
"[",
"]",
"Area",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
... | // ListChildren fetches all Areas belonging to a parent - list all child areas. | [
"ListChildren",
"fetches",
"all",
"Areas",
"belonging",
"to",
"a",
"parent",
"-",
"list",
"all",
"child",
"areas",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L168-L180 |
135,355 | fabric8-services/fabric8-wit | area/area.go | Root | func (m *GormAreaRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "root"}, time.Now())
var rootArea []Area
rootArea, err := m.Query(FilterBySpaceID(spaceID), func(db *gorm.DB) *gorm.DB {
return db.Where("space_id = ? AND nlevel(path)=1"... | go | func (m *GormAreaRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Area, error) {
defer goa.MeasureSince([]string{"goa", "db", "Area", "root"}, time.Now())
var rootArea []Area
rootArea, err := m.Query(FilterBySpaceID(spaceID), func(db *gorm.DB) *gorm.DB {
return db.Where("space_id = ? AND nlevel(path)=1"... | [
"func",
"(",
"m",
"*",
"GormAreaRepository",
")",
"Root",
"(",
"ctx",
"context",
".",
"Context",
",",
"spaceID",
"uuid",
".",
"UUID",
")",
"(",
"*",
"Area",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
... | // Root fetches the Root Areas inside a space. | [
"Root",
"fetches",
"the",
"Root",
"Areas",
"inside",
"a",
"space",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L183-L198 |
135,356 | fabric8-services/fabric8-wit | area/area.go | FilterBySpaceID | func FilterBySpaceID(spaceID uuid.UUID) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("space_id = ?", spaceID)
}
} | go | func FilterBySpaceID(spaceID uuid.UUID) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("space_id = ?", spaceID)
}
} | [
"func",
"FilterBySpaceID",
"(",
"spaceID",
"uuid",
".",
"UUID",
")",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"... | // FilterBySpaceID is a gorm filter for a Belongs To relationship. | [
"FilterBySpaceID",
"is",
"a",
"gorm",
"filter",
"for",
"a",
"Belongs",
"To",
"relationship",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L218-L222 |
135,357 | fabric8-services/fabric8-wit | area/area.go | FilterByName | func FilterByName(name string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("name = ?", name).Limit(1)
}
} | go | func FilterByName(name string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("name = ?", name).Limit(1)
}
} | [
"func",
"FilterByName",
"(",
"name",
"string",
")",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"db",
".",
"Where"... | // FilterByName is a gorm filter by 'name' | [
"FilterByName",
"is",
"a",
"gorm",
"filter",
"by",
"name"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/area/area.go#L225-L229 |
135,358 | fabric8-services/fabric8-wit | controller/work_item_labels.go | NewWorkItemLabelsController | func NewWorkItemLabelsController(service *goa.Service, db application.DB, config WorkItemLabelsControllerConfiguration) *WorkItemLabelsController {
return &WorkItemLabelsController{
Controller: service.NewController("WorkItemLabelsController"),
db: db,
config: config,
}
} | go | func NewWorkItemLabelsController(service *goa.Service, db application.DB, config WorkItemLabelsControllerConfiguration) *WorkItemLabelsController {
return &WorkItemLabelsController{
Controller: service.NewController("WorkItemLabelsController"),
db: db,
config: config,
}
} | [
"func",
"NewWorkItemLabelsController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"WorkItemLabelsControllerConfiguration",
")",
"*",
"WorkItemLabelsController",
"{",
"return",
"&",
"WorkItemLabelsController",
"{",
"... | // NewWorkItemLabelsController creates a work_item_labels controller. | [
"NewWorkItemLabelsController",
"creates",
"a",
"work_item_labels",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/work_item_labels.go#L27-L33 |
135,359 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | String | func (s ImportHelper) String() string {
copy := s
bytes, err := yaml.Marshal(copy)
if err != nil {
log.Info(nil, map[string]interface{}{
"err": err,
}, "failed to marshal space template to YAML")
return ""
}
return string(bytes)
} | go | func (s ImportHelper) String() string {
copy := s
bytes, err := yaml.Marshal(copy)
if err != nil {
log.Info(nil, map[string]interface{}{
"err": err,
}, "failed to marshal space template to YAML")
return ""
}
return string(bytes)
} | [
"func",
"(",
"s",
"ImportHelper",
")",
"String",
"(",
")",
"string",
"{",
"copy",
":=",
"s",
"\n",
"bytes",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"copy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Info",
"(",
"nil",
",",
"m... | // String convert a parsed template into a string in YAML format | [
"String",
"convert",
"a",
"parsed",
"template",
"into",
"a",
"string",
"in",
"YAML",
"format"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L62-L72 |
135,360 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | FromString | func FromString(templ string) (*ImportHelper, error) {
var s ImportHelper
if err := yaml.Unmarshal([]byte(templ), &s); err != nil {
log.Info(nil, map[string]interface{}{
"template": templ,
"err": err,
}, "failed to unmarshal YAML space template")
return nil, errs.Wrapf(err, "failed to parse YAML spac... | go | func FromString(templ string) (*ImportHelper, error) {
var s ImportHelper
if err := yaml.Unmarshal([]byte(templ), &s); err != nil {
log.Info(nil, map[string]interface{}{
"template": templ,
"err": err,
}, "failed to unmarshal YAML space template")
return nil, errs.Wrapf(err, "failed to parse YAML spac... | [
"func",
"FromString",
"(",
"templ",
"string",
")",
"(",
"*",
"ImportHelper",
",",
"error",
")",
"{",
"var",
"s",
"ImportHelper",
"\n",
"if",
"err",
":=",
"yaml",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"templ",
")",
",",
"&",
"s",
")",
";",
... | // FromString parses a given string into a parsed template object and validates
// it. | [
"FromString",
"parses",
"a",
"given",
"string",
"into",
"a",
"parsed",
"template",
"object",
"and",
"validates",
"it",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L76-L95 |
135,361 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | SetID | func (s *ImportHelper) SetID(id uuid.UUID) {
s.Template.ID = id
for _, wit := range s.WITs {
wit.SpaceTemplateID = s.Template.ID
}
for _, wilt := range s.WILTs {
wilt.SpaceTemplateID = s.Template.ID
}
for _, witg := range s.WITGs {
witg.SpaceTemplateID = s.Template.ID
}
for _, wib := range s.WIBs {
wib.... | go | func (s *ImportHelper) SetID(id uuid.UUID) {
s.Template.ID = id
for _, wit := range s.WITs {
wit.SpaceTemplateID = s.Template.ID
}
for _, wilt := range s.WILTs {
wilt.SpaceTemplateID = s.Template.ID
}
for _, witg := range s.WITGs {
witg.SpaceTemplateID = s.Template.ID
}
for _, wib := range s.WIBs {
wib.... | [
"func",
"(",
"s",
"*",
"ImportHelper",
")",
"SetID",
"(",
"id",
"uuid",
".",
"UUID",
")",
"{",
"s",
".",
"Template",
".",
"ID",
"=",
"id",
"\n",
"for",
"_",
",",
"wit",
":=",
"range",
"s",
".",
"WITs",
"{",
"wit",
".",
"SpaceTemplateID",
"=",
"... | // SetID updates the space templates IDs and updates the references to that ID. | [
"SetID",
"updates",
"the",
"space",
"templates",
"IDs",
"and",
"updates",
"the",
"references",
"to",
"that",
"ID",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L98-L112 |
135,362 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | Equal | func (s ImportHelper) Equal(u convert.Equaler) bool {
other, ok := u.(ImportHelper)
if !ok {
return false
}
// test nested space template on equality
if !convert.CascadeEqual(s.Template, other.Template) {
return false
}
if len(s.WITs) != len(other.WITs) {
return false
}
for k := range s.WITs {
if other... | go | func (s ImportHelper) Equal(u convert.Equaler) bool {
other, ok := u.(ImportHelper)
if !ok {
return false
}
// test nested space template on equality
if !convert.CascadeEqual(s.Template, other.Template) {
return false
}
if len(s.WITs) != len(other.WITs) {
return false
}
for k := range s.WITs {
if other... | [
"func",
"(",
"s",
"ImportHelper",
")",
"Equal",
"(",
"u",
"convert",
".",
"Equaler",
")",
"bool",
"{",
"other",
",",
"ok",
":=",
"u",
".",
"(",
"ImportHelper",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"// test nested space... | // Equal returns true if two ImportHelper objects are equal; otherwise false is
// returned. | [
"Equal",
"returns",
"true",
"if",
"two",
"ImportHelper",
"objects",
"are",
"equal",
";",
"otherwise",
"false",
"is",
"returned",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L120-L174 |
135,363 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | BaseTemplate | func BaseTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("base.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load base template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemBaseTemplateID)
return s, nil
} | go | func BaseTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("base.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load base template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemBaseTemplateID)
return s, nil
} | [
"func",
"BaseTemplate",
"(",
")",
"(",
"*",
"ImportHelper",
",",
"error",
")",
"{",
"bs",
",",
"err",
":=",
"spacetemplate",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errs",
".",
"Wrap",
"(",
... | // BaseTemplate returns the base template | [
"BaseTemplate",
"returns",
"the",
"base",
"template"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L182-L193 |
135,364 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | LegacyTemplate | func LegacyTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("legacy.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load legacy template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemLegacyTemplateID)
return ... | go | func LegacyTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("legacy.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load legacy template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemLegacyTemplateID)
return ... | [
"func",
"LegacyTemplate",
"(",
")",
"(",
"*",
"ImportHelper",
",",
"error",
")",
"{",
"bs",
",",
"err",
":=",
"spacetemplate",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errs",
".",
"Wrap",
"(",
... | // LegacyTemplate returns the legacy template as it is known to the system | [
"LegacyTemplate",
"returns",
"the",
"legacy",
"template",
"as",
"it",
"is",
"known",
"to",
"the",
"system"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L196-L207 |
135,365 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | ScrumTemplate | func ScrumTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("scrum.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load scrum template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemScrumTemplateID)
return s, n... | go | func ScrumTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("scrum.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load scrum template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemScrumTemplateID)
return s, n... | [
"func",
"ScrumTemplate",
"(",
")",
"(",
"*",
"ImportHelper",
",",
"error",
")",
"{",
"bs",
",",
"err",
":=",
"spacetemplate",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errs",
".",
"Wrap",
"(",
... | // ScrumTemplate returns the scrum template as it is known to the system | [
"ScrumTemplate",
"returns",
"the",
"scrum",
"template",
"as",
"it",
"is",
"known",
"to",
"the",
"system"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L210-L221 |
135,366 | fabric8-services/fabric8-wit | spacetemplate/importer/import_helper.go | AgileTemplate | func AgileTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("agile.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load agile template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemAgileTemplateID)
return s, n... | go | func AgileTemplate() (*ImportHelper, error) {
bs, err := spacetemplate.Asset("agile.yaml")
if err != nil {
return nil, errs.Wrap(err, "failed to load agile template")
}
s, err := FromString(string(bs))
if err != nil {
return nil, errs.WithStack(err)
}
s.SetID(spacetemplate.SystemAgileTemplateID)
return s, n... | [
"func",
"AgileTemplate",
"(",
")",
"(",
"*",
"ImportHelper",
",",
"error",
")",
"{",
"bs",
",",
"err",
":=",
"spacetemplate",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errs",
".",
"Wrap",
"(",
... | // AgileTemplate returns the agile template as it is known to the system | [
"AgileTemplate",
"returns",
"the",
"agile",
"template",
"as",
"it",
"is",
"known",
"to",
"the",
"system"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/spacetemplate/importer/import_helper.go#L224-L235 |
135,367 | fabric8-services/fabric8-wit | controller/space_iterations.go | NewSpaceIterationsController | func NewSpaceIterationsController(service *goa.Service, db application.DB, config SpaceIterationsControllerConfiguration) *SpaceIterationsController {
return &SpaceIterationsController{Controller: service.NewController("SpaceIterationsController"), db: db, config: config}
} | go | func NewSpaceIterationsController(service *goa.Service, db application.DB, config SpaceIterationsControllerConfiguration) *SpaceIterationsController {
return &SpaceIterationsController{Controller: service.NewController("SpaceIterationsController"), db: db, config: config}
} | [
"func",
"NewSpaceIterationsController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"SpaceIterationsControllerConfiguration",
")",
"*",
"SpaceIterationsController",
"{",
"return",
"&",
"SpaceIterationsController",
"{",... | // NewSpaceIterationsController creates a space-iterations controller. | [
"NewSpaceIterationsController",
"creates",
"a",
"space",
"-",
"iterations",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/space_iterations.go#L31-L33 |
135,368 | fabric8-services/fabric8-wit | controller/space_areas.go | NewSpaceAreasController | func NewSpaceAreasController(service *goa.Service, db application.DB, config SpaceAreasControllerConfig) *SpaceAreasController {
return &SpaceAreasController{
Controller: service.NewController("SpaceAreasController"),
db: db,
config: config,
}
} | go | func NewSpaceAreasController(service *goa.Service, db application.DB, config SpaceAreasControllerConfig) *SpaceAreasController {
return &SpaceAreasController{
Controller: service.NewController("SpaceAreasController"),
db: db,
config: config,
}
} | [
"func",
"NewSpaceAreasController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"SpaceAreasControllerConfig",
")",
"*",
"SpaceAreasController",
"{",
"return",
"&",
"SpaceAreasController",
"{",
"Controller",
":",
"... | // NewSpaceAreasController creates a space-Areas controller. | [
"NewSpaceAreasController",
"creates",
"a",
"space",
"-",
"Areas",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/space_areas.go#L26-L32 |
135,369 | fabric8-services/fabric8-wit | workitem/number_sequence/workitem_number_sequence_repository.go | NextVal | func (r *GormWorkItemNumberSequenceRepository) NextVal(ctx context.Context, spaceID uuid.UUID) (*int, error) {
// upsert the next val, retrieves full row
upsertStmt := fmt.Sprintf(`INSERT INTO %[1]s (space_id, current_val) VALUES ($1,1)
ON CONFLICT (space_id) DO UPDATE SET current_val = %[1]s.current_val + EXCLUDED... | go | func (r *GormWorkItemNumberSequenceRepository) NextVal(ctx context.Context, spaceID uuid.UUID) (*int, error) {
// upsert the next val, retrieves full row
upsertStmt := fmt.Sprintf(`INSERT INTO %[1]s (space_id, current_val) VALUES ($1,1)
ON CONFLICT (space_id) DO UPDATE SET current_val = %[1]s.current_val + EXCLUDED... | [
"func",
"(",
"r",
"*",
"GormWorkItemNumberSequenceRepository",
")",
"NextVal",
"(",
"ctx",
"context",
".",
"Context",
",",
"spaceID",
"uuid",
".",
"UUID",
")",
"(",
"*",
"int",
",",
"error",
")",
"{",
"// upsert the next val, retrieves full row",
"upsertStmt",
"... | // NextVal returns the next work item sequence number for the given space ID. Creates an entry in the DB if none was found before | [
"NextVal",
"returns",
"the",
"next",
"work",
"item",
"sequence",
"number",
"for",
"the",
"given",
"space",
"ID",
".",
"Creates",
"an",
"entry",
"in",
"the",
"DB",
"if",
"none",
"was",
"found",
"before"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/number_sequence/workitem_number_sequence_repository.go#L30-L42 |
135,370 | fabric8-services/fabric8-wit | workitem/board.go | Equal | func (wib Board) Equal(u convert.Equaler) bool {
other, ok := u.(Board)
if !ok {
return false
}
if wib.ID != other.ID {
return false
}
if wib.SpaceTemplateID != other.SpaceTemplateID {
return false
}
if !convert.CascadeEqual(wib.Lifecycle, other.Lifecycle) {
return false
}
if wib.Name != other.Name {
... | go | func (wib Board) Equal(u convert.Equaler) bool {
other, ok := u.(Board)
if !ok {
return false
}
if wib.ID != other.ID {
return false
}
if wib.SpaceTemplateID != other.SpaceTemplateID {
return false
}
if !convert.CascadeEqual(wib.Lifecycle, other.Lifecycle) {
return false
}
if wib.Name != other.Name {
... | [
"func",
"(",
"wib",
"Board",
")",
"Equal",
"(",
"u",
"convert",
".",
"Equaler",
")",
"bool",
"{",
"other",
",",
"ok",
":=",
"u",
".",
"(",
"Board",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"wib",
".",
"ID",
"... | // Equal returns true if two Board objects are equal; otherwise false is returned. | [
"Equal",
"returns",
"true",
"if",
"two",
"Board",
"objects",
"are",
"equal",
";",
"otherwise",
"false",
"is",
"returned",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/board.go#L33-L68 |
135,371 | fabric8-services/fabric8-wit | workitem/board.go | Equal | func (wibc BoardColumn) Equal(u convert.Equaler) bool {
other, ok := u.(BoardColumn)
if !ok {
return false
}
if wibc.ID != other.ID {
return false
}
if wibc.BoardID != other.BoardID {
return false
}
if !convert.CascadeEqual(wibc.Lifecycle, other.Lifecycle) {
return false
}
if wibc.Name != other.Name {... | go | func (wibc BoardColumn) Equal(u convert.Equaler) bool {
other, ok := u.(BoardColumn)
if !ok {
return false
}
if wibc.ID != other.ID {
return false
}
if wibc.BoardID != other.BoardID {
return false
}
if !convert.CascadeEqual(wibc.Lifecycle, other.Lifecycle) {
return false
}
if wibc.Name != other.Name {... | [
"func",
"(",
"wibc",
"BoardColumn",
")",
"Equal",
"(",
"u",
"convert",
".",
"Equaler",
")",
"bool",
"{",
"other",
",",
"ok",
":=",
"u",
".",
"(",
"BoardColumn",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"wibc",
".... | // Equal returns true if two BoardColumn objects are equal; otherwise false is returned. | [
"Equal",
"returns",
"true",
"if",
"two",
"BoardColumn",
"objects",
"are",
"equal",
";",
"otherwise",
"false",
"is",
"returned",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/board.go#L111-L138 |
135,372 | fabric8-services/fabric8-wit | controller/user_service.go | Clean | func (c *UserServiceController) Clean(ctx *app.CleanUserServiceContext) error {
err := c.CleanTenant(ctx, ctx.Remove)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, err)
}
return ctx.OK([]byte{})
} | go | func (c *UserServiceController) Clean(ctx *app.CleanUserServiceContext) error {
err := c.CleanTenant(ctx, ctx.Remove)
if err != nil {
return jsonapi.JSONErrorResponse(ctx, err)
}
return ctx.OK([]byte{})
} | [
"func",
"(",
"c",
"*",
"UserServiceController",
")",
"Clean",
"(",
"ctx",
"*",
"app",
".",
"CleanUserServiceContext",
")",
"error",
"{",
"err",
":=",
"c",
".",
"CleanTenant",
"(",
"ctx",
",",
"ctx",
".",
"Remove",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Clean runs the clean action. | [
"Clean",
"runs",
"the",
"clean",
"action",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/user_service.go#L33-L39 |
135,373 | fabric8-services/fabric8-wit | account/user.go | PermanentDelete | func (m *GormUserRepository) PermanentDelete(ctx context.Context, ID uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "user", "permanent_delete"}, time.Now())
tx := m.db.Unscoped().Delete(&User{ID: ID})
if err := tx.Error; err != nil {
log.Error(ctx, map[string]interface{}{
"user_id": ID.String()... | go | func (m *GormUserRepository) PermanentDelete(ctx context.Context, ID uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "user", "permanent_delete"}, time.Now())
tx := m.db.Unscoped().Delete(&User{ID: ID})
if err := tx.Error; err != nil {
log.Error(ctx, map[string]interface{}{
"user_id": ID.String()... | [
"func",
"(",
"m",
"*",
"GormUserRepository",
")",
"PermanentDelete",
"(",
"ctx",
"context",
".",
"Context",
",",
"ID",
"uuid",
".",
"UUID",
")",
"error",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"... | // Delete removes a single record. This method use custom SQL to allow soft delete with GORM
// to coexist with permanent delete. | [
"Delete",
"removes",
"a",
"single",
"record",
".",
"This",
"method",
"use",
"custom",
"SQL",
"to",
"allow",
"soft",
"delete",
"with",
"GORM",
"to",
"coexist",
"with",
"permanent",
"delete",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/account/user.go#L195-L216 |
135,374 | fabric8-services/fabric8-wit | account/user.go | UserFilterByID | func UserFilterByID(userID uuid.UUID) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("id = ?", userID)
}
} | go | func UserFilterByID(userID uuid.UUID) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("id = ?", userID)
}
} | [
"func",
"UserFilterByID",
"(",
"userID",
"uuid",
".",
"UUID",
")",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"db... | // UserFilterByID is a gorm filter for User ID. | [
"UserFilterByID",
"is",
"a",
"gorm",
"filter",
"for",
"User",
"ID",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/account/user.go#L248-L252 |
135,375 | fabric8-services/fabric8-wit | account/user.go | UserFilterByEmail | func UserFilterByEmail(email string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("email = ?", email)
}
} | go | func UserFilterByEmail(email string) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
return db.Where("email = ?", email)
}
} | [
"func",
"UserFilterByEmail",
"(",
"email",
"string",
")",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"func",
"(",
"db",
"*",
"gorm",
".",
"DB",
")",
"*",
"gorm",
".",
"DB",
"{",
"return",
"db",
".",
"... | // UserFilterByEmail is a gorm filter for User ID. | [
"UserFilterByEmail",
"is",
"a",
"gorm",
"filter",
"for",
"User",
"ID",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/account/user.go#L255-L259 |
135,376 | fabric8-services/fabric8-wit | controller/iteration.go | NewIterationController | func NewIterationController(service *goa.Service, db application.DB, config IterationControllerConfiguration) *IterationController {
return &IterationController{Controller: service.NewController("IterationController"), db: db, config: config}
} | go | func NewIterationController(service *goa.Service, db application.DB, config IterationControllerConfiguration) *IterationController {
return &IterationController{Controller: service.NewController("IterationController"), db: db, config: config}
} | [
"func",
"NewIterationController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"IterationControllerConfiguration",
")",
"*",
"IterationController",
"{",
"return",
"&",
"IterationController",
"{",
"Controller",
":",
... | // NewIterationController creates a iteration controller. | [
"NewIterationController",
"creates",
"a",
"iteration",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L44-L46 |
135,377 | fabric8-services/fabric8-wit | controller/iteration.go | verifyUser | func verifyUser(ctx context.Context, currentUser uuid.UUID, sp *space.Space) (bool, bool, error) {
authorized, err := authz.Authorize(ctx, sp.ID.String())
if err != nil {
return false, false, err
}
var spaceOwner bool
if uuid.Equal(currentUser, sp.OwnerID) {
spaceOwner = true
}
return authorized, spaceOwner,... | go | func verifyUser(ctx context.Context, currentUser uuid.UUID, sp *space.Space) (bool, bool, error) {
authorized, err := authz.Authorize(ctx, sp.ID.String())
if err != nil {
return false, false, err
}
var spaceOwner bool
if uuid.Equal(currentUser, sp.OwnerID) {
spaceOwner = true
}
return authorized, spaceOwner,... | [
"func",
"verifyUser",
"(",
"ctx",
"context",
".",
"Context",
",",
"currentUser",
"uuid",
".",
"UUID",
",",
"sp",
"*",
"space",
".",
"Space",
")",
"(",
"bool",
",",
"bool",
",",
"error",
")",
"{",
"authorized",
",",
"err",
":=",
"authz",
".",
"Authori... | // verifyUser checks if user is a space owner or a collaborator | [
"verifyUser",
"checks",
"if",
"user",
"is",
"a",
"space",
"owner",
"or",
"a",
"collaborator"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L49-L59 |
135,378 | fabric8-services/fabric8-wit | controller/iteration.go | ConvertIterations | func ConvertIterations(request *http.Request, Iterations []iteration.Iteration, additional ...IterationConvertFunc) []*app.Iteration {
var is = []*app.Iteration{}
for _, i := range Iterations {
is = append(is, ConvertIteration(request, i, additional...))
}
return is
} | go | func ConvertIterations(request *http.Request, Iterations []iteration.Iteration, additional ...IterationConvertFunc) []*app.Iteration {
var is = []*app.Iteration{}
for _, i := range Iterations {
is = append(is, ConvertIteration(request, i, additional...))
}
return is
} | [
"func",
"ConvertIterations",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"Iterations",
"[",
"]",
"iteration",
".",
"Iteration",
",",
"additional",
"...",
"IterationConvertFunc",
")",
"[",
"]",
"*",
"app",
".",
"Iteration",
"{",
"var",
"is",
"=",
"[",... | // ConvertIterations converts between internal and external REST representation | [
"ConvertIterations",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L447-L453 |
135,379 | fabric8-services/fabric8-wit | controller/iteration.go | ConvertIteration | func ConvertIteration(request *http.Request, itr iteration.Iteration, additional ...IterationConvertFunc) *app.Iteration {
iterationType := iteration.APIStringTypeIteration
spaceID := itr.SpaceID.String()
relatedURL := rest.AbsoluteURL(request, app.IterationHref(itr.ID))
spaceRelatedURL := rest.AbsoluteURL(request,... | go | func ConvertIteration(request *http.Request, itr iteration.Iteration, additional ...IterationConvertFunc) *app.Iteration {
iterationType := iteration.APIStringTypeIteration
spaceID := itr.SpaceID.String()
relatedURL := rest.AbsoluteURL(request, app.IterationHref(itr.ID))
spaceRelatedURL := rest.AbsoluteURL(request,... | [
"func",
"ConvertIteration",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"itr",
"iteration",
".",
"Iteration",
",",
"additional",
"...",
"IterationConvertFunc",
")",
"*",
"app",
".",
"Iteration",
"{",
"iterationType",
":=",
"iteration",
".",
"APIStringTypeI... | // ConvertIteration converts between internal and external REST representation | [
"ConvertIteration",
"converts",
"between",
"internal",
"and",
"external",
"REST",
"representation"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L456-L520 |
135,380 | fabric8-services/fabric8-wit | controller/iteration.go | ConvertIterationSimple | func ConvertIterationSimple(request *http.Request, id interface{}) (*app.GenericData, *app.GenericLinks) {
t := iteration.APIStringTypeIteration
i := fmt.Sprint(id)
data := &app.GenericData{
Type: &t,
ID: &i,
}
relatedURL := rest.AbsoluteURL(request, app.IterationHref(i))
links := &app.GenericLinks{
Self:... | go | func ConvertIterationSimple(request *http.Request, id interface{}) (*app.GenericData, *app.GenericLinks) {
t := iteration.APIStringTypeIteration
i := fmt.Sprint(id)
data := &app.GenericData{
Type: &t,
ID: &i,
}
relatedURL := rest.AbsoluteURL(request, app.IterationHref(i))
links := &app.GenericLinks{
Self:... | [
"func",
"ConvertIterationSimple",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"id",
"interface",
"{",
"}",
")",
"(",
"*",
"app",
".",
"GenericData",
",",
"*",
"app",
".",
"GenericLinks",
")",
"{",
"t",
":=",
"iteration",
".",
"APIStringTypeIteration"... | // ConvertIterationSimple converts a simple Iteration ID into a Generic
// Relationship data+links element | [
"ConvertIterationSimple",
"converts",
"a",
"simple",
"Iteration",
"ID",
"into",
"a",
"Generic",
"Relationship",
"data",
"+",
"links",
"element"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L524-L537 |
135,381 | fabric8-services/fabric8-wit | controller/iteration.go | updateIterationsWithCounts | func updateIterationsWithCounts(wiCounts map[string]workitem.WICountsPerIteration) IterationConvertFunc {
return func(request *http.Request, itr *iteration.Iteration, appIteration *app.Iteration) {
var counts workitem.WICountsPerIteration
if _, ok := wiCounts[appIteration.ID.String()]; ok {
counts = wiCounts[ap... | go | func updateIterationsWithCounts(wiCounts map[string]workitem.WICountsPerIteration) IterationConvertFunc {
return func(request *http.Request, itr *iteration.Iteration, appIteration *app.Iteration) {
var counts workitem.WICountsPerIteration
if _, ok := wiCounts[appIteration.ID.String()]; ok {
counts = wiCounts[ap... | [
"func",
"updateIterationsWithCounts",
"(",
"wiCounts",
"map",
"[",
"string",
"]",
"workitem",
".",
"WICountsPerIteration",
")",
"IterationConvertFunc",
"{",
"return",
"func",
"(",
"request",
"*",
"http",
".",
"Request",
",",
"itr",
"*",
"iteration",
".",
"Iterat... | // updateIterationsWithCounts accepts map of 'iterationID to a workitem.WICountsPerIteration instance'.
// This function returns function of type IterationConvertFunc
// Inner function is able to access `wiCounts` in closure and it is responsible
// for adding 'closed' and 'total' count of WI in relationship's meta for... | [
"updateIterationsWithCounts",
"accepts",
"map",
"of",
"iterationID",
"to",
"a",
"workitem",
".",
"WICountsPerIteration",
"instance",
".",
"This",
"function",
"returns",
"function",
"of",
"type",
"IterationConvertFunc",
"Inner",
"function",
"is",
"able",
"to",
"access"... | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/iteration.go#L572-L592 |
135,382 | fabric8-services/fabric8-wit | workitem/link/link_revision_repository.go | Create | func (r *GormWorkItemLinkRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, l WorkItemLink) error {
log.Debug(nil, map[string]interface{}{
"modifier_id": modifierID,
"revision_type": revisionType,
}, "Storing a revision after operation on work item link.")
tx := r.... | go | func (r *GormWorkItemLinkRevisionRepository) Create(ctx context.Context, modifierID uuid.UUID, revisionType RevisionType, l WorkItemLink) error {
log.Debug(nil, map[string]interface{}{
"modifier_id": modifierID,
"revision_type": revisionType,
}, "Storing a revision after operation on work item link.")
tx := r.... | [
"func",
"(",
"r",
"*",
"GormWorkItemLinkRevisionRepository",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"modifierID",
"uuid",
".",
"UUID",
",",
"revisionType",
"RevisionType",
",",
"l",
"WorkItemLink",
")",
"error",
"{",
"log",
".",
"Debug",
... | // Create stores a new revision for the given work item link. | [
"Create",
"stores",
"a",
"new",
"revision",
"for",
"the",
"given",
"work",
"item",
"link",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/link/link_revision_repository.go#L35-L56 |
135,383 | fabric8-services/fabric8-wit | remoteworkitem/trackeritem_repository.go | Upload | func Upload(db *gorm.DB, tID uuid.UUID, item TrackerItemContent) error {
remoteID := item.ID
content := string(item.Content)
var ti TrackerItem
if db.Where("remote_item_id = ? AND tracker_id = ?", remoteID, tID).Find(&ti).RecordNotFound() {
ti = TrackerItem{
Item: content,
RemoteItemID: remoteID,
... | go | func Upload(db *gorm.DB, tID uuid.UUID, item TrackerItemContent) error {
remoteID := item.ID
content := string(item.Content)
var ti TrackerItem
if db.Where("remote_item_id = ? AND tracker_id = ?", remoteID, tID).Find(&ti).RecordNotFound() {
ti = TrackerItem{
Item: content,
RemoteItemID: remoteID,
... | [
"func",
"Upload",
"(",
"db",
"*",
"gorm",
".",
"DB",
",",
"tID",
"uuid",
".",
"UUID",
",",
"item",
"TrackerItemContent",
")",
"error",
"{",
"remoteID",
":=",
"item",
".",
"ID",
"\n",
"content",
":=",
"string",
"(",
"item",
".",
"Content",
")",
"\n\n"... | // Upload imports the items into database | [
"Upload",
"imports",
"the",
"items",
"into",
"database"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackeritem_repository.go#L19-L33 |
135,384 | fabric8-services/fabric8-wit | remoteworkitem/trackeritem_repository.go | ConvertToWorkItemModel | func ConvertToWorkItemModel(ctx context.Context, db *gorm.DB, item TrackerItemContent, tq TrackerSchedule) (*workitem.WorkItem, error) {
remoteID := item.ID
content := string(item.Content)
trackerItem := TrackerItem{Item: content, RemoteItemID: remoteID, TrackerID: tq.TrackerID}
// Converting the remote item to a l... | go | func ConvertToWorkItemModel(ctx context.Context, db *gorm.DB, item TrackerItemContent, tq TrackerSchedule) (*workitem.WorkItem, error) {
remoteID := item.ID
content := string(item.Content)
trackerItem := TrackerItem{Item: content, RemoteItemID: remoteID, TrackerID: tq.TrackerID}
// Converting the remote item to a l... | [
"func",
"ConvertToWorkItemModel",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"gorm",
".",
"DB",
",",
"item",
"TrackerItemContent",
",",
"tq",
"TrackerSchedule",
")",
"(",
"*",
"workitem",
".",
"WorkItem",
",",
"error",
")",
"{",
"remoteID",
":=... | // Map a remote work item into an WIT work item and persist it into the database. | [
"Map",
"a",
"remote",
"work",
"item",
"into",
"an",
"WIT",
"work",
"item",
"and",
"persist",
"it",
"into",
"the",
"database",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackeritem_repository.go#L36-L58 |
135,385 | fabric8-services/fabric8-wit | remoteworkitem/trackeritem_repository.go | setWorkItemFields | func setWorkItemFields(ctx context.Context, db *gorm.DB, remoteWorkItem RemoteWorkItem, tq TrackerSchedule) (*workitem.WorkItem, error) {
identityRepository := account.NewIdentityRepository(db)
//spaceSelfURL := rest.AbsoluteURL(goa.ContextRequest(ctx), app.SpaceHref(spaceID.String()))
workItem := workitem.WorkItem{... | go | func setWorkItemFields(ctx context.Context, db *gorm.DB, remoteWorkItem RemoteWorkItem, tq TrackerSchedule) (*workitem.WorkItem, error) {
identityRepository := account.NewIdentityRepository(db)
//spaceSelfURL := rest.AbsoluteURL(goa.ContextRequest(ctx), app.SpaceHref(spaceID.String()))
workItem := workitem.WorkItem{... | [
"func",
"setWorkItemFields",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"gorm",
".",
"DB",
",",
"remoteWorkItem",
"RemoteWorkItem",
",",
"tq",
"TrackerSchedule",
")",
"(",
"*",
"workitem",
".",
"WorkItem",
",",
"error",
")",
"{",
"identityReposit... | // setWorkItemFields retrieves data from remoteWorkItem structure and sets it to relevant fields in work item model | [
"setWorkItemFields",
"retrieves",
"data",
"from",
"remoteWorkItem",
"structure",
"and",
"sets",
"it",
"to",
"relevant",
"fields",
"in",
"work",
"item",
"model"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/trackeritem_repository.go#L61-L120 |
135,386 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | Load | func (r *GormWorkItemTypeRepository) Load(ctx context.Context, id uuid.UUID) (*WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "load"}, time.Now())
log.Debug(ctx, map[string]interface{}{
"wit_id": id,
}, "Loading work item type")
res, ok := cache.Get(id)
if !ok {
log.Info(ct... | go | func (r *GormWorkItemTypeRepository) Load(ctx context.Context, id uuid.UUID) (*WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "load"}, time.Now())
log.Debug(ctx, map[string]interface{}{
"wit_id": id,
}, "Loading work item type")
res, ok := cache.Get(id)
if !ok {
log.Info(ct... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"Load",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"uuid",
".",
"UUID",
")",
"(",
"*",
"WorkItemType",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string"... | // Load returns the work item for the given spaceID and id
// returns NotFoundError, InternalError | [
"Load",
"returns",
"the",
"work",
"item",
"for",
"the",
"given",
"spaceID",
"and",
"id",
"returns",
"NotFoundError",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L45-L75 |
135,387 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | Create | func (r *GormWorkItemTypeRepository) Create(ctx context.Context, spaceTemplateID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields FieldDefinitions, canConstruct bool) (*WorkItemType, error) {
wit := WorkItemType{
SpaceTemplateID: spaceTemplateID,
Name: ... | go | func (r *GormWorkItemTypeRepository) Create(ctx context.Context, spaceTemplateID uuid.UUID, id *uuid.UUID, extendedTypeID *uuid.UUID, name string, description *string, icon string, fields FieldDefinitions, canConstruct bool) (*WorkItemType, error) {
wit := WorkItemType{
SpaceTemplateID: spaceTemplateID,
Name: ... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"spaceTemplateID",
"uuid",
".",
"UUID",
",",
"id",
"*",
"uuid",
".",
"UUID",
",",
"extendedTypeID",
"*",
"uuid",
".",
"UUID",
",",
"name",
"st... | // Create creates a new work item type according to the given parameters. | [
"Create",
"creates",
"a",
"new",
"work",
"item",
"type",
"according",
"to",
"the",
"given",
"parameters",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L97-L115 |
135,388 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | CreateFromModel | func (r *GormWorkItemTypeRepository) CreateFromModel(ctx context.Context, model WorkItemType) (*WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "create"}, time.Now())
if model.ID == uuid.Nil {
model.ID = uuid.NewV4()
}
allFields := map[string]FieldDefinition{}
path := LtreeS... | go | func (r *GormWorkItemTypeRepository) CreateFromModel(ctx context.Context, model WorkItemType) (*WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "create"}, time.Now())
if model.ID == uuid.Nil {
model.ID = uuid.NewV4()
}
allFields := map[string]FieldDefinition{}
path := LtreeS... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"CreateFromModel",
"(",
"ctx",
"context",
".",
"Context",
",",
"model",
"WorkItemType",
")",
"(",
"*",
"WorkItemType",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"st... | // CreateFromModel creates a new work item type in the repository based on the
// given model of it. | [
"CreateFromModel",
"creates",
"a",
"new",
"work",
"item",
"type",
"in",
"the",
"repository",
"based",
"on",
"the",
"given",
"model",
"of",
"it",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L119-L161 |
135,389 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | ListPlannerItemTypes | func (r *GormWorkItemTypeRepository) ListPlannerItemTypes(ctx context.Context, spaceTemplateID uuid.UUID) ([]WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "listPlannerItemTypes"}, time.Now())
// check space template exists
if err := spacetemplate.NewRepository(r.db).CheckExists... | go | func (r *GormWorkItemTypeRepository) ListPlannerItemTypes(ctx context.Context, spaceTemplateID uuid.UUID) ([]WorkItemType, error) {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "listPlannerItemTypes"}, time.Now())
// check space template exists
if err := spacetemplate.NewRepository(r.db).CheckExists... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"ListPlannerItemTypes",
"(",
"ctx",
"context",
".",
"Context",
",",
"spaceTemplateID",
"uuid",
".",
"UUID",
")",
"(",
"[",
"]",
"WorkItemType",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSin... | // ListPlannerItemTypes returns work item types that derives from PlannerItem type | [
"ListPlannerItemTypes",
"returns",
"work",
"item",
"types",
"that",
"derives",
"from",
"PlannerItem",
"type"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L164-L190 |
135,390 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | AddChildTypes | func (r *GormWorkItemTypeRepository) AddChildTypes(ctx context.Context, parentTypeID uuid.UUID, childTypeIDs []uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "add_child_types"}, time.Now())
if len(childTypeIDs) <= 0 {
return nil
}
// Create entries for each child in the type list
... | go | func (r *GormWorkItemTypeRepository) AddChildTypes(ctx context.Context, parentTypeID uuid.UUID, childTypeIDs []uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "workitemtype", "add_child_types"}, time.Now())
if len(childTypeIDs) <= 0 {
return nil
}
// Create entries for each child in the type list
... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"AddChildTypes",
"(",
"ctx",
"context",
".",
"Context",
",",
"parentTypeID",
"uuid",
".",
"UUID",
",",
"childTypeIDs",
"[",
"]",
"uuid",
".",
"UUID",
")",
"error",
"{",
"defer",
"goa",
".",
"Measure... | // AddChildTypes adds the given child work item types to the parent work item
// type. | [
"AddChildTypes",
"adds",
"the",
"given",
"child",
"work",
"item",
"types",
"to",
"the",
"parent",
"work",
"item",
"type",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L235-L255 |
135,391 | fabric8-services/fabric8-wit | workitem/workitemtype_repository.go | loadChildTypeList | func (r *GormWorkItemTypeRepository) loadChildTypeList(ctx context.Context, parentTypeID uuid.UUID) ([]uuid.UUID, error) {
types := []ChildType{}
db := r.db.Model(&types).Where("parent_work_item_type_id=?", parentTypeID).Order("position ASC").Find(&types)
if db.RecordNotFound() {
log.Error(ctx, map[string]interfac... | go | func (r *GormWorkItemTypeRepository) loadChildTypeList(ctx context.Context, parentTypeID uuid.UUID) ([]uuid.UUID, error) {
types := []ChildType{}
db := r.db.Model(&types).Where("parent_work_item_type_id=?", parentTypeID).Order("position ASC").Find(&types)
if db.RecordNotFound() {
log.Error(ctx, map[string]interfac... | [
"func",
"(",
"r",
"*",
"GormWorkItemTypeRepository",
")",
"loadChildTypeList",
"(",
"ctx",
"context",
".",
"Context",
",",
"parentTypeID",
"uuid",
".",
"UUID",
")",
"(",
"[",
"]",
"uuid",
".",
"UUID",
",",
"error",
")",
"{",
"types",
":=",
"[",
"]",
"C... | // loadChildTypeList loads all child work item types associated with the given
// work item type | [
"loadChildTypeList",
"loads",
"all",
"child",
"work",
"item",
"types",
"associated",
"with",
"the",
"given",
"work",
"item",
"type"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/workitem/workitemtype_repository.go#L259-L274 |
135,392 | fabric8-services/fabric8-wit | remoteworkitem/tracker_repository.go | Create | func (r *GormTrackerRepository) Create(ctx context.Context, t *Tracker) error {
//URL Validation
isValid := govalidator.IsURL(t.URL)
if isValid != true {
return BadParameterError{parameter: "url", value: t.URL}
}
_, present := RemoteWorkItemImplRegistry[t.Type]
// Ensure we support this remote tracker.
if pre... | go | func (r *GormTrackerRepository) Create(ctx context.Context, t *Tracker) error {
//URL Validation
isValid := govalidator.IsURL(t.URL)
if isValid != true {
return BadParameterError{parameter: "url", value: t.URL}
}
_, present := RemoteWorkItemImplRegistry[t.Type]
// Ensure we support this remote tracker.
if pre... | [
"func",
"(",
"r",
"*",
"GormTrackerRepository",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"t",
"*",
"Tracker",
")",
"error",
"{",
"//URL Validation",
"isValid",
":=",
"govalidator",
".",
"IsURL",
"(",
"t",
".",
"URL",
")",
"\n",
"if",
... | // Create creates a new tracker configuration in the repository
// returns BadParameterError, ConversionError or InternalError | [
"Create",
"creates",
"a",
"new",
"tracker",
"configuration",
"in",
"the",
"repository",
"returns",
"BadParameterError",
"ConversionError",
"or",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/tracker_repository.go#L44-L64 |
135,393 | fabric8-services/fabric8-wit | remoteworkitem/tracker_repository.go | Save | func (r *GormTrackerRepository) Save(ctx context.Context, t *Tracker) (*Tracker, error) {
defer goa.MeasureSince([]string{"goa", "db", "tracker", "save"}, time.Now())
res := Tracker{}
tx := r.db.Where("id = ?", t.ID).Find(&res)
if tx.RecordNotFound() {
log.Error(ctx, map[string]interface{}{
"err": tx.Er... | go | func (r *GormTrackerRepository) Save(ctx context.Context, t *Tracker) (*Tracker, error) {
defer goa.MeasureSince([]string{"goa", "db", "tracker", "save"}, time.Now())
res := Tracker{}
tx := r.db.Where("id = ?", t.ID).Find(&res)
if tx.RecordNotFound() {
log.Error(ctx, map[string]interface{}{
"err": tx.Er... | [
"func",
"(",
"r",
"*",
"GormTrackerRepository",
")",
"Save",
"(",
"ctx",
"context",
".",
"Context",
",",
"t",
"*",
"Tracker",
")",
"(",
"*",
"Tracker",
",",
"error",
")",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
... | // Save updates the given tracker in storage.
// returns NotFoundError, ConversionError or InternalError | [
"Save",
"updates",
"the",
"given",
"tracker",
"in",
"storage",
".",
"returns",
"NotFoundError",
"ConversionError",
"or",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/tracker_repository.go#L107-L132 |
135,394 | fabric8-services/fabric8-wit | remoteworkitem/tracker_repository.go | Delete | func (r *GormTrackerRepository) Delete(ctx context.Context, ID uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "tracker", "delete"}, time.Now())
if ID == uuid.Nil {
log.Error(ctx, map[string]interface{}{
"err": errors.NewNotFoundError("tracker", ID.String()),
"tracker_id": ID.String(),
... | go | func (r *GormTrackerRepository) Delete(ctx context.Context, ID uuid.UUID) error {
defer goa.MeasureSince([]string{"goa", "db", "tracker", "delete"}, time.Now())
if ID == uuid.Nil {
log.Error(ctx, map[string]interface{}{
"err": errors.NewNotFoundError("tracker", ID.String()),
"tracker_id": ID.String(),
... | [
"func",
"(",
"r",
"*",
"GormTrackerRepository",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"ID",
"uuid",
".",
"UUID",
")",
"error",
"{",
"defer",
"goa",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
... | // Delete deletes the tracker with the given id
// returns NotFoundError or InternalError | [
"Delete",
"deletes",
"the",
"tracker",
"with",
"the",
"given",
"id",
"returns",
"NotFoundError",
"or",
"InternalError"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/remoteworkitem/tracker_repository.go#L136-L162 |
135,395 | fabric8-services/fabric8-wit | closeable/close.go | Close | func Close(ctx context.Context, c io.Closer) {
// need to verify that the value of the `c` interface if not nil, too
if c != nil && !reflect.ValueOf(c).IsNil() {
err := c.Close()
if err != nil {
log.Error(ctx, map[string]interface{}{"error": err.Error()}, "error while closing the resource")
}
}
} | go | func Close(ctx context.Context, c io.Closer) {
// need to verify that the value of the `c` interface if not nil, too
if c != nil && !reflect.ValueOf(c).IsNil() {
err := c.Close()
if err != nil {
log.Error(ctx, map[string]interface{}{"error": err.Error()}, "error while closing the resource")
}
}
} | [
"func",
"Close",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"io",
".",
"Closer",
")",
"{",
"// need to verify that the value of the `c` interface if not nil, too",
"if",
"c",
"!=",
"nil",
"&&",
"!",
"reflect",
".",
"ValueOf",
"(",
"c",
")",
".",
"IsNil",... | // Close closes the given resource and logs the error if something wrong happened | [
"Close",
"closes",
"the",
"given",
"resource",
"and",
"logs",
"the",
"error",
"if",
"something",
"wrong",
"happened"
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/closeable/close.go#L12-L21 |
135,396 | fabric8-services/fabric8-wit | controller/render.go | Render | func (c *RenderController) Render(ctx *app.RenderRenderContext) error {
content := ctx.Payload.Data.Attributes.Content
markup := ctx.Payload.Data.Attributes.Markup
if !rendering.IsMarkupSupported(markup) {
return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("Unsupported markup type", markup))
}
htm... | go | func (c *RenderController) Render(ctx *app.RenderRenderContext) error {
content := ctx.Payload.Data.Attributes.Content
markup := ctx.Payload.Data.Attributes.Markup
if !rendering.IsMarkupSupported(markup) {
return jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("Unsupported markup type", markup))
}
htm... | [
"func",
"(",
"c",
"*",
"RenderController",
")",
"Render",
"(",
"ctx",
"*",
"app",
".",
"RenderRenderContext",
")",
"error",
"{",
"content",
":=",
"ctx",
".",
"Payload",
".",
"Data",
".",
"Attributes",
".",
"Content",
"\n",
"markup",
":=",
"ctx",
".",
"... | // Render runs the render action. | [
"Render",
"runs",
"the",
"render",
"action",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/render.go#L28-L42 |
135,397 | fabric8-services/fabric8-wit | jsonapi/jsonapi_utility.go | ErrorToJSONAPIError | func ErrorToJSONAPIError(ctx context.Context, err error) (app.JSONAPIError, int) {
cause := errs.Cause(err)
detail := cause.Error()
var title, code string
var statusCode int
var id *string
log.Error(ctx, map[string]interface{}{"err": cause, "error_message": cause.Error(), "err_type": reflect.TypeOf(cause)}, "an e... | go | func ErrorToJSONAPIError(ctx context.Context, err error) (app.JSONAPIError, int) {
cause := errs.Cause(err)
detail := cause.Error()
var title, code string
var statusCode int
var id *string
log.Error(ctx, map[string]interface{}{"err": cause, "error_message": cause.Error(), "err_type": reflect.TypeOf(cause)}, "an e... | [
"func",
"ErrorToJSONAPIError",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"(",
"app",
".",
"JSONAPIError",
",",
"int",
")",
"{",
"cause",
":=",
"errs",
".",
"Cause",
"(",
"err",
")",
"\n",
"detail",
":=",
"cause",
".",
"Error",
... | // ErrorToJSONAPIError returns the JSONAPI representation
// of an error and the HTTP status code that will be associated with it.
// This function knows about the models package and the errors from there
// as well as goa error classes. | [
"ErrorToJSONAPIError",
"returns",
"the",
"JSONAPI",
"representation",
"of",
"an",
"error",
"and",
"the",
"HTTP",
"status",
"code",
"that",
"will",
"be",
"associated",
"with",
"it",
".",
"This",
"function",
"knows",
"about",
"the",
"models",
"package",
"and",
"... | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/jsonapi/jsonapi_utility.go#L37-L103 |
135,398 | fabric8-services/fabric8-wit | jsonapi/jsonapi_utility.go | ErrorToJSONAPIErrors | func ErrorToJSONAPIErrors(ctx context.Context, err error) (*app.JSONAPIErrors, int) {
jerr, httpStatusCode := ErrorToJSONAPIError(ctx, err)
jerrors := app.JSONAPIErrors{}
jerrors.Errors = append(jerrors.Errors, &jerr)
return &jerrors, httpStatusCode
} | go | func ErrorToJSONAPIErrors(ctx context.Context, err error) (*app.JSONAPIErrors, int) {
jerr, httpStatusCode := ErrorToJSONAPIError(ctx, err)
jerrors := app.JSONAPIErrors{}
jerrors.Errors = append(jerrors.Errors, &jerr)
return &jerrors, httpStatusCode
} | [
"func",
"ErrorToJSONAPIErrors",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"(",
"*",
"app",
".",
"JSONAPIErrors",
",",
"int",
")",
"{",
"jerr",
",",
"httpStatusCode",
":=",
"ErrorToJSONAPIError",
"(",
"ctx",
",",
"err",
")",
"\n",
"... | // ErrorToJSONAPIErrors is a convenience function if you
// just want to return one error from the models package as a JSONAPI errors
// array. | [
"ErrorToJSONAPIErrors",
"is",
"a",
"convenience",
"function",
"if",
"you",
"just",
"want",
"to",
"return",
"one",
"error",
"from",
"the",
"models",
"package",
"as",
"a",
"JSONAPI",
"errors",
"array",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/jsonapi/jsonapi_utility.go#L108-L113 |
135,399 | fabric8-services/fabric8-wit | controller/workitems.go | NewWorkitemsController | func NewWorkitemsController(service *goa.Service, db application.DB, config WorkItemControllerConfig) *WorkitemsController {
return NewNotifyingWorkitemsController(service, db, ¬ification.DevNullChannel{}, config)
} | go | func NewWorkitemsController(service *goa.Service, db application.DB, config WorkItemControllerConfig) *WorkitemsController {
return NewNotifyingWorkitemsController(service, db, ¬ification.DevNullChannel{}, config)
} | [
"func",
"NewWorkitemsController",
"(",
"service",
"*",
"goa",
".",
"Service",
",",
"db",
"application",
".",
"DB",
",",
"config",
"WorkItemControllerConfig",
")",
"*",
"WorkitemsController",
"{",
"return",
"NewNotifyingWorkitemsController",
"(",
"service",
",",
"db"... | // NewWorkitemsController creates a workitems controller. | [
"NewWorkitemsController",
"creates",
"a",
"workitems",
"controller",
"."
] | 54759c80c42ff2cf29b352e0f6c9330ce4ad7fce | https://github.com/fabric8-services/fabric8-wit/blob/54759c80c42ff2cf29b352e0f6c9330ce4ad7fce/controller/workitems.go#L35-L37 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.