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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
faiface/pixel | text/text.go | DrawColorMask | func (txt *Text) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color) {
if matrix != txt.mat {
txt.mat = matrix
txt.dirty = true
}
if mask == nil {
mask = pixel.Alpha(1)
}
rgba := pixel.ToRGBA(mask)
if rgba != txt.col {
txt.col = rgba
txt.dirty = true
}
if txt.dirty {
txt.trans.SetL... | go | func (txt *Text) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color) {
if matrix != txt.mat {
txt.mat = matrix
txt.dirty = true
}
if mask == nil {
mask = pixel.Alpha(1)
}
rgba := pixel.ToRGBA(mask)
if rgba != txt.col {
txt.col = rgba
txt.dirty = true
}
if txt.dirty {
txt.trans.SetL... | [
"func",
"(",
"txt",
"*",
"Text",
")",
"DrawColorMask",
"(",
"t",
"pixel",
".",
"Target",
",",
"matrix",
"pixel",
".",
"Matrix",
",",
"mask",
"color",
".",
"Color",
")",
"{",
"if",
"matrix",
"!=",
"txt",
".",
"mat",
"{",
"txt",
".",
"mat",
"=",
"m... | // DrawColorMask draws all text written to the Text to the provided Target. The text is transformed
// by the provided Matrix and masked by the provided color mask.
//
// If there's a lot of text written to the Text, changing a matrix or a color mask often might hurt
// performance. Consider using your Target's SetMatr... | [
"DrawColorMask",
"draws",
"all",
"text",
"written",
"to",
"the",
"Text",
"to",
"the",
"provided",
"Target",
".",
"The",
"text",
"is",
"transformed",
"by",
"the",
"provided",
"Matrix",
"and",
"masked",
"by",
"the",
"provided",
"color",
"mask",
".",
"If",
"t... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/text.go#L242-L270 | train |
faiface/pixel | data.go | Slice | func (td *TrianglesData) Slice(i, j int) Triangles {
s := TrianglesData((*td)[i:j])
return &s
} | go | func (td *TrianglesData) Slice(i, j int) Triangles {
s := TrianglesData((*td)[i:j])
return &s
} | [
"func",
"(",
"td",
"*",
"TrianglesData",
")",
"Slice",
"(",
"i",
",",
"j",
"int",
")",
"Triangles",
"{",
"s",
":=",
"TrianglesData",
"(",
"(",
"*",
"td",
")",
"[",
"i",
":",
"j",
"]",
")",
"\n",
"return",
"&",
"s",
"\n",
"}"
] | // Slice returns a sub-Triangles of this TrianglesData. | [
"Slice",
"returns",
"a",
"sub",
"-",
"Triangles",
"of",
"this",
"TrianglesData",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L64-L67 | train |
faiface/pixel | data.go | Update | func (td *TrianglesData) Update(t Triangles) {
if td.Len() != t.Len() {
panic(fmt.Errorf("(%T).Update: invalid triangles length", td))
}
td.updateData(t)
} | go | func (td *TrianglesData) Update(t Triangles) {
if td.Len() != t.Len() {
panic(fmt.Errorf("(%T).Update: invalid triangles length", td))
}
td.updateData(t)
} | [
"func",
"(",
"td",
"*",
"TrianglesData",
")",
"Update",
"(",
"t",
"Triangles",
")",
"{",
"if",
"td",
".",
"Len",
"(",
")",
"!=",
"t",
".",
"Len",
"(",
")",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"td",
")",
")",
"\n",
... | // Update copies vertex properties from the supplied Triangles into this TrianglesData.
//
// TrianglesPosition, TrianglesColor and TrianglesTexture are supported. | [
"Update",
"copies",
"vertex",
"properties",
"from",
"the",
"supplied",
"Triangles",
"into",
"this",
"TrianglesData",
".",
"TrianglesPosition",
"TrianglesColor",
"and",
"TrianglesTexture",
"are",
"supported",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L97-L102 | train |
faiface/pixel | data.go | Copy | func (td *TrianglesData) Copy() Triangles {
copyTd := MakeTrianglesData(td.Len())
copyTd.Update(td)
return copyTd
} | go | func (td *TrianglesData) Copy() Triangles {
copyTd := MakeTrianglesData(td.Len())
copyTd.Update(td)
return copyTd
} | [
"func",
"(",
"td",
"*",
"TrianglesData",
")",
"Copy",
"(",
")",
"Triangles",
"{",
"copyTd",
":=",
"MakeTrianglesData",
"(",
"td",
".",
"Len",
"(",
")",
")",
"\n",
"copyTd",
".",
"Update",
"(",
"td",
")",
"\n",
"return",
"copyTd",
"\n",
"}"
] | // Copy returns an exact independent copy of this TrianglesData. | [
"Copy",
"returns",
"an",
"exact",
"independent",
"copy",
"of",
"this",
"TrianglesData",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L105-L109 | train |
faiface/pixel | data.go | Picture | func (td *TrianglesData) Picture(i int) (pic Vec, intensity float64) {
return (*td)[i].Picture, (*td)[i].Intensity
} | go | func (td *TrianglesData) Picture(i int) (pic Vec, intensity float64) {
return (*td)[i].Picture, (*td)[i].Intensity
} | [
"func",
"(",
"td",
"*",
"TrianglesData",
")",
"Picture",
"(",
"i",
"int",
")",
"(",
"pic",
"Vec",
",",
"intensity",
"float64",
")",
"{",
"return",
"(",
"*",
"td",
")",
"[",
"i",
"]",
".",
"Picture",
",",
"(",
"*",
"td",
")",
"[",
"i",
"]",
".... | // Picture returns the picture property of i-th vertex. | [
"Picture",
"returns",
"the",
"picture",
"property",
"of",
"i",
"-",
"th",
"vertex",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L122-L124 | train |
faiface/pixel | data.go | MakePictureData | func MakePictureData(rect Rect) *PictureData {
w := int(math.Ceil(rect.Max.X)) - int(math.Floor(rect.Min.X))
h := int(math.Ceil(rect.Max.Y)) - int(math.Floor(rect.Min.Y))
pd := &PictureData{
Stride: w,
Rect: rect,
}
pd.Pix = make([]color.RGBA, w*h)
return pd
} | go | func MakePictureData(rect Rect) *PictureData {
w := int(math.Ceil(rect.Max.X)) - int(math.Floor(rect.Min.X))
h := int(math.Ceil(rect.Max.Y)) - int(math.Floor(rect.Min.Y))
pd := &PictureData{
Stride: w,
Rect: rect,
}
pd.Pix = make([]color.RGBA, w*h)
return pd
} | [
"func",
"MakePictureData",
"(",
"rect",
"Rect",
")",
"*",
"PictureData",
"{",
"w",
":=",
"int",
"(",
"math",
".",
"Ceil",
"(",
"rect",
".",
"Max",
".",
"X",
")",
")",
"-",
"int",
"(",
"math",
".",
"Floor",
"(",
"rect",
".",
"Min",
".",
"X",
")"... | // MakePictureData creates a zero-initialized PictureData covering the given rectangle. | [
"MakePictureData",
"creates",
"a",
"zero",
"-",
"initialized",
"PictureData",
"covering",
"the",
"given",
"rectangle",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L144-L153 | train |
faiface/pixel | data.go | PictureDataFromImage | func PictureDataFromImage(img image.Image) *PictureData {
rgba := image.NewRGBA(img.Bounds())
draw.Draw(rgba, rgba.Bounds(), img, img.Bounds().Min, draw.Src)
verticalFlip(rgba)
pd := MakePictureData(R(
float64(rgba.Bounds().Min.X),
float64(rgba.Bounds().Min.Y),
float64(rgba.Bounds().Max.X),
float64(rgba.B... | go | func PictureDataFromImage(img image.Image) *PictureData {
rgba := image.NewRGBA(img.Bounds())
draw.Draw(rgba, rgba.Bounds(), img, img.Bounds().Min, draw.Src)
verticalFlip(rgba)
pd := MakePictureData(R(
float64(rgba.Bounds().Min.X),
float64(rgba.Bounds().Min.Y),
float64(rgba.Bounds().Max.X),
float64(rgba.B... | [
"func",
"PictureDataFromImage",
"(",
"img",
"image",
".",
"Image",
")",
"*",
"PictureData",
"{",
"rgba",
":=",
"image",
".",
"NewRGBA",
"(",
"img",
".",
"Bounds",
"(",
")",
")",
"\n",
"draw",
".",
"Draw",
"(",
"rgba",
",",
"rgba",
".",
"Bounds",
"(",... | // PictureDataFromImage converts an image.Image into PictureData.
//
// The resulting PictureData's Bounds will be the equivalent of the supplied image.Image's Bounds. | [
"PictureDataFromImage",
"converts",
"an",
"image",
".",
"Image",
"into",
"PictureData",
".",
"The",
"resulting",
"PictureData",
"s",
"Bounds",
"will",
"be",
"the",
"equivalent",
"of",
"the",
"supplied",
"image",
".",
"Image",
"s",
"Bounds",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L173-L194 | train |
faiface/pixel | data.go | Image | func (pd *PictureData) Image() *image.RGBA {
bounds := image.Rect(
int(math.Floor(pd.Rect.Min.X)),
int(math.Floor(pd.Rect.Min.Y)),
int(math.Ceil(pd.Rect.Max.X)),
int(math.Ceil(pd.Rect.Max.Y)),
)
rgba := image.NewRGBA(bounds)
i := 0
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
for x := bounds.Min.X; x ... | go | func (pd *PictureData) Image() *image.RGBA {
bounds := image.Rect(
int(math.Floor(pd.Rect.Min.X)),
int(math.Floor(pd.Rect.Min.Y)),
int(math.Ceil(pd.Rect.Max.X)),
int(math.Ceil(pd.Rect.Max.Y)),
)
rgba := image.NewRGBA(bounds)
i := 0
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
for x := bounds.Min.X; x ... | [
"func",
"(",
"pd",
"*",
"PictureData",
")",
"Image",
"(",
")",
"*",
"image",
".",
"RGBA",
"{",
"bounds",
":=",
"image",
".",
"Rect",
"(",
"int",
"(",
"math",
".",
"Floor",
"(",
"pd",
".",
"Rect",
".",
"Min",
".",
"X",
")",
")",
",",
"int",
"(... | // Image converts PictureData into an image.RGBA.
//
// The resulting image.RGBA's Bounds will be equivalent of the PictureData's Bounds. | [
"Image",
"converts",
"PictureData",
"into",
"an",
"image",
".",
"RGBA",
".",
"The",
"resulting",
"image",
".",
"RGBA",
"s",
"Bounds",
"will",
"be",
"equivalent",
"of",
"the",
"PictureData",
"s",
"Bounds",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L233-L257 | train |
faiface/pixel | data.go | Index | func (pd *PictureData) Index(at Vec) int {
at = at.Sub(pd.Rect.Min.Map(math.Floor))
x, y := int(at.X), int(at.Y)
return y*pd.Stride + x
} | go | func (pd *PictureData) Index(at Vec) int {
at = at.Sub(pd.Rect.Min.Map(math.Floor))
x, y := int(at.X), int(at.Y)
return y*pd.Stride + x
} | [
"func",
"(",
"pd",
"*",
"PictureData",
")",
"Index",
"(",
"at",
"Vec",
")",
"int",
"{",
"at",
"=",
"at",
".",
"Sub",
"(",
"pd",
".",
"Rect",
".",
"Min",
".",
"Map",
"(",
"math",
".",
"Floor",
")",
")",
"\n",
"x",
",",
"y",
":=",
"int",
"(",... | // Index returns the index of the pixel at the specified position inside the Pix slice. | [
"Index",
"returns",
"the",
"index",
"of",
"the",
"pixel",
"at",
"the",
"specified",
"position",
"inside",
"the",
"Pix",
"slice",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L260-L264 | train |
faiface/pixel | data.go | Color | func (pd *PictureData) Color(at Vec) RGBA {
if !pd.Rect.Contains(at) {
return RGBA{0, 0, 0, 0}
}
return ToRGBA(pd.Pix[pd.Index(at)])
} | go | func (pd *PictureData) Color(at Vec) RGBA {
if !pd.Rect.Contains(at) {
return RGBA{0, 0, 0, 0}
}
return ToRGBA(pd.Pix[pd.Index(at)])
} | [
"func",
"(",
"pd",
"*",
"PictureData",
")",
"Color",
"(",
"at",
"Vec",
")",
"RGBA",
"{",
"if",
"!",
"pd",
".",
"Rect",
".",
"Contains",
"(",
"at",
")",
"{",
"return",
"RGBA",
"{",
"0",
",",
"0",
",",
"0",
",",
"0",
"}",
"\n",
"}",
"\n",
"re... | // Color returns the color located at the given position. | [
"Color",
"returns",
"the",
"color",
"located",
"at",
"the",
"given",
"position",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/data.go#L272-L277 | train |
graph-gophers/graphql-go | introspection.go | ToJSON | func (s *Schema) ToJSON() ([]byte, error) {
result := s.exec(context.Background(), introspectionQuery, "", nil, &resolvable.Schema{
Query: &resolvable.Object{},
Schema: *s.schema,
})
if len(result.Errors) != 0 {
panic(result.Errors[0])
}
return json.MarshalIndent(result.Data, "", "\t")
} | go | func (s *Schema) ToJSON() ([]byte, error) {
result := s.exec(context.Background(), introspectionQuery, "", nil, &resolvable.Schema{
Query: &resolvable.Object{},
Schema: *s.schema,
})
if len(result.Errors) != 0 {
panic(result.Errors[0])
}
return json.MarshalIndent(result.Data, "", "\t")
} | [
"func",
"(",
"s",
"*",
"Schema",
")",
"ToJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"result",
":=",
"s",
".",
"exec",
"(",
"context",
".",
"Background",
"(",
")",
",",
"introspectionQuery",
",",
"\"",
"\"",
",",
"nil",
",",
... | // ToJSON encodes the schema in a JSON format used by tools like Relay. | [
"ToJSON",
"encodes",
"the",
"schema",
"in",
"a",
"JSON",
"format",
"used",
"by",
"tools",
"like",
"Relay",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/introspection.go#L17-L26 | train |
graph-gophers/graphql-go | graphql.go | MustParseSchema | func MustParseSchema(schemaString string, resolver interface{}, opts ...SchemaOpt) *Schema {
s, err := ParseSchema(schemaString, resolver, opts...)
if err != nil {
panic(err)
}
return s
} | go | func MustParseSchema(schemaString string, resolver interface{}, opts ...SchemaOpt) *Schema {
s, err := ParseSchema(schemaString, resolver, opts...)
if err != nil {
panic(err)
}
return s
} | [
"func",
"MustParseSchema",
"(",
"schemaString",
"string",
",",
"resolver",
"interface",
"{",
"}",
",",
"opts",
"...",
"SchemaOpt",
")",
"*",
"Schema",
"{",
"s",
",",
"err",
":=",
"ParseSchema",
"(",
"schemaString",
",",
"resolver",
",",
"opts",
"...",
")",... | // MustParseSchema calls ParseSchema and panics on error. | [
"MustParseSchema",
"calls",
"ParseSchema",
"and",
"panics",
"on",
"error",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/graphql.go#L52-L58 | train |
graph-gophers/graphql-go | graphql.go | Tracer | func Tracer(tracer trace.Tracer) SchemaOpt {
return func(s *Schema) {
s.tracer = tracer
}
} | go | func Tracer(tracer trace.Tracer) SchemaOpt {
return func(s *Schema) {
s.tracer = tracer
}
} | [
"func",
"Tracer",
"(",
"tracer",
"trace",
".",
"Tracer",
")",
"SchemaOpt",
"{",
"return",
"func",
"(",
"s",
"*",
"Schema",
")",
"{",
"s",
".",
"tracer",
"=",
"tracer",
"\n",
"}",
"\n",
"}"
] | // Tracer is used to trace queries and fields. It defaults to trace.OpenTracingTracer. | [
"Tracer",
"is",
"used",
"to",
"trace",
"queries",
"and",
"fields",
".",
"It",
"defaults",
"to",
"trace",
".",
"OpenTracingTracer",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/graphql.go#L109-L113 | train |
graph-gophers/graphql-go | graphql.go | ValidationTracer | func ValidationTracer(tracer trace.ValidationTracer) SchemaOpt {
return func(s *Schema) {
s.validationTracer = tracer
}
} | go | func ValidationTracer(tracer trace.ValidationTracer) SchemaOpt {
return func(s *Schema) {
s.validationTracer = tracer
}
} | [
"func",
"ValidationTracer",
"(",
"tracer",
"trace",
".",
"ValidationTracer",
")",
"SchemaOpt",
"{",
"return",
"func",
"(",
"s",
"*",
"Schema",
")",
"{",
"s",
".",
"validationTracer",
"=",
"tracer",
"\n",
"}",
"\n",
"}"
] | // ValidationTracer is used to trace validation errors. It defaults to trace.NoopValidationTracer. | [
"ValidationTracer",
"is",
"used",
"to",
"trace",
"validation",
"errors",
".",
"It",
"defaults",
"to",
"trace",
".",
"NoopValidationTracer",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/graphql.go#L116-L120 | train |
graph-gophers/graphql-go | graphql.go | Logger | func Logger(logger log.Logger) SchemaOpt {
return func(s *Schema) {
s.logger = logger
}
} | go | func Logger(logger log.Logger) SchemaOpt {
return func(s *Schema) {
s.logger = logger
}
} | [
"func",
"Logger",
"(",
"logger",
"log",
".",
"Logger",
")",
"SchemaOpt",
"{",
"return",
"func",
"(",
"s",
"*",
"Schema",
")",
"{",
"s",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger is used to log panics during query execution. It defaults to exec.DefaultLogger. | [
"Logger",
"is",
"used",
"to",
"log",
"panics",
"during",
"query",
"execution",
".",
"It",
"defaults",
"to",
"exec",
".",
"DefaultLogger",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/graphql.go#L123-L127 | train |
graph-gophers/graphql-go | graphql.go | Validate | func (s *Schema) Validate(queryString string) []*errors.QueryError {
doc, qErr := query.Parse(queryString)
if qErr != nil {
return []*errors.QueryError{qErr}
}
return validation.Validate(s.schema, doc, s.maxDepth)
} | go | func (s *Schema) Validate(queryString string) []*errors.QueryError {
doc, qErr := query.Parse(queryString)
if qErr != nil {
return []*errors.QueryError{qErr}
}
return validation.Validate(s.schema, doc, s.maxDepth)
} | [
"func",
"(",
"s",
"*",
"Schema",
")",
"Validate",
"(",
"queryString",
"string",
")",
"[",
"]",
"*",
"errors",
".",
"QueryError",
"{",
"doc",
",",
"qErr",
":=",
"query",
".",
"Parse",
"(",
"queryString",
")",
"\n",
"if",
"qErr",
"!=",
"nil",
"{",
"r... | // Validate validates the given query with the schema. | [
"Validate",
"validates",
"the",
"given",
"query",
"with",
"the",
"schema",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/graphql.go#L146-L153 | train |
graph-gophers/graphql-go | time.go | UnmarshalGraphQL | func (t *Time) UnmarshalGraphQL(input interface{}) error {
switch input := input.(type) {
case time.Time:
t.Time = input
return nil
case string:
var err error
t.Time, err = time.Parse(time.RFC3339, input)
return err
case int:
t.Time = time.Unix(int64(input), 0)
return nil
case float64:
t.Time = tim... | go | func (t *Time) UnmarshalGraphQL(input interface{}) error {
switch input := input.(type) {
case time.Time:
t.Time = input
return nil
case string:
var err error
t.Time, err = time.Parse(time.RFC3339, input)
return err
case int:
t.Time = time.Unix(int64(input), 0)
return nil
case float64:
t.Time = tim... | [
"func",
"(",
"t",
"*",
"Time",
")",
"UnmarshalGraphQL",
"(",
"input",
"interface",
"{",
"}",
")",
"error",
"{",
"switch",
"input",
":=",
"input",
".",
"(",
"type",
")",
"{",
"case",
"time",
".",
"Time",
":",
"t",
".",
"Time",
"=",
"input",
"\n",
... | // UnmarshalGraphQL is a custom unmarshaler for Time
//
// This function will be called whenever you use the
// time scalar as an input | [
"UnmarshalGraphQL",
"is",
"a",
"custom",
"unmarshaler",
"for",
"Time",
"This",
"function",
"will",
"be",
"called",
"whenever",
"you",
"use",
"the",
"time",
"scalar",
"as",
"an",
"input"
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/time.go#L25-L43 | train |
graph-gophers/graphql-go | internal/schema/schema.go | Resolve | func (s *Schema) Resolve(name string) common.Type {
return s.Types[name]
} | go | func (s *Schema) Resolve(name string) common.Type {
return s.Types[name]
} | [
"func",
"(",
"s",
"*",
"Schema",
")",
"Resolve",
"(",
"name",
"string",
")",
"common",
".",
"Type",
"{",
"return",
"s",
".",
"Types",
"[",
"name",
"]",
"\n",
"}"
] | // Resolve a named type in the schema by its name. | [
"Resolve",
"a",
"named",
"type",
"in",
"the",
"schema",
"by",
"its",
"name",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/internal/schema/schema.go#L53-L55 | train |
graph-gophers/graphql-go | internal/schema/schema.go | Get | func (l FieldList) Get(name string) *Field {
for _, f := range l {
if f.Name == name {
return f
}
}
return nil
} | go | func (l FieldList) Get(name string) *Field {
for _, f := range l {
if f.Name == name {
return f
}
}
return nil
} | [
"func",
"(",
"l",
"FieldList",
")",
"Get",
"(",
"name",
"string",
")",
"*",
"Field",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"l",
"{",
"if",
"f",
".",
"Name",
"==",
"name",
"{",
"return",
"f",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\... | // Get iterates over the field list, returning a pointer-to-Field when the field name matches the
// provided `name` argument.
// Returns nil when no field was found by that name. | [
"Get",
"iterates",
"over",
"the",
"field",
"list",
"returning",
"a",
"pointer",
"-",
"to",
"-",
"Field",
"when",
"the",
"field",
"name",
"matches",
"the",
"provided",
"name",
"argument",
".",
"Returns",
"nil",
"when",
"no",
"field",
"was",
"found",
"by",
... | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/internal/schema/schema.go#L170-L177 | train |
graph-gophers/graphql-go | internal/schema/schema.go | Names | func (l FieldList) Names() []string {
names := make([]string, len(l))
for i, f := range l {
names[i] = f.Name
}
return names
} | go | func (l FieldList) Names() []string {
names := make([]string, len(l))
for i, f := range l {
names[i] = f.Name
}
return names
} | [
"func",
"(",
"l",
"FieldList",
")",
"Names",
"(",
")",
"[",
"]",
"string",
"{",
"names",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"l",
")",
")",
"\n",
"for",
"i",
",",
"f",
":=",
"range",
"l",
"{",
"names",
"[",
"i",
"]",
"="... | // Names returns a string slice of the field names in the FieldList. | [
"Names",
"returns",
"a",
"string",
"slice",
"of",
"the",
"field",
"names",
"in",
"the",
"FieldList",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/internal/schema/schema.go#L180-L186 | train |
graph-gophers/graphql-go | internal/schema/schema.go | New | func New() *Schema {
s := &Schema{
entryPointNames: make(map[string]string),
Types: make(map[string]NamedType),
Directives: make(map[string]*DirectiveDecl),
}
for n, t := range Meta.Types {
s.Types[n] = t
}
for n, d := range Meta.Directives {
s.Directives[n] = d
}
return s
} | go | func New() *Schema {
s := &Schema{
entryPointNames: make(map[string]string),
Types: make(map[string]NamedType),
Directives: make(map[string]*DirectiveDecl),
}
for n, t := range Meta.Types {
s.Types[n] = t
}
for n, d := range Meta.Directives {
s.Directives[n] = d
}
return s
} | [
"func",
"New",
"(",
")",
"*",
"Schema",
"{",
"s",
":=",
"&",
"Schema",
"{",
"entryPointNames",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"Types",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"NamedType",
")",
",",
"Directives... | // New initializes an instance of Schema. | [
"New",
"initializes",
"an",
"instance",
"of",
"Schema",
"."
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/internal/schema/schema.go#L235-L248 | train |
graph-gophers/graphql-go | log/log.go | LogPanic | func (l *DefaultLogger) LogPanic(_ context.Context, value interface{}) {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Printf("graphql: panic occurred: %v\n%s", value, buf)
} | go | func (l *DefaultLogger) LogPanic(_ context.Context, value interface{}) {
const size = 64 << 10
buf := make([]byte, size)
buf = buf[:runtime.Stack(buf, false)]
log.Printf("graphql: panic occurred: %v\n%s", value, buf)
} | [
"func",
"(",
"l",
"*",
"DefaultLogger",
")",
"LogPanic",
"(",
"_",
"context",
".",
"Context",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"const",
"size",
"=",
"64",
"<<",
"10",
"\n",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"size",
")... | // LogPanic is used to log recovered panic values that occur during query execution | [
"LogPanic",
"is",
"used",
"to",
"log",
"recovered",
"panic",
"values",
"that",
"occur",
"during",
"query",
"execution"
] | 3e8838d4614c12ab337e796548521744f921e05d | https://github.com/graph-gophers/graphql-go/blob/3e8838d4614c12ab337e796548521744f921e05d/log/log.go#L18-L23 | train |
xeipuuv/gojsonschema | validation.go | Validate | func Validate(ls JSONLoader, ld JSONLoader) (*Result, error) {
// load schema
schema, err := NewSchema(ls)
if err != nil {
return nil, err
}
return schema.Validate(ld)
} | go | func Validate(ls JSONLoader, ld JSONLoader) (*Result, error) {
// load schema
schema, err := NewSchema(ls)
if err != nil {
return nil, err
}
return schema.Validate(ld)
} | [
"func",
"Validate",
"(",
"ls",
"JSONLoader",
",",
"ld",
"JSONLoader",
")",
"(",
"*",
"Result",
",",
"error",
")",
"{",
"// load schema",
"schema",
",",
"err",
":=",
"NewSchema",
"(",
"ls",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // Validate loads and validates a JSON schema | [
"Validate",
"loads",
"and",
"validates",
"a",
"JSON",
"schema"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/validation.go#L39-L46 | train |
xeipuuv/gojsonschema | validation.go | Validate | func (v *Schema) Validate(l JSONLoader) (*Result, error) {
root, err := l.LoadJSON()
if err != nil {
return nil, err
}
return v.validateDocument(root), nil
} | go | func (v *Schema) Validate(l JSONLoader) (*Result, error) {
root, err := l.LoadJSON()
if err != nil {
return nil, err
}
return v.validateDocument(root), nil
} | [
"func",
"(",
"v",
"*",
"Schema",
")",
"Validate",
"(",
"l",
"JSONLoader",
")",
"(",
"*",
"Result",
",",
"error",
")",
"{",
"root",
",",
"err",
":=",
"l",
".",
"LoadJSON",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err... | // Validate loads and validates a JSON document | [
"Validate",
"loads",
"and",
"validates",
"a",
"JSON",
"document"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/validation.go#L49-L55 | train |
xeipuuv/gojsonschema | jsonLoader.go | Open | func (o osFileSystem) Open(name string) (http.File, error) {
return o(name)
} | go | func (o osFileSystem) Open(name string) (http.File, error) {
return o(name)
} | [
"func",
"(",
"o",
"osFileSystem",
")",
"Open",
"(",
"name",
"string",
")",
"(",
"http",
".",
"File",
",",
"error",
")",
"{",
"return",
"o",
"(",
"name",
")",
"\n",
"}"
] | // Opens a file with the given name | [
"Opens",
"a",
"file",
"with",
"the",
"given",
"name"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/jsonLoader.go#L89-L91 | train |
xeipuuv/gojsonschema | jsonLoader.go | NewReferenceLoaderFileSystem | func NewReferenceLoaderFileSystem(source string, fs http.FileSystem) JSONLoader {
return &jsonReferenceLoader{
fs: fs,
source: source,
}
} | go | func NewReferenceLoaderFileSystem(source string, fs http.FileSystem) JSONLoader {
return &jsonReferenceLoader{
fs: fs,
source: source,
}
} | [
"func",
"NewReferenceLoaderFileSystem",
"(",
"source",
"string",
",",
"fs",
"http",
".",
"FileSystem",
")",
"JSONLoader",
"{",
"return",
"&",
"jsonReferenceLoader",
"{",
"fs",
":",
"fs",
",",
"source",
":",
"source",
",",
"}",
"\n",
"}"
] | // NewReferenceLoaderFileSystem returns a JSON reference loader using the given source and file system. | [
"NewReferenceLoaderFileSystem",
"returns",
"a",
"JSON",
"reference",
"loader",
"using",
"the",
"given",
"source",
"and",
"file",
"system",
"."
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/jsonLoader.go#L124-L129 | train |
xeipuuv/gojsonschema | jsonLoader.go | NewReaderLoader | func NewReaderLoader(source io.Reader) (JSONLoader, io.Reader) {
buf := &bytes.Buffer{}
return &jsonIOLoader{buf: buf}, io.TeeReader(source, buf)
} | go | func NewReaderLoader(source io.Reader) (JSONLoader, io.Reader) {
buf := &bytes.Buffer{}
return &jsonIOLoader{buf: buf}, io.TeeReader(source, buf)
} | [
"func",
"NewReaderLoader",
"(",
"source",
"io",
".",
"Reader",
")",
"(",
"JSONLoader",
",",
"io",
".",
"Reader",
")",
"{",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"return",
"&",
"jsonIOLoader",
"{",
"buf",
":",
"buf",
"}",
",",
"i... | // NewReaderLoader creates a new JSON loader using the provided io.Reader | [
"NewReaderLoader",
"creates",
"a",
"new",
"JSON",
"loader",
"using",
"the",
"provided",
"io",
".",
"Reader"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/jsonLoader.go#L313-L316 | train |
xeipuuv/gojsonschema | jsonLoader.go | NewWriterLoader | func NewWriterLoader(source io.Writer) (JSONLoader, io.Writer) {
buf := &bytes.Buffer{}
return &jsonIOLoader{buf: buf}, io.MultiWriter(source, buf)
} | go | func NewWriterLoader(source io.Writer) (JSONLoader, io.Writer) {
buf := &bytes.Buffer{}
return &jsonIOLoader{buf: buf}, io.MultiWriter(source, buf)
} | [
"func",
"NewWriterLoader",
"(",
"source",
"io",
".",
"Writer",
")",
"(",
"JSONLoader",
",",
"io",
".",
"Writer",
")",
"{",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"return",
"&",
"jsonIOLoader",
"{",
"buf",
":",
"buf",
"}",
",",
"i... | // NewWriterLoader creates a new JSON loader using the provided io.Writer | [
"NewWriterLoader",
"creates",
"a",
"new",
"JSON",
"loader",
"using",
"the",
"provided",
"io",
".",
"Writer"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/jsonLoader.go#L319-L322 | train |
xeipuuv/gojsonschema | format_checkers.go | Add | func (c *FormatCheckerChain) Add(name string, f FormatChecker) *FormatCheckerChain {
lock.Lock()
c.formatters[name] = f
lock.Unlock()
return c
} | go | func (c *FormatCheckerChain) Add(name string, f FormatChecker) *FormatCheckerChain {
lock.Lock()
c.formatters[name] = f
lock.Unlock()
return c
} | [
"func",
"(",
"c",
"*",
"FormatCheckerChain",
")",
"Add",
"(",
"name",
"string",
",",
"f",
"FormatChecker",
")",
"*",
"FormatCheckerChain",
"{",
"lock",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"formatters",
"[",
"name",
"]",
"=",
"f",
"\n",
"lock",
"."... | // Add adds a FormatChecker to the FormatCheckerChain
// The name used will be the value used for the format key in your json schema | [
"Add",
"adds",
"a",
"FormatChecker",
"to",
"the",
"FormatCheckerChain",
"The",
"name",
"used",
"will",
"be",
"the",
"value",
"used",
"for",
"the",
"format",
"key",
"in",
"your",
"json",
"schema"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L149-L155 | train |
xeipuuv/gojsonschema | format_checkers.go | Has | func (c *FormatCheckerChain) Has(name string) bool {
lock.Lock()
_, ok := c.formatters[name]
lock.Unlock()
return ok
} | go | func (c *FormatCheckerChain) Has(name string) bool {
lock.Lock()
_, ok := c.formatters[name]
lock.Unlock()
return ok
} | [
"func",
"(",
"c",
"*",
"FormatCheckerChain",
")",
"Has",
"(",
"name",
"string",
")",
"bool",
"{",
"lock",
".",
"Lock",
"(",
")",
"\n",
"_",
",",
"ok",
":=",
"c",
".",
"formatters",
"[",
"name",
"]",
"\n",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
... | // Has checks to see if the FormatCheckerChain holds a FormatChecker with the given name | [
"Has",
"checks",
"to",
"see",
"if",
"the",
"FormatCheckerChain",
"holds",
"a",
"FormatChecker",
"with",
"the",
"given",
"name"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L167-L173 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (c *FormatCheckerChain) IsFormat(name string, input interface{}) bool {
lock.Lock()
f, ok := c.formatters[name]
lock.Unlock()
if !ok {
return false
}
return f.IsFormat(input)
} | go | func (c *FormatCheckerChain) IsFormat(name string, input interface{}) bool {
lock.Lock()
f, ok := c.formatters[name]
lock.Unlock()
if !ok {
return false
}
return f.IsFormat(input)
} | [
"func",
"(",
"c",
"*",
"FormatCheckerChain",
")",
"IsFormat",
"(",
"name",
"string",
",",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"lock",
".",
"Lock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"c",
".",
"formatters",
"[",
"name",
"]",
"\n",
... | // IsFormat will check an input against a FormatChecker with the given name
// to see if it is the correct format | [
"IsFormat",
"will",
"check",
"an",
"input",
"against",
"a",
"FormatChecker",
"with",
"the",
"given",
"name",
"to",
"see",
"if",
"it",
"is",
"the",
"correct",
"format"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L177-L187 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f EmailFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
_, err := mail.ParseAddress(asString)
return err == nil
} | go | func (f EmailFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
_, err := mail.ParseAddress(asString)
return err == nil
} | [
"func",
"(",
"f",
"EmailFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"_",
",... | // IsFormat checks if input is a correctly formatted e-mail address | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"e",
"-",
"mail",
"address"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L190-L198 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f IPV4FormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
// Credit: https://github.com/asaskevich/govalidator
ip := net.ParseIP(asString)
return ip != nil && strings.Contains(asString, ".")
} | go | func (f IPV4FormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
// Credit: https://github.com/asaskevich/govalidator
ip := net.ParseIP(asString)
return ip != nil && strings.Contains(asString, ".")
} | [
"func",
"(",
"f",
"IPV4FormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Credit... | // IsFormat checks if input is a correctly formatted IPv4-address | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"IPv4",
"-",
"address"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L201-L210 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f URIFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
u, err := url.Parse(asString)
if err != nil || u.Scheme == "" {
return false
}
return !strings.Contains(asString, `\`)
} | go | func (f URIFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
u, err := url.Parse(asString)
if err != nil || u.Scheme == "" {
return false
}
return !strings.Contains(asString, `\`)
} | [
"func",
"(",
"f",
"URIFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"u",
",",... | // IsFormat checks if input is correctly formatted URI with a valid Scheme per RFC3986 | [
"IsFormat",
"checks",
"if",
"input",
"is",
"correctly",
"formatted",
"URI",
"with",
"a",
"valid",
"Scheme",
"per",
"RFC3986"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L274-L287 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f URIReferenceFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
_, err := url.Parse(asString)
return err == nil && !strings.Contains(asString, `\`)
} | go | func (f URIReferenceFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
_, err := url.Parse(asString)
return err == nil && !strings.Contains(asString, `\`)
} | [
"func",
"(",
"f",
"URIReferenceFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"_... | // IsFormat checks if input is a correctly formatted URI or relative-reference per RFC3986 | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"URI",
"or",
"relative",
"-",
"reference",
"per",
"RFC3986"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L290-L298 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f URITemplateFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
u, err := url.Parse(asString)
if err != nil || strings.Contains(asString, `\`) {
return false
}
return rxURITemplate.MatchString(u.Path)
} | go | func (f URITemplateFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
u, err := url.Parse(asString)
if err != nil || strings.Contains(asString, `\`) {
return false
}
return rxURITemplate.MatchString(u.Path)
} | [
"func",
"(",
"f",
"URITemplateFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"u"... | // IsFormat checks if input is a correctly formatted URI template per RFC6570 | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"URI",
"template",
"per",
"RFC6570"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L301-L313 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f HostnameFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxHostname.MatchString(asString) && len(asString) < 256
} | go | func (f HostnameFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxHostname.MatchString(asString) && len(asString) < 256
} | [
"func",
"(",
"f",
"HostnameFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"retur... | // IsFormat checks if input is a correctly formatted hostname | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"hostname"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L316-L323 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f UUIDFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxUUID.MatchString(asString)
} | go | func (f UUIDFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxUUID.MatchString(asString)
} | [
"func",
"(",
"f",
"UUIDFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
... | // IsFormat checks if input is a correctly formatted UUID | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"UUID"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L326-L333 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f RegexFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
if asString == "" {
return true
}
_, err := regexp.Compile(asString)
return err == nil
} | go | func (f RegexFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
if asString == "" {
return true
}
_, err := regexp.Compile(asString)
return err == nil
} | [
"func",
"(",
"f",
"RegexFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"... | // IsFormat checks if input is a correctly formatted regular expression | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"regular",
"expression"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L336-L347 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f JSONPointerFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxJSONPointer.MatchString(asString)
} | go | func (f JSONPointerFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxJSONPointer.MatchString(asString)
} | [
"func",
"(",
"f",
"JSONPointerFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"re... | // IsFormat checks if input is a correctly formatted JSON Pointer per RFC6901 | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"JSON",
"Pointer",
"per",
"RFC6901"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L350-L357 | train |
xeipuuv/gojsonschema | format_checkers.go | IsFormat | func (f RelativeJSONPointerFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxRelJSONPointer.MatchString(asString)
} | go | func (f RelativeJSONPointerFormatChecker) IsFormat(input interface{}) bool {
asString, ok := input.(string)
if !ok {
return false
}
return rxRelJSONPointer.MatchString(asString)
} | [
"func",
"(",
"f",
"RelativeJSONPointerFormatChecker",
")",
"IsFormat",
"(",
"input",
"interface",
"{",
"}",
")",
"bool",
"{",
"asString",
",",
"ok",
":=",
"input",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n... | // IsFormat checks if input is a correctly formatted relative JSON Pointer | [
"IsFormat",
"checks",
"if",
"input",
"is",
"a",
"correctly",
"formatted",
"relative",
"JSON",
"Pointer"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/format_checkers.go#L360-L367 | train |
xeipuuv/gojsonschema | jsonContext.go | String | func (c *JsonContext) String(del ...string) string {
byteArr := make([]byte, 0, c.stringLen())
buf := bytes.NewBuffer(byteArr)
c.writeStringToBuffer(buf, del)
return buf.String()
} | go | func (c *JsonContext) String(del ...string) string {
byteArr := make([]byte, 0, c.stringLen())
buf := bytes.NewBuffer(byteArr)
c.writeStringToBuffer(buf, del)
return buf.String()
} | [
"func",
"(",
"c",
"*",
"JsonContext",
")",
"String",
"(",
"del",
"...",
"string",
")",
"string",
"{",
"byteArr",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"c",
".",
"stringLen",
"(",
")",
")",
"\n",
"buf",
":=",
"bytes",
".",
"NewBuffer... | // String displays the context in reverse.
// This plays well with the data structure's persistent nature with
// Cons and a json document's tree structure. | [
"String",
"displays",
"the",
"context",
"in",
"reverse",
".",
"This",
"plays",
"well",
"with",
"the",
"data",
"structure",
"s",
"persistent",
"nature",
"with",
"Cons",
"and",
"a",
"json",
"document",
"s",
"tree",
"structure",
"."
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/jsonContext.go#L43-L49 | train |
xeipuuv/gojsonschema | result.go | String | func (v ResultErrorFields) String() string {
// as a fallback, the value is displayed go style
valueString := fmt.Sprintf("%v", v.value)
// marshal the go value value to json
if v.value == nil {
valueString = TYPE_NULL
} else {
if vs, err := marshalToJSONString(v.value); err == nil {
if vs == nil {
val... | go | func (v ResultErrorFields) String() string {
// as a fallback, the value is displayed go style
valueString := fmt.Sprintf("%v", v.value)
// marshal the go value value to json
if v.value == nil {
valueString = TYPE_NULL
} else {
if vs, err := marshalToJSONString(v.value); err == nil {
if vs == nil {
val... | [
"func",
"(",
"v",
"ResultErrorFields",
")",
"String",
"(",
")",
"string",
"{",
"// as a fallback, the value is displayed go style",
"valueString",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"value",
")",
"\n\n",
"// marshal the go value value to js... | // String returns a string representation of the error | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"error"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/result.go#L159-L182 | train |
xeipuuv/gojsonschema | result.go | mergeErrors | func (v *Result) mergeErrors(otherResult *Result) {
v.errors = append(v.errors, otherResult.Errors()...)
v.score += otherResult.score
} | go | func (v *Result) mergeErrors(otherResult *Result) {
v.errors = append(v.errors, otherResult.Errors()...)
v.score += otherResult.score
} | [
"func",
"(",
"v",
"*",
"Result",
")",
"mergeErrors",
"(",
"otherResult",
"*",
"Result",
")",
"{",
"v",
".",
"errors",
"=",
"append",
"(",
"v",
".",
"errors",
",",
"otherResult",
".",
"Errors",
"(",
")",
"...",
")",
"\n",
"v",
".",
"score",
"+=",
... | // Used to copy errors from a sub-schema to the main one | [
"Used",
"to",
"copy",
"errors",
"from",
"a",
"sub",
"-",
"schema",
"to",
"the",
"main",
"one"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/result.go#L213-L216 | train |
xeipuuv/gojsonschema | utils.go | indexStringInSlice | func indexStringInSlice(s []string, what string) int {
for i := range s {
if s[i] == what {
return i
}
}
return -1
} | go | func indexStringInSlice(s []string, what string) int {
for i := range s {
if s[i] == what {
return i
}
}
return -1
} | [
"func",
"indexStringInSlice",
"(",
"s",
"[",
"]",
"string",
",",
"what",
"string",
")",
"int",
"{",
"for",
"i",
":=",
"range",
"s",
"{",
"if",
"s",
"[",
"i",
"]",
"==",
"what",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"-",
"1",... | // indexStringInSlice returns the index of the first instance of 'what' in s or -1 if it is not found in s. | [
"indexStringInSlice",
"returns",
"the",
"index",
"of",
"the",
"first",
"instance",
"of",
"what",
"in",
"s",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"found",
"in",
"s",
"."
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/utils.go#L66-L73 | train |
xeipuuv/gojsonschema | schemaLoader.go | NewSchemaLoader | func NewSchemaLoader() *SchemaLoader {
ps := &SchemaLoader{
pool: &schemaPool{
schemaPoolDocuments: make(map[string]*schemaPoolDocument),
},
AutoDetect: true,
Validate: false,
Draft: Hybrid,
}
ps.pool.autoDetect = &ps.AutoDetect
return ps
} | go | func NewSchemaLoader() *SchemaLoader {
ps := &SchemaLoader{
pool: &schemaPool{
schemaPoolDocuments: make(map[string]*schemaPoolDocument),
},
AutoDetect: true,
Validate: false,
Draft: Hybrid,
}
ps.pool.autoDetect = &ps.AutoDetect
return ps
} | [
"func",
"NewSchemaLoader",
"(",
")",
"*",
"SchemaLoader",
"{",
"ps",
":=",
"&",
"SchemaLoader",
"{",
"pool",
":",
"&",
"schemaPool",
"{",
"schemaPoolDocuments",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"schemaPoolDocument",
")",
",",
"}",
",",
"... | // NewSchemaLoader creates a new NewSchemaLoader | [
"NewSchemaLoader",
"creates",
"a",
"new",
"NewSchemaLoader"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/schemaLoader.go#L33-L46 | train |
xeipuuv/gojsonschema | schemaLoader.go | AddSchema | func (sl *SchemaLoader) AddSchema(url string, loader JSONLoader) error {
ref, err := gojsonreference.NewJsonReference(url)
if err != nil {
return err
}
doc, err := loader.LoadJSON()
if err != nil {
return err
}
if sl.Validate {
if err := sl.validateMetaschema(doc); err != nil {
return err
}
}
... | go | func (sl *SchemaLoader) AddSchema(url string, loader JSONLoader) error {
ref, err := gojsonreference.NewJsonReference(url)
if err != nil {
return err
}
doc, err := loader.LoadJSON()
if err != nil {
return err
}
if sl.Validate {
if err := sl.validateMetaschema(doc); err != nil {
return err
}
}
... | [
"func",
"(",
"sl",
"*",
"SchemaLoader",
")",
"AddSchema",
"(",
"url",
"string",
",",
"loader",
"JSONLoader",
")",
"error",
"{",
"ref",
",",
"err",
":=",
"gojsonreference",
".",
"NewJsonReference",
"(",
"url",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
... | //AddSchema adds a schema under the provided URL to the schema cache | [
"AddSchema",
"adds",
"a",
"schema",
"under",
"the",
"provided",
"URL",
"to",
"the",
"schema",
"cache"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/schemaLoader.go#L123-L144 | train |
xeipuuv/gojsonschema | schemaLoader.go | Compile | func (sl *SchemaLoader) Compile(rootSchema JSONLoader) (*Schema, error) {
ref, err := rootSchema.JsonReference()
if err != nil {
return nil, err
}
d := Schema{}
d.pool = sl.pool
d.pool.jsonLoaderFactory = rootSchema.LoaderFactory()
d.documentReference = ref
d.referencePool = newSchemaReferencePool()
var ... | go | func (sl *SchemaLoader) Compile(rootSchema JSONLoader) (*Schema, error) {
ref, err := rootSchema.JsonReference()
if err != nil {
return nil, err
}
d := Schema{}
d.pool = sl.pool
d.pool.jsonLoaderFactory = rootSchema.LoaderFactory()
d.documentReference = ref
d.referencePool = newSchemaReferencePool()
var ... | [
"func",
"(",
"sl",
"*",
"SchemaLoader",
")",
"Compile",
"(",
"rootSchema",
"JSONLoader",
")",
"(",
"*",
"Schema",
",",
"error",
")",
"{",
"ref",
",",
"err",
":=",
"rootSchema",
".",
"JsonReference",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"r... | // Compile loads and compiles a schema | [
"Compile",
"loads",
"and",
"compiles",
"a",
"schema"
] | 354ad34c2300dd6e84920ac70b41487336219e43 | https://github.com/xeipuuv/gojsonschema/blob/354ad34c2300dd6e84920ac70b41487336219e43/schemaLoader.go#L147-L206 | train |
letsencrypt/boulder | mocks/mocks.go | GetRegistration | func (sa *StorageAuthority) GetRegistration(_ context.Context, id int64) (core.Registration, error) {
if id == 100 {
// Tag meaning "Missing"
return core.Registration{}, errors.New("missing")
}
if id == 101 {
// Tag meaning "Malformed"
return core.Registration{}, nil
}
if id == 102 {
// Tag meaning "Not ... | go | func (sa *StorageAuthority) GetRegistration(_ context.Context, id int64) (core.Registration, error) {
if id == 100 {
// Tag meaning "Missing"
return core.Registration{}, errors.New("missing")
}
if id == 101 {
// Tag meaning "Malformed"
return core.Registration{}, nil
}
if id == 102 {
// Tag meaning "Not ... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetRegistration",
"(",
"_",
"context",
".",
"Context",
",",
"id",
"int64",
")",
"(",
"core",
".",
"Registration",
",",
"error",
")",
"{",
"if",
"id",
"==",
"100",
"{",
"// Tag meaning \"Missing\"",
"return"... | // GetRegistration is a mock | [
"GetRegistration",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L75-L142 | train |
letsencrypt/boulder | mocks/mocks.go | GetAuthorization | func (sa *StorageAuthority) GetAuthorization(_ context.Context, id string) (core.Authorization, error) {
authz := core.Authorization{
ID: "valid",
Status: core.StatusValid,
RegistrationID: 1,
Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"},
Challenges: []core... | go | func (sa *StorageAuthority) GetAuthorization(_ context.Context, id string) (core.Authorization, error) {
authz := core.Authorization{
ID: "valid",
Status: core.StatusValid,
RegistrationID: 1,
Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"},
Challenges: []core... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetAuthorization",
"(",
"_",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"core",
".",
"Authorization",
",",
"error",
")",
"{",
"authz",
":=",
"core",
".",
"Authorization",
"{",
"ID",
":",
... | // GetAuthorization is a mock | [
"GetAuthorization",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L239-L282 | train |
letsencrypt/boulder | mocks/mocks.go | RevokeAuthorizationsByDomain | func (sa *StorageAuthority) RevokeAuthorizationsByDomain(_ context.Context, ident core.AcmeIdentifier) (int64, int64, error) {
return 0, 0, nil
} | go | func (sa *StorageAuthority) RevokeAuthorizationsByDomain(_ context.Context, ident core.AcmeIdentifier) (int64, int64, error) {
return 0, 0, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"RevokeAuthorizationsByDomain",
"(",
"_",
"context",
".",
"Context",
",",
"ident",
"core",
".",
"AcmeIdentifier",
")",
"(",
"int64",
",",
"int64",
",",
"error",
")",
"{",
"return",
"0",
",",
"0",
",",
"nil... | // RevokeAuthorizationsByDomain is a mock | [
"RevokeAuthorizationsByDomain",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L285-L287 | train |
letsencrypt/boulder | mocks/mocks.go | GetCertificate | func (sa *StorageAuthority) GetCertificate(_ context.Context, serial string) (core.Certificate, error) {
// Serial ee == 238.crt
if serial == "0000000000000000000000000000000000ee" {
certPemBytes, _ := ioutil.ReadFile("test/238.crt")
certBlock, _ := pem.Decode(certPemBytes)
return core.Certificate{
Registrat... | go | func (sa *StorageAuthority) GetCertificate(_ context.Context, serial string) (core.Certificate, error) {
// Serial ee == 238.crt
if serial == "0000000000000000000000000000000000ee" {
certPemBytes, _ := ioutil.ReadFile("test/238.crt")
certBlock, _ := pem.Decode(certPemBytes)
return core.Certificate{
Registrat... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetCertificate",
"(",
"_",
"context",
".",
"Context",
",",
"serial",
"string",
")",
"(",
"core",
".",
"Certificate",
",",
"error",
")",
"{",
"// Serial ee == 238.crt",
"if",
"serial",
"==",
"\"",
"\"",
"{",... | // GetCertificate is a mock | [
"GetCertificate",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L290-L309 | train |
letsencrypt/boulder | mocks/mocks.go | GetCertificateStatus | func (sa *StorageAuthority) GetCertificateStatus(_ context.Context, serial string) (core.CertificateStatus, error) {
// Serial ee == 238.crt
if serial == "0000000000000000000000000000000000ee" {
return core.CertificateStatus{
Status: core.OCSPStatusGood,
}, nil
} else if serial == "000000000000000000000000000... | go | func (sa *StorageAuthority) GetCertificateStatus(_ context.Context, serial string) (core.CertificateStatus, error) {
// Serial ee == 238.crt
if serial == "0000000000000000000000000000000000ee" {
return core.CertificateStatus{
Status: core.OCSPStatusGood,
}, nil
} else if serial == "000000000000000000000000000... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetCertificateStatus",
"(",
"_",
"context",
".",
"Context",
",",
"serial",
"string",
")",
"(",
"core",
".",
"CertificateStatus",
",",
"error",
")",
"{",
"// Serial ee == 238.crt",
"if",
"serial",
"==",
"\"",
... | // GetCertificateStatus is a mock | [
"GetCertificateStatus",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L312-L325 | train |
letsencrypt/boulder | mocks/mocks.go | AddCertificate | func (sa *StorageAuthority) AddCertificate(_ context.Context, certDER []byte, regID int64, _ []byte, _ *time.Time) (digest string, err error) {
return
} | go | func (sa *StorageAuthority) AddCertificate(_ context.Context, certDER []byte, regID int64, _ []byte, _ *time.Time) (digest string, err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"AddCertificate",
"(",
"_",
"context",
".",
"Context",
",",
"certDER",
"[",
"]",
"byte",
",",
"regID",
"int64",
",",
"_",
"[",
"]",
"byte",
",",
"_",
"*",
"time",
".",
"Time",
")",
"(",
"digest",
"st... | // AddCertificate is a mock | [
"AddCertificate",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L328-L330 | train |
letsencrypt/boulder | mocks/mocks.go | FinalizeAuthorization | func (sa *StorageAuthority) FinalizeAuthorization(_ context.Context, authz core.Authorization) (err error) {
return
} | go | func (sa *StorageAuthority) FinalizeAuthorization(_ context.Context, authz core.Authorization) (err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"FinalizeAuthorization",
"(",
"_",
"context",
".",
"Context",
",",
"authz",
"core",
".",
"Authorization",
")",
"(",
"err",
"error",
")",
"{",
"return",
"\n",
"}"
] | // FinalizeAuthorization is a mock | [
"FinalizeAuthorization",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L333-L335 | train |
letsencrypt/boulder | mocks/mocks.go | MarkCertificateRevoked | func (sa *StorageAuthority) MarkCertificateRevoked(_ context.Context, serial string, reasonCode revocation.Reason) (err error) {
return
} | go | func (sa *StorageAuthority) MarkCertificateRevoked(_ context.Context, serial string, reasonCode revocation.Reason) (err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"MarkCertificateRevoked",
"(",
"_",
"context",
".",
"Context",
",",
"serial",
"string",
",",
"reasonCode",
"revocation",
".",
"Reason",
")",
"(",
"err",
"error",
")",
"{",
"return",
"\n",
"}"
] | // MarkCertificateRevoked is a mock | [
"MarkCertificateRevoked",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L338-L340 | train |
letsencrypt/boulder | mocks/mocks.go | NewPendingAuthorization | func (sa *StorageAuthority) NewPendingAuthorization(_ context.Context, authz core.Authorization) (core.Authorization, error) {
return authz, nil
} | go | func (sa *StorageAuthority) NewPendingAuthorization(_ context.Context, authz core.Authorization) (core.Authorization, error) {
return authz, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"NewPendingAuthorization",
"(",
"_",
"context",
".",
"Context",
",",
"authz",
"core",
".",
"Authorization",
")",
"(",
"core",
".",
"Authorization",
",",
"error",
")",
"{",
"return",
"authz",
",",
"nil",
"\n"... | // NewPendingAuthorization is a mock | [
"NewPendingAuthorization",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L343-L345 | train |
letsencrypt/boulder | mocks/mocks.go | NewRegistration | func (sa *StorageAuthority) NewRegistration(_ context.Context, reg core.Registration) (regR core.Registration, err error) {
return
} | go | func (sa *StorageAuthority) NewRegistration(_ context.Context, reg core.Registration) (regR core.Registration, err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"NewRegistration",
"(",
"_",
"context",
".",
"Context",
",",
"reg",
"core",
".",
"Registration",
")",
"(",
"regR",
"core",
".",
"Registration",
",",
"err",
"error",
")",
"{",
"return",
"\n",
"}"
] | // NewRegistration is a mock | [
"NewRegistration",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L348-L350 | train |
letsencrypt/boulder | mocks/mocks.go | UpdateRegistration | func (sa *StorageAuthority) UpdateRegistration(_ context.Context, reg core.Registration) (err error) {
return
} | go | func (sa *StorageAuthority) UpdateRegistration(_ context.Context, reg core.Registration) (err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"UpdateRegistration",
"(",
"_",
"context",
".",
"Context",
",",
"reg",
"core",
".",
"Registration",
")",
"(",
"err",
"error",
")",
"{",
"return",
"\n",
"}"
] | // UpdateRegistration is a mock | [
"UpdateRegistration",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L353-L355 | train |
letsencrypt/boulder | mocks/mocks.go | CountFQDNSets | func (sa *StorageAuthority) CountFQDNSets(_ context.Context, since time.Duration, names []string) (int64, error) {
return 0, nil
} | go | func (sa *StorageAuthority) CountFQDNSets(_ context.Context, since time.Duration, names []string) (int64, error) {
return 0, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountFQDNSets",
"(",
"_",
"context",
".",
"Context",
",",
"since",
"time",
".",
"Duration",
",",
"names",
"[",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"0",
",",
"nil",
"\n"... | // CountFQDNSets is a mock | [
"CountFQDNSets",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L358-L360 | train |
letsencrypt/boulder | mocks/mocks.go | FQDNSetExists | func (sa *StorageAuthority) FQDNSetExists(_ context.Context, names []string) (bool, error) {
return false, nil
} | go | func (sa *StorageAuthority) FQDNSetExists(_ context.Context, names []string) (bool, error) {
return false, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"FQDNSetExists",
"(",
"_",
"context",
".",
"Context",
",",
"names",
"[",
"]",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"false",
",",
"nil",
"\n",
"}"
] | // FQDNSetExists is a mock | [
"FQDNSetExists",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L363-L365 | train |
letsencrypt/boulder | mocks/mocks.go | GetValidAuthorizations | func (sa *StorageAuthority) GetValidAuthorizations(_ context.Context, regID int64, names []string, now time.Time) (map[string]*core.Authorization, error) {
if regID == 1 {
auths := make(map[string]*core.Authorization)
for _, name := range names {
if sa.authorizedDomains[name] || name == "not-an-example.com" {
... | go | func (sa *StorageAuthority) GetValidAuthorizations(_ context.Context, regID int64, names []string, now time.Time) (map[string]*core.Authorization, error) {
if regID == 1 {
auths := make(map[string]*core.Authorization)
for _, name := range names {
if sa.authorizedDomains[name] || name == "not-an-example.com" {
... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetValidAuthorizations",
"(",
"_",
"context",
".",
"Context",
",",
"regID",
"int64",
",",
"names",
"[",
"]",
"string",
",",
"now",
"time",
".",
"Time",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"core",
... | // GetValidAuthorizations is a mock | [
"GetValidAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L382-L413 | train |
letsencrypt/boulder | mocks/mocks.go | CountCertificatesByNames | func (sa *StorageAuthority) CountCertificatesByNames(_ context.Context, _ []string, _, _ time.Time) (ret []*sapb.CountByNames_MapElement, err error) {
return
} | go | func (sa *StorageAuthority) CountCertificatesByNames(_ context.Context, _ []string, _, _ time.Time) (ret []*sapb.CountByNames_MapElement, err error) {
return
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountCertificatesByNames",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"[",
"]",
"string",
",",
"_",
",",
"_",
"time",
".",
"Time",
")",
"(",
"ret",
"[",
"]",
"*",
"sapb",
".",
"CountByNames_MapEleme... | // CountCertificatesByNames is a mock | [
"CountCertificatesByNames",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L416-L418 | train |
letsencrypt/boulder | mocks/mocks.go | CountRegistrationsByIP | func (sa *StorageAuthority) CountRegistrationsByIP(_ context.Context, _ net.IP, _, _ time.Time) (int, error) {
return 0, nil
} | go | func (sa *StorageAuthority) CountRegistrationsByIP(_ context.Context, _ net.IP, _, _ time.Time) (int, error) {
return 0, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountRegistrationsByIP",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"net",
".",
"IP",
",",
"_",
",",
"_",
"time",
".",
"Time",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"0",
",",
"nil",... | // CountRegistrationsByIP is a mock | [
"CountRegistrationsByIP",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L426-L428 | train |
letsencrypt/boulder | mocks/mocks.go | CountPendingAuthorizations | func (sa *StorageAuthority) CountPendingAuthorizations(_ context.Context, _ int64) (int, error) {
return 0, nil
} | go | func (sa *StorageAuthority) CountPendingAuthorizations(_ context.Context, _ int64) (int, error) {
return 0, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountPendingAuthorizations",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"int64",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"0",
",",
"nil",
"\n",
"}"
] | // CountPendingAuthorizations is a mock | [
"CountPendingAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L436-L438 | train |
letsencrypt/boulder | mocks/mocks.go | CountOrders | func (sa *StorageAuthority) CountOrders(_ context.Context, _ int64, _, _ time.Time) (int, error) {
return 0, nil
} | go | func (sa *StorageAuthority) CountOrders(_ context.Context, _ int64, _, _ time.Time) (int, error) {
return 0, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountOrders",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"int64",
",",
"_",
",",
"_",
"time",
".",
"Time",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"0",
",",
"nil",
"\n",
"}"
] | // CountOrders is a mock | [
"CountOrders",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L441-L443 | train |
letsencrypt/boulder | mocks/mocks.go | DeactivateAuthorization | func (sa *StorageAuthority) DeactivateAuthorization(_ context.Context, _ string) error {
return nil
} | go | func (sa *StorageAuthority) DeactivateAuthorization(_ context.Context, _ string) error {
return nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"DeactivateAuthorization",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // DeactivateAuthorization is a mock | [
"DeactivateAuthorization",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L446-L448 | train |
letsencrypt/boulder | mocks/mocks.go | DeactivateRegistration | func (sa *StorageAuthority) DeactivateRegistration(_ context.Context, _ int64) error {
return nil
} | go | func (sa *StorageAuthority) DeactivateRegistration(_ context.Context, _ int64) error {
return nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"DeactivateRegistration",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"int64",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // DeactivateRegistration is a mock | [
"DeactivateRegistration",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L451-L453 | train |
letsencrypt/boulder | mocks/mocks.go | NewOrder | func (sa *StorageAuthority) NewOrder(_ context.Context, order *corepb.Order) (*corepb.Order, error) {
return order, nil
} | go | func (sa *StorageAuthority) NewOrder(_ context.Context, order *corepb.Order) (*corepb.Order, error) {
return order, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"NewOrder",
"(",
"_",
"context",
".",
"Context",
",",
"order",
"*",
"corepb",
".",
"Order",
")",
"(",
"*",
"corepb",
".",
"Order",
",",
"error",
")",
"{",
"return",
"order",
",",
"nil",
"\n",
"}"
] | // NewOrder is a mock | [
"NewOrder",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L456-L458 | train |
letsencrypt/boulder | mocks/mocks.go | SetOrderProcessing | func (sa *StorageAuthority) SetOrderProcessing(_ context.Context, order *corepb.Order) error {
return nil
} | go | func (sa *StorageAuthority) SetOrderProcessing(_ context.Context, order *corepb.Order) error {
return nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"SetOrderProcessing",
"(",
"_",
"context",
".",
"Context",
",",
"order",
"*",
"corepb",
".",
"Order",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // SetOrderProcessing is a mock | [
"SetOrderProcessing",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L461-L463 | train |
letsencrypt/boulder | mocks/mocks.go | GetOrder | func (sa *StorageAuthority) GetOrder(_ context.Context, req *sapb.OrderRequest) (*corepb.Order, error) {
if *req.Id == 2 {
return nil, berrors.NotFoundError("bad")
} else if *req.Id == 3 {
return nil, errors.New("very bad")
}
status := string(core.StatusValid)
one := int64(1)
serial := "serial"
exp := sa.cl... | go | func (sa *StorageAuthority) GetOrder(_ context.Context, req *sapb.OrderRequest) (*corepb.Order, error) {
if *req.Id == 2 {
return nil, berrors.NotFoundError("bad")
} else if *req.Id == 3 {
return nil, errors.New("very bad")
}
status := string(core.StatusValid)
one := int64(1)
serial := "serial"
exp := sa.cl... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetOrder",
"(",
"_",
"context",
".",
"Context",
",",
"req",
"*",
"sapb",
".",
"OrderRequest",
")",
"(",
"*",
"corepb",
".",
"Order",
",",
"error",
")",
"{",
"if",
"*",
"req",
".",
"Id",
"==",
"2",
... | // GetOrder is a mock | [
"GetOrder",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L476-L529 | train |
letsencrypt/boulder | mocks/mocks.go | GetAuthorizations | func (sa *StorageAuthority) GetAuthorizations(ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) {
return &sapb.Authorizations{}, nil
} | go | func (sa *StorageAuthority) GetAuthorizations(ctx context.Context, req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) {
return &sapb.Authorizations{}, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetAuthorizations",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"sapb",
".",
"GetAuthorizationsRequest",
")",
"(",
"*",
"sapb",
".",
"Authorizations",
",",
"error",
")",
"{",
"return",
"&",
"sap... | // GetAuthorizations is a mock | [
"GetAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L540-L542 | train |
letsencrypt/boulder | mocks/mocks.go | CountInvalidAuthorizations | func (sa *StorageAuthority) CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error) {
return &sapb.Count{}, nil
} | go | func (sa *StorageAuthority) CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error) {
return &sapb.Count{}, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"CountInvalidAuthorizations",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"sapb",
".",
"CountInvalidAuthorizationsRequest",
")",
"(",
"count",
"*",
"sapb",
".",
"Count",
",",
"err",
"error",
")",
"... | // CountInvalidAuthorizations is a mock | [
"CountInvalidAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L545-L547 | train |
letsencrypt/boulder | mocks/mocks.go | AddPendingAuthorizations | func (sa *StorageAuthority) AddPendingAuthorizations(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.AuthorizationIDs, error) {
return &sapb.AuthorizationIDs{}, nil
} | go | func (sa *StorageAuthority) AddPendingAuthorizations(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.AuthorizationIDs, error) {
return &sapb.AuthorizationIDs{}, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"AddPendingAuthorizations",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"sapb",
".",
"AddPendingAuthorizationsRequest",
")",
"(",
"*",
"sapb",
".",
"AuthorizationIDs",
",",
"error",
")",
"{",
"return... | // AddPendingAuthorizations is a mock | [
"AddPendingAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L550-L552 | train |
letsencrypt/boulder | mocks/mocks.go | NewAuthorizations2 | func (sa *StorageAuthority) NewAuthorizations2(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.Authorization2IDs, error) {
return &sapb.Authorization2IDs{}, nil
} | go | func (sa *StorageAuthority) NewAuthorizations2(ctx context.Context, req *sapb.AddPendingAuthorizationsRequest) (*sapb.Authorization2IDs, error) {
return &sapb.Authorization2IDs{}, nil
} | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"NewAuthorizations2",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"sapb",
".",
"AddPendingAuthorizationsRequest",
")",
"(",
"*",
"sapb",
".",
"Authorization2IDs",
",",
"error",
")",
"{",
"return",
... | // NewAuthorizations is a mock | [
"NewAuthorizations",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L555-L557 | train |
letsencrypt/boulder | mocks/mocks.go | GetAuthorization2 | func (sa *StorageAuthority) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2) (*corepb.Authorization, error) {
authz := core.Authorization{
Status: core.StatusValid,
RegistrationID: 1,
Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"},
V2: true,
... | go | func (sa *StorageAuthority) GetAuthorization2(ctx context.Context, id *sapb.AuthorizationID2) (*corepb.Authorization, error) {
authz := core.Authorization{
Status: core.StatusValid,
RegistrationID: 1,
Identifier: core.AcmeIdentifier{Type: "dns", Value: "not-an-example.com"},
V2: true,
... | [
"func",
"(",
"sa",
"*",
"StorageAuthority",
")",
"GetAuthorization2",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"*",
"sapb",
".",
"AuthorizationID2",
")",
"(",
"*",
"corepb",
".",
"Authorization",
",",
"error",
")",
"{",
"authz",
":=",
"core",
".... | // GetAuthorization2 is a mock | [
"GetAuthorization2",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L604-L647 | train |
letsencrypt/boulder | mocks/mocks.go | SubmitToSingleCTWithResult | func (*Publisher) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
return nil, nil
} | go | func (*Publisher) SubmitToSingleCTWithResult(_ context.Context, _ *pubpb.Request) (*pubpb.Result, error) {
return nil, nil
} | [
"func",
"(",
"*",
"Publisher",
")",
"SubmitToSingleCTWithResult",
"(",
"_",
"context",
".",
"Context",
",",
"_",
"*",
"pubpb",
".",
"Request",
")",
"(",
"*",
"pubpb",
".",
"Result",
",",
"error",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}"
] | // SubmitToSingleCTWithResult is a mock | [
"SubmitToSingleCTWithResult",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L660-L662 | train |
letsencrypt/boulder | mocks/mocks.go | SendMail | func (m *Mailer) SendMail(to []string, subject, msg string) error {
for _, rcpt := range to {
m.Messages = append(m.Messages, MailerMessage{
To: rcpt,
Subject: subject,
Body: msg,
})
}
return nil
} | go | func (m *Mailer) SendMail(to []string, subject, msg string) error {
for _, rcpt := range to {
m.Messages = append(m.Messages, MailerMessage{
To: rcpt,
Subject: subject,
Body: msg,
})
}
return nil
} | [
"func",
"(",
"m",
"*",
"Mailer",
")",
"SendMail",
"(",
"to",
"[",
"]",
"string",
",",
"subject",
",",
"msg",
"string",
")",
"error",
"{",
"for",
"_",
",",
"rcpt",
":=",
"range",
"to",
"{",
"m",
".",
"Messages",
"=",
"append",
"(",
"m",
".",
"Me... | // SendMail is a mock | [
"SendMail",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/mocks.go#L682-L691 | train |
letsencrypt/boulder | probs/probs.go | ProblemDetailsToStatusCode | func ProblemDetailsToStatusCode(prob *ProblemDetails) int {
if prob.HTTPStatus != 0 {
return prob.HTTPStatus
}
switch prob.Type {
case
ConnectionProblem,
MalformedProblem,
BadSignatureAlgorithmProblem,
BadPublicKeyProblem,
TLSProblem,
UnknownHostProblem,
BadNonceProblem,
InvalidEmailProblem,
Rej... | go | func ProblemDetailsToStatusCode(prob *ProblemDetails) int {
if prob.HTTPStatus != 0 {
return prob.HTTPStatus
}
switch prob.Type {
case
ConnectionProblem,
MalformedProblem,
BadSignatureAlgorithmProblem,
BadPublicKeyProblem,
TLSProblem,
UnknownHostProblem,
BadNonceProblem,
InvalidEmailProblem,
Rej... | [
"func",
"ProblemDetailsToStatusCode",
"(",
"prob",
"*",
"ProblemDetails",
")",
"int",
"{",
"if",
"prob",
".",
"HTTPStatus",
"!=",
"0",
"{",
"return",
"prob",
".",
"HTTPStatus",
"\n",
"}",
"\n",
"switch",
"prob",
".",
"Type",
"{",
"case",
"ConnectionProblem",... | // ProblemDetailsToStatusCode inspects the given ProblemDetails to figure out
// what HTTP status code it should represent. It should only be used by the WFE
// but is included in this package because of its reliance on ProblemTypes. | [
"ProblemDetailsToStatusCode",
"inspects",
"the",
"given",
"ProblemDetails",
"to",
"figure",
"out",
"what",
"HTTP",
"status",
"code",
"it",
"should",
"represent",
".",
"It",
"should",
"only",
"be",
"used",
"by",
"the",
"WFE",
"but",
"is",
"included",
"in",
"thi... | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L56-L84 | train |
letsencrypt/boulder | probs/probs.go | BadNonce | func BadNonce(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadNonceProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func BadNonce(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadNonceProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"BadNonce",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"BadNonceProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a"... | // BadNonce returns a ProblemDetails with a BadNonceProblem and a 400 Bad
// Request status code. | [
"BadNonce",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"BadNonceProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L88-L94 | train |
letsencrypt/boulder | probs/probs.go | RejectedIdentifier | func RejectedIdentifier(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: RejectedIdentifierProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func RejectedIdentifier(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: RejectedIdentifierProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"RejectedIdentifier",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"RejectedIdentifierProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"d... | // RejectedIdentifier returns a ProblemDetails with a RejectedIdentifierProblem and a 400 Bad
// Request status code. | [
"RejectedIdentifier",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"RejectedIdentifierProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L98-L104 | train |
letsencrypt/boulder | probs/probs.go | Conflict | func Conflict(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusConflict,
}
} | go | func Conflict(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusConflict,
}
} | [
"func",
"Conflict",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"MalformedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a... | // Conflict returns a ProblemDetails with a MalformedProblem and a 409 Conflict
// status code. | [
"Conflict",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"MalformedProblem",
"and",
"a",
"409",
"Conflict",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L108-L114 | train |
letsencrypt/boulder | probs/probs.go | AlreadyRevoked | func AlreadyRevoked(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: AlreadyRevokedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func AlreadyRevoked(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: AlreadyRevokedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"AlreadyRevoked",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"AlreadyRevokedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
... | // AlreadyRevoked returns a ProblemDetails with a AlreadyRevokedProblem and a 400 Bad
// Request status code. | [
"AlreadyRevoked",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"AlreadyRevokedProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L118-L124 | train |
letsencrypt/boulder | probs/probs.go | Malformed | func Malformed(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func Malformed(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"Malformed",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"MalformedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"... | // Malformed returns a ProblemDetails with a MalformedProblem and a 400 Bad
// Request status code. | [
"Malformed",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"MalformedProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L128-L134 | train |
letsencrypt/boulder | probs/probs.go | BadSignatureAlgorithm | func BadSignatureAlgorithm(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadSignatureAlgorithmProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func BadSignatureAlgorithm(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadSignatureAlgorithmProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"BadSignatureAlgorithm",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"BadSignatureAlgorithmProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"("... | // BadSignatureAlgorithm returns a ProblemDetails with a BadSignatureAlgorithmProblem
// and a 400 Bad Request status code. | [
"BadSignatureAlgorithm",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"BadSignatureAlgorithmProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L138-L144 | train |
letsencrypt/boulder | probs/probs.go | BadPublicKey | func BadPublicKey(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadPublicKeyProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func BadPublicKey(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: BadPublicKeyProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"BadPublicKey",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"BadPublicKeyProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",... | // BadPublicKey returns a ProblemDetails with a BadPublicKeyProblem and a 400 Bad
// Request status code. | [
"BadPublicKey",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"BadPublicKeyProblem",
"and",
"a",
"400",
"Bad",
"Request",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L148-L154 | train |
letsencrypt/boulder | probs/probs.go | NotFound | func NotFound(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusNotFound,
}
} | go | func NotFound(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusNotFound,
}
} | [
"func",
"NotFound",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"MalformedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a... | // NotFound returns a ProblemDetails with a MalformedProblem and a 404 Not Found
// status code. | [
"NotFound",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"MalformedProblem",
"and",
"a",
"404",
"Not",
"Found",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L158-L164 | train |
letsencrypt/boulder | probs/probs.go | ServerInternal | func ServerInternal(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: ServerInternalProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusInternalServerError,
}
} | go | func ServerInternal(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: ServerInternalProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusInternalServerError,
}
} | [
"func",
"ServerInternal",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"ServerInternalProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
... | // ServerInternal returns a ProblemDetails with a ServerInternalProblem and a
// 500 Internal Server Failure status code. | [
"ServerInternal",
"returns",
"a",
"ProblemDetails",
"with",
"a",
"ServerInternalProblem",
"and",
"a",
"500",
"Internal",
"Server",
"Failure",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L168-L174 | train |
letsencrypt/boulder | probs/probs.go | Unauthorized | func Unauthorized(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: UnauthorizedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | go | func Unauthorized(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: UnauthorizedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | [
"func",
"Unauthorized",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"UnauthorizedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",... | // Unauthorized returns a ProblemDetails with an UnauthorizedProblem and a 403
// Forbidden status code. | [
"Unauthorized",
"returns",
"a",
"ProblemDetails",
"with",
"an",
"UnauthorizedProblem",
"and",
"a",
"403",
"Forbidden",
"status",
"code",
"."
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L178-L184 | train |
letsencrypt/boulder | probs/probs.go | InvalidContentType | func InvalidContentType(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusUnsupportedMediaType,
}
} | go | func InvalidContentType(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: MalformedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusUnsupportedMediaType,
}
} | [
"func",
"InvalidContentType",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"MalformedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
... | // InvalidContentType returns a ProblemDetails suitable for a missing
// ContentType header, or an incorrect ContentType header | [
"InvalidContentType",
"returns",
"a",
"ProblemDetails",
"suitable",
"for",
"a",
"missing",
"ContentType",
"header",
"or",
"an",
"incorrect",
"ContentType",
"header"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L208-L214 | train |
letsencrypt/boulder | probs/probs.go | InvalidEmail | func InvalidEmail(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: InvalidEmailProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func InvalidEmail(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: InvalidEmailProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"InvalidEmail",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"InvalidEmailProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",... | // InvalidEmail returns a ProblemDetails representing an invalid email address
// error | [
"InvalidEmail",
"returns",
"a",
"ProblemDetails",
"representing",
"an",
"invalid",
"email",
"address",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L218-L224 | train |
letsencrypt/boulder | probs/probs.go | ConnectionFailure | func ConnectionFailure(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: ConnectionProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func ConnectionFailure(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: ConnectionProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"ConnectionFailure",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"ConnectionProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
... | // ConnectionFailure returns a ProblemDetails representing a ConnectionProblem
// error | [
"ConnectionFailure",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"ConnectionProblem",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L228-L234 | train |
letsencrypt/boulder | probs/probs.go | UnknownHost | func UnknownHost(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: UnknownHostProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func UnknownHost(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: UnknownHostProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"UnknownHost",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"UnknownHostProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",... | // UnknownHost returns a ProblemDetails representing an UnknownHostProblem error | [
"UnknownHost",
"returns",
"a",
"ProblemDetails",
"representing",
"an",
"UnknownHostProblem",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L237-L243 | train |
letsencrypt/boulder | probs/probs.go | RateLimited | func RateLimited(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: RateLimitedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: statusTooManyRequests,
}
} | go | func RateLimited(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: RateLimitedProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: statusTooManyRequests,
}
} | [
"func",
"RateLimited",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"RateLimitedProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",... | // RateLimited returns a ProblemDetails representing a RateLimitedProblem error | [
"RateLimited",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"RateLimitedProblem",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L246-L252 | train |
letsencrypt/boulder | probs/probs.go | TLSError | func TLSError(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: TLSProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func TLSError(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: TLSProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"TLSError",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"TLSProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a",
"... | // TLSError returns a ProblemDetails representing a TLSProblem error | [
"TLSError",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"TLSProblem",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L255-L261 | train |
letsencrypt/boulder | probs/probs.go | AccountDoesNotExist | func AccountDoesNotExist(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: AccountDoesNotExistProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func AccountDoesNotExist(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: AccountDoesNotExistProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"AccountDoesNotExist",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"AccountDoesNotExistProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
... | // AccountDoesNotExist returns a ProblemDetails representing an
// AccountDoesNotExistProblem error | [
"AccountDoesNotExist",
"returns",
"a",
"ProblemDetails",
"representing",
"an",
"AccountDoesNotExistProblem",
"error"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L265-L271 | train |
letsencrypt/boulder | probs/probs.go | CAA | func CAA(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: CAAProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | go | func CAA(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: CAAProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | [
"func",
"CAA",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"CAAProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a",
"...",... | // CAA returns a ProblemDetails representing a CAAProblem | [
"CAA",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"CAAProblem"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L274-L280 | train |
letsencrypt/boulder | probs/probs.go | DNS | func DNS(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: DNSProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | go | func DNS(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: DNSProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusBadRequest,
}
} | [
"func",
"DNS",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"DNSProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
",",
"a",
"...",... | // DNS returns a ProblemDetails representing a DNSProblem | [
"DNS",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"DNSProblem"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L283-L289 | train |
letsencrypt/boulder | probs/probs.go | OrderNotReady | func OrderNotReady(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: OrderNotReadyProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | go | func OrderNotReady(detail string, a ...interface{}) *ProblemDetails {
return &ProblemDetails{
Type: OrderNotReadyProblem,
Detail: fmt.Sprintf(detail, a...),
HTTPStatus: http.StatusForbidden,
}
} | [
"func",
"OrderNotReady",
"(",
"detail",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"*",
"ProblemDetails",
"{",
"return",
"&",
"ProblemDetails",
"{",
"Type",
":",
"OrderNotReadyProblem",
",",
"Detail",
":",
"fmt",
".",
"Sprintf",
"(",
"detail",
... | // OrderNotReady returns a ProblemDetails representing a OrderNotReadyProblem | [
"OrderNotReady",
"returns",
"a",
"ProblemDetails",
"representing",
"a",
"OrderNotReadyProblem"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/probs/probs.go#L292-L298 | train |
letsencrypt/boulder | mocks/ca.go | IssueCertificate | func (ca *MockCA) IssueCertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (core.Certificate, error) {
if ca.PEM == nil {
return core.Certificate{}, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate")
}
block, _ := pem.Decode(ca.PEM)
cert, err := x509.ParseCertificate(block.... | go | func (ca *MockCA) IssueCertificate(ctx context.Context, _ *caPB.IssueCertificateRequest) (core.Certificate, error) {
if ca.PEM == nil {
return core.Certificate{}, fmt.Errorf("MockCA's PEM field must be set before calling IssueCertificate")
}
block, _ := pem.Decode(ca.PEM)
cert, err := x509.ParseCertificate(block.... | [
"func",
"(",
"ca",
"*",
"MockCA",
")",
"IssueCertificate",
"(",
"ctx",
"context",
".",
"Context",
",",
"_",
"*",
"caPB",
".",
"IssueCertificateRequest",
")",
"(",
"core",
".",
"Certificate",
",",
"error",
")",
"{",
"if",
"ca",
".",
"PEM",
"==",
"nil",
... | // IssueCertificate is a mock | [
"IssueCertificate",
"is",
"a",
"mock"
] | a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf | https://github.com/letsencrypt/boulder/blob/a3d35f51ff716e0d4916ac2c8ce5b6df16a95baf/mocks/ca.go#L22-L34 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.