repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
gobuffalo/buffalo | mail/internal/mail/message.go | NewMessage | func NewMessage(settings ...MessageSetting) *Message {
m := &Message{
header: make(header),
charset: "UTF-8",
encoding: QuotedPrintable,
}
m.applySettings(settings)
if m.encoding == Base64 {
m.hEncoder = bEncoding
} else {
m.hEncoder = qEncoding
}
return m
} | go | func NewMessage(settings ...MessageSetting) *Message {
m := &Message{
header: make(header),
charset: "UTF-8",
encoding: QuotedPrintable,
}
m.applySettings(settings)
if m.encoding == Base64 {
m.hEncoder = bEncoding
} else {
m.hEncoder = qEncoding
}
return m
} | [
"func",
"NewMessage",
"(",
"settings",
"...",
"MessageSetting",
")",
"*",
"Message",
"{",
"m",
":=",
"&",
"Message",
"{",
"header",
":",
"make",
"(",
"header",
")",
",",
"charset",
":",
"\"UTF-8\"",
",",
"encoding",
":",
"QuotedPrintable",
",",
"}",
"\n"... | // NewMessage creates a new message. It uses UTF-8 and quoted-printable encoding
// by default. | [
"NewMessage",
"creates",
"a",
"new",
"message",
".",
"It",
"uses",
"UTF",
"-",
"8",
"and",
"quoted",
"-",
"printable",
"encoding",
"by",
"default",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L34-L50 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | Reset | func (m *Message) Reset() {
for k := range m.header {
delete(m.header, k)
}
m.parts = nil
m.attachments = nil
m.embedded = nil
} | go | func (m *Message) Reset() {
for k := range m.header {
delete(m.header, k)
}
m.parts = nil
m.attachments = nil
m.embedded = nil
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Reset",
"(",
")",
"{",
"for",
"k",
":=",
"range",
"m",
".",
"header",
"{",
"delete",
"(",
"m",
".",
"header",
",",
"k",
")",
"\n",
"}",
"\n",
"m",
".",
"parts",
"=",
"nil",
"\n",
"m",
".",
"attachments"... | // Reset resets the message so it can be reused. The message keeps its previous
// settings so it is in the same state that after a call to NewMessage. | [
"Reset",
"resets",
"the",
"message",
"so",
"it",
"can",
"be",
"reused",
".",
"The",
"message",
"keeps",
"its",
"previous",
"settings",
"so",
"it",
"is",
"in",
"the",
"same",
"state",
"that",
"after",
"a",
"call",
"to",
"NewMessage",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L54-L61 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetHeader | func (m *Message) SetHeader(field string, value ...string) {
m.encodeHeader(value)
m.header[field] = value
} | go | func (m *Message) SetHeader(field string, value ...string) {
m.encodeHeader(value)
m.header[field] = value
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetHeader",
"(",
"field",
"string",
",",
"value",
"...",
"string",
")",
"{",
"m",
".",
"encodeHeader",
"(",
"value",
")",
"\n",
"m",
".",
"header",
"[",
"field",
"]",
"=",
"value",
"\n",
"}"
] | // SetHeader sets a value to the given header field. | [
"SetHeader",
"sets",
"a",
"value",
"to",
"the",
"given",
"header",
"field",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L107-L110 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetHeaders | func (m *Message) SetHeaders(h map[string][]string) {
for k, v := range h {
m.SetHeader(k, v...)
}
} | go | func (m *Message) SetHeaders(h map[string][]string) {
for k, v := range h {
m.SetHeader(k, v...)
}
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetHeaders",
"(",
"h",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"h",
"{",
"m",
".",
"SetHeader",
"(",
"k",
",",
"v",
"...",
")",
"\n",
"}",
"\n",
"... | // SetHeaders sets the message headers. | [
"SetHeaders",
"sets",
"the",
"message",
"headers",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L123-L127 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetAddressHeader | func (m *Message) SetAddressHeader(field, address, name string) {
m.header[field] = []string{m.FormatAddress(address, name)}
} | go | func (m *Message) SetAddressHeader(field, address, name string) {
m.header[field] = []string{m.FormatAddress(address, name)}
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetAddressHeader",
"(",
"field",
",",
"address",
",",
"name",
"string",
")",
"{",
"m",
".",
"header",
"[",
"field",
"]",
"=",
"[",
"]",
"string",
"{",
"m",
".",
"FormatAddress",
"(",
"address",
",",
"name",
"... | // SetAddressHeader sets an address to the given header field. | [
"SetAddressHeader",
"sets",
"an",
"address",
"to",
"the",
"given",
"header",
"field",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L130-L132 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | FormatAddress | func (m *Message) FormatAddress(address, name string) string {
if name == "" {
return address
}
enc := m.encodeString(name)
if enc == name {
m.buf.WriteByte('"')
for i := 0; i < len(name); i++ {
b := name[i]
if b == '\\' || b == '"' {
m.buf.WriteByte('\\')
}
m.buf.WriteByte(b)
}
m.buf.Wri... | go | func (m *Message) FormatAddress(address, name string) string {
if name == "" {
return address
}
enc := m.encodeString(name)
if enc == name {
m.buf.WriteByte('"')
for i := 0; i < len(name); i++ {
b := name[i]
if b == '\\' || b == '"' {
m.buf.WriteByte('\\')
}
m.buf.WriteByte(b)
}
m.buf.Wri... | [
"func",
"(",
"m",
"*",
"Message",
")",
"FormatAddress",
"(",
"address",
",",
"name",
"string",
")",
"string",
"{",
"if",
"name",
"==",
"\"\"",
"{",
"return",
"address",
"\n",
"}",
"\n",
"enc",
":=",
"m",
".",
"encodeString",
"(",
"name",
")",
"\n",
... | // FormatAddress formats an address and a name as a valid RFC 5322 address. | [
"FormatAddress",
"formats",
"an",
"address",
"and",
"a",
"name",
"as",
"a",
"valid",
"RFC",
"5322",
"address",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L135-L163 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetDateHeader | func (m *Message) SetDateHeader(field string, date time.Time) {
m.header[field] = []string{m.FormatDate(date)}
} | go | func (m *Message) SetDateHeader(field string, date time.Time) {
m.header[field] = []string{m.FormatDate(date)}
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetDateHeader",
"(",
"field",
"string",
",",
"date",
"time",
".",
"Time",
")",
"{",
"m",
".",
"header",
"[",
"field",
"]",
"=",
"[",
"]",
"string",
"{",
"m",
".",
"FormatDate",
"(",
"date",
")",
"}",
"\n",
... | // SetDateHeader sets a date to the given header field. | [
"SetDateHeader",
"sets",
"a",
"date",
"to",
"the",
"given",
"header",
"field",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L177-L179 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | FormatDate | func (m *Message) FormatDate(date time.Time) string {
return date.Format(time.RFC1123Z)
} | go | func (m *Message) FormatDate(date time.Time) string {
return date.Format(time.RFC1123Z)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"FormatDate",
"(",
"date",
"time",
".",
"Time",
")",
"string",
"{",
"return",
"date",
".",
"Format",
"(",
"time",
".",
"RFC1123Z",
")",
"\n",
"}"
] | // FormatDate formats a date as a valid RFC 5322 date. | [
"FormatDate",
"formats",
"a",
"date",
"as",
"a",
"valid",
"RFC",
"5322",
"date",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L182-L184 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetBody | func (m *Message) SetBody(contentType, body string, settings ...PartSetting) {
m.SetBodyWriter(contentType, newCopier(body), settings...)
} | go | func (m *Message) SetBody(contentType, body string, settings ...PartSetting) {
m.SetBodyWriter(contentType, newCopier(body), settings...)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetBody",
"(",
"contentType",
",",
"body",
"string",
",",
"settings",
"...",
"PartSetting",
")",
"{",
"m",
".",
"SetBodyWriter",
"(",
"contentType",
",",
"newCopier",
"(",
"body",
")",
",",
"settings",
"...",
")",
... | // SetBody sets the body of the message. It replaces any content previously set
// by SetBody, SetBodyWriter, AddAlternative or AddAlternativeWriter. | [
"SetBody",
"sets",
"the",
"body",
"of",
"the",
"message",
".",
"It",
"replaces",
"any",
"content",
"previously",
"set",
"by",
"SetBody",
"SetBodyWriter",
"AddAlternative",
"or",
"AddAlternativeWriter",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L193-L195 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetPartEncoding | func SetPartEncoding(e Encoding) PartSetting {
return PartSetting(func(p *part) {
p.encoding = e
})
} | go | func SetPartEncoding(e Encoding) PartSetting {
return PartSetting(func(p *part) {
p.encoding = e
})
} | [
"func",
"SetPartEncoding",
"(",
"e",
"Encoding",
")",
"PartSetting",
"{",
"return",
"PartSetting",
"(",
"func",
"(",
"p",
"*",
"part",
")",
"{",
"p",
".",
"encoding",
"=",
"e",
"\n",
"}",
")",
"\n",
"}"
] | // SetPartEncoding sets the encoding of the part added to the message. By
// default, parts use the same encoding than the message. | [
"SetPartEncoding",
"sets",
"the",
"encoding",
"of",
"the",
"part",
"added",
"to",
"the",
"message",
".",
"By",
"default",
"parts",
"use",
"the",
"same",
"encoding",
"than",
"the",
"message",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L247-L251 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetHeader | func SetHeader(h map[string][]string) FileSetting {
return func(f *file) {
for k, v := range h {
f.Header[k] = v
}
}
} | go | func SetHeader(h map[string][]string) FileSetting {
return func(f *file) {
for k, v := range h {
f.Header[k] = v
}
}
} | [
"func",
"SetHeader",
"(",
"h",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"FileSetting",
"{",
"return",
"func",
"(",
"f",
"*",
"file",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"h",
"{",
"f",
".",
"Header",
"[",
"k",
"]",
"=",
"... | // SetHeader is a file setting to set the MIME header of the message part that
// contains the file content.
//
// Mandatory headers are automatically added if they are not set when sending
// the email. | [
"SetHeader",
"is",
"a",
"file",
"setting",
"to",
"set",
"the",
"MIME",
"header",
"of",
"the",
"message",
"part",
"that",
"contains",
"the",
"file",
"content",
".",
"Mandatory",
"headers",
"are",
"automatically",
"added",
"if",
"they",
"are",
"not",
"set",
... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L271-L277 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | SetCopyFunc | func SetCopyFunc(f func(io.Writer) error) FileSetting {
return func(fi *file) {
fi.CopyFunc = f
}
} | go | func SetCopyFunc(f func(io.Writer) error) FileSetting {
return func(fi *file) {
fi.CopyFunc = f
}
} | [
"func",
"SetCopyFunc",
"(",
"f",
"func",
"(",
"io",
".",
"Writer",
")",
"error",
")",
"FileSetting",
"{",
"return",
"func",
"(",
"fi",
"*",
"file",
")",
"{",
"fi",
".",
"CopyFunc",
"=",
"f",
"\n",
"}",
"\n",
"}"
] | // SetCopyFunc is a file setting to replace the function that runs when the
// message is sent. It should copy the content of the file to the io.Writer.
//
// The default copy function opens the file with the given filename, and copy
// its content to the io.Writer. | [
"SetCopyFunc",
"is",
"a",
"file",
"setting",
"to",
"replace",
"the",
"function",
"that",
"runs",
"when",
"the",
"message",
"is",
"sent",
".",
"It",
"should",
"copy",
"the",
"content",
"of",
"the",
"file",
"to",
"the",
"io",
".",
"Writer",
".",
"The",
"... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L292-L296 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | AttachReader | func (m *Message) AttachReader(name string, r io.Reader, settings ...FileSetting) {
m.attachments = m.appendFile(m.attachments, fileFromReader(name, r), settings)
} | go | func (m *Message) AttachReader(name string, r io.Reader, settings ...FileSetting) {
m.attachments = m.appendFile(m.attachments, fileFromReader(name, r), settings)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"AttachReader",
"(",
"name",
"string",
",",
"r",
"io",
".",
"Reader",
",",
"settings",
"...",
"FileSetting",
")",
"{",
"m",
".",
"attachments",
"=",
"m",
".",
"appendFile",
"(",
"m",
".",
"attachments",
",",
"fi... | // AttachReader attaches a file using an io.Reader | [
"AttachReader",
"attaches",
"a",
"file",
"using",
"an",
"io",
".",
"Reader"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L299-L301 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | Attach | func (m *Message) Attach(filename string, settings ...FileSetting) {
m.attachments = m.appendFile(m.attachments, fileFromFilename(filename), settings)
} | go | func (m *Message) Attach(filename string, settings ...FileSetting) {
m.attachments = m.appendFile(m.attachments, fileFromFilename(filename), settings)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Attach",
"(",
"filename",
"string",
",",
"settings",
"...",
"FileSetting",
")",
"{",
"m",
".",
"attachments",
"=",
"m",
".",
"appendFile",
"(",
"m",
".",
"attachments",
",",
"fileFromFilename",
"(",
"filename",
")"... | // Attach attaches the files to the email. | [
"Attach",
"attaches",
"the",
"files",
"to",
"the",
"email",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L304-L306 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | EmbedReader | func (m *Message) EmbedReader(name string, r io.Reader, settings ...FileSetting) {
m.embedded = m.appendFile(m.embedded, fileFromReader(name, r), settings)
} | go | func (m *Message) EmbedReader(name string, r io.Reader, settings ...FileSetting) {
m.embedded = m.appendFile(m.embedded, fileFromReader(name, r), settings)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"EmbedReader",
"(",
"name",
"string",
",",
"r",
"io",
".",
"Reader",
",",
"settings",
"...",
"FileSetting",
")",
"{",
"m",
".",
"embedded",
"=",
"m",
".",
"appendFile",
"(",
"m",
".",
"embedded",
",",
"fileFromR... | // EmbedReader embeds the images to the email. | [
"EmbedReader",
"embeds",
"the",
"images",
"to",
"the",
"email",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L309-L311 | test |
gobuffalo/buffalo | mail/internal/mail/message.go | Embed | func (m *Message) Embed(filename string, settings ...FileSetting) {
m.embedded = m.appendFile(m.embedded, fileFromFilename(filename), settings)
} | go | func (m *Message) Embed(filename string, settings ...FileSetting) {
m.embedded = m.appendFile(m.embedded, fileFromFilename(filename), settings)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Embed",
"(",
"filename",
"string",
",",
"settings",
"...",
"FileSetting",
")",
"{",
"m",
".",
"embedded",
"=",
"m",
".",
"appendFile",
"(",
"m",
".",
"embedded",
",",
"fileFromFilename",
"(",
"filename",
")",
","... | // Embed embeds the images to the email. | [
"Embed",
"embeds",
"the",
"images",
"to",
"the",
"email",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/message.go#L314-L316 | test |
gobuffalo/buffalo | genny/build/validate.go | ValidateTemplates | func ValidateTemplates(walk packd.Walker, tvs []TemplateValidator) genny.RunFn {
if len(tvs) == 0 {
return func(r *genny.Runner) error {
return nil
}
}
return func(r *genny.Runner) error {
var errs []string
err := packd.SkipWalker(walk, packd.CommonSkipPrefixes, func(path string, file packd.File) error {
... | go | func ValidateTemplates(walk packd.Walker, tvs []TemplateValidator) genny.RunFn {
if len(tvs) == 0 {
return func(r *genny.Runner) error {
return nil
}
}
return func(r *genny.Runner) error {
var errs []string
err := packd.SkipWalker(walk, packd.CommonSkipPrefixes, func(path string, file packd.File) error {
... | [
"func",
"ValidateTemplates",
"(",
"walk",
"packd",
".",
"Walker",
",",
"tvs",
"[",
"]",
"TemplateValidator",
")",
"genny",
".",
"RunFn",
"{",
"if",
"len",
"(",
"tvs",
")",
"==",
"0",
"{",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
... | // ValidateTemplates returns a genny.RunFn that will walk the
// given box and run each of the files found through each of the
// template validators | [
"ValidateTemplates",
"returns",
"a",
"genny",
".",
"RunFn",
"that",
"will",
"walk",
"the",
"given",
"box",
"and",
"run",
"each",
"of",
"the",
"files",
"found",
"through",
"each",
"of",
"the",
"template",
"validators"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/build/validate.go#L24-L63 | test |
gobuffalo/buffalo | genny/build/validate.go | PlushValidator | func PlushValidator(f genny.File) error {
if !genny.HasExt(f, ".html", ".md", ".plush") {
return nil
}
_, err := plush.Parse(f.String())
return err
} | go | func PlushValidator(f genny.File) error {
if !genny.HasExt(f, ".html", ".md", ".plush") {
return nil
}
_, err := plush.Parse(f.String())
return err
} | [
"func",
"PlushValidator",
"(",
"f",
"genny",
".",
"File",
")",
"error",
"{",
"if",
"!",
"genny",
".",
"HasExt",
"(",
"f",
",",
"\".html\"",
",",
"\".md\"",
",",
"\".plush\"",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"plush... | // PlushValidator validates the file is a valid
// Plush file if the extension is .md, .html, or .plush | [
"PlushValidator",
"validates",
"the",
"file",
"is",
"a",
"valid",
"Plush",
"file",
"if",
"the",
"extension",
"is",
".",
"md",
".",
"html",
"or",
".",
"plush"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/build/validate.go#L67-L73 | test |
gobuffalo/buffalo | genny/mail/options.go | Validate | func (opts *Options) Validate() error {
if opts.App.IsZero() {
opts.App = meta.New(".")
}
if len(opts.Name.String()) == 0 {
return errors.New("you must supply a name for your mailer")
}
return nil
} | go | func (opts *Options) Validate() error {
if opts.App.IsZero() {
opts.App = meta.New(".")
}
if len(opts.Name.String()) == 0 {
return errors.New("you must supply a name for your mailer")
}
return nil
} | [
"func",
"(",
"opts",
"*",
"Options",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"opts",
".",
"App",
".",
"IsZero",
"(",
")",
"{",
"opts",
".",
"App",
"=",
"meta",
".",
"New",
"(",
"\".\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"opts",
"... | // Validate options are useful | [
"Validate",
"options",
"are",
"useful"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/mail/options.go#L18-L27 | test |
gobuffalo/buffalo | plugins.go | LoadPlugins | func LoadPlugins() error {
var err error
oncer.Do("events.LoadPlugins", func() {
// don't send plugins events during testing
if envy.Get("GO_ENV", "development") == "test" {
return
}
plugs, err := plugins.Available()
if err != nil {
err = err
return
}
for _, cmds := range plugs {
for _, c :=... | go | func LoadPlugins() error {
var err error
oncer.Do("events.LoadPlugins", func() {
// don't send plugins events during testing
if envy.Get("GO_ENV", "development") == "test" {
return
}
plugs, err := plugins.Available()
if err != nil {
err = err
return
}
for _, cmds := range plugs {
for _, c :=... | [
"func",
"LoadPlugins",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"oncer",
".",
"Do",
"(",
"\"events.LoadPlugins\"",
",",
"func",
"(",
")",
"{",
"if",
"envy",
".",
"Get",
"(",
"\"GO_ENV\"",
",",
"\"development\"",
")",
"==",
"\"test\"",
"{",
... | // LoadPlugins will add listeners for any plugins that support "events" | [
"LoadPlugins",
"will",
"add",
"listeners",
"for",
"any",
"plugins",
"that",
"support",
"events"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/plugins.go#L18-L68 | test |
gobuffalo/buffalo | response.go | WriteHeader | func (w *Response) WriteHeader(i int) {
w.Status = i
w.ResponseWriter.WriteHeader(i)
} | go | func (w *Response) WriteHeader(i int) {
w.Status = i
w.ResponseWriter.WriteHeader(i)
} | [
"func",
"(",
"w",
"*",
"Response",
")",
"WriteHeader",
"(",
"i",
"int",
")",
"{",
"w",
".",
"Status",
"=",
"i",
"\n",
"w",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"i",
")",
"\n",
"}"
] | // WriteHeader sets the status code for a response | [
"WriteHeader",
"sets",
"the",
"status",
"code",
"for",
"a",
"response"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/response.go#L22-L25 | test |
gobuffalo/buffalo | response.go | Write | func (w *Response) Write(b []byte) (int, error) {
w.Size = binary.Size(b)
return w.ResponseWriter.Write(b)
} | go | func (w *Response) Write(b []byte) (int, error) {
w.Size = binary.Size(b)
return w.ResponseWriter.Write(b)
} | [
"func",
"(",
"w",
"*",
"Response",
")",
"Write",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"w",
".",
"Size",
"=",
"binary",
".",
"Size",
"(",
"b",
")",
"\n",
"return",
"w",
".",
"ResponseWriter",
".",
"Write",
"(",
... | // Write the body of the response | [
"Write",
"the",
"body",
"of",
"the",
"response"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/response.go#L28-L31 | test |
gobuffalo/buffalo | response.go | Flush | func (w *Response) Flush() {
if f, ok := w.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
} | go | func (w *Response) Flush() {
if f, ok := w.ResponseWriter.(http.Flusher); ok {
f.Flush()
}
} | [
"func",
"(",
"w",
"*",
"Response",
")",
"Flush",
"(",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"http",
".",
"Flusher",
")",
";",
"ok",
"{",
"f",
".",
"Flush",
"(",
")",
"\n",
"}",
"\n",
"}"
] | // Flush the response | [
"Flush",
"the",
"response"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/response.go#L42-L46 | test |
gobuffalo/buffalo | response.go | CloseNotify | func (w *Response) CloseNotify() <-chan bool {
if cn, ok := w.ResponseWriter.(closeNotifier); ok {
return cn.CloseNotify()
}
return nil
} | go | func (w *Response) CloseNotify() <-chan bool {
if cn, ok := w.ResponseWriter.(closeNotifier); ok {
return cn.CloseNotify()
}
return nil
} | [
"func",
"(",
"w",
"*",
"Response",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"if",
"cn",
",",
"ok",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"closeNotifier",
")",
";",
"ok",
"{",
"return",
"cn",
".",
"CloseNotify",
"(",
")",
"\n",... | // CloseNotify implements the http.CloseNotifier interface | [
"CloseNotify",
"implements",
"the",
"http",
".",
"CloseNotifier",
"interface"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/response.go#L53-L58 | test |
gobuffalo/buffalo | buffalo/cmd/fix/runner.go | Run | func Run() error {
fmt.Printf("! This updater will attempt to update your application to Buffalo version: %s\n", runtime.Version)
if !ask("Do you wish to continue?") {
fmt.Println("~~~ cancelling update ~~~")
return nil
}
r := &Runner{
App: meta.New("."),
Warnings: []string{},
}
defer func() {
if... | go | func Run() error {
fmt.Printf("! This updater will attempt to update your application to Buffalo version: %s\n", runtime.Version)
if !ask("Do you wish to continue?") {
fmt.Println("~~~ cancelling update ~~~")
return nil
}
r := &Runner{
App: meta.New("."),
Warnings: []string{},
}
defer func() {
if... | [
"func",
"Run",
"(",
")",
"error",
"{",
"fmt",
".",
"Printf",
"(",
"\"! This updater will attempt to update your application to Buffalo version: %s\\n\"",
",",
"\\n",
")",
"\n",
"runtime",
".",
"Version",
"\n",
"if",
"!",
"ask",
"(",
"\"Do you wish to continue?\"",
")"... | // Run all compatible checks | [
"Run",
"all",
"compatible",
"checks"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/buffalo/cmd/fix/runner.go#L20-L50 | test |
gobuffalo/buffalo | buffalo/cmd/fix/middleware.go | onlyRelevantFiles | func onlyRelevantFiles(p string, fi os.FileInfo, err error, fn func(p string) error) error {
if err != nil {
return err
}
if fi.IsDir() {
base := filepath.Base(p)
if strings.HasPrefix(base, "_") {
return filepath.SkipDir
}
for _, n := range []string{"vendor", "node_modules", ".git"} {
if base == n {... | go | func onlyRelevantFiles(p string, fi os.FileInfo, err error, fn func(p string) error) error {
if err != nil {
return err
}
if fi.IsDir() {
base := filepath.Base(p)
if strings.HasPrefix(base, "_") {
return filepath.SkipDir
}
for _, n := range []string{"vendor", "node_modules", ".git"} {
if base == n {... | [
"func",
"onlyRelevantFiles",
"(",
"p",
"string",
",",
"fi",
"os",
".",
"FileInfo",
",",
"err",
"error",
",",
"fn",
"func",
"(",
"p",
"string",
")",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
... | //onlyRelevantFiles processes only .go files excluding folders like node_modules and vendor. | [
"onlyRelevantFiles",
"processes",
"only",
".",
"go",
"files",
"excluding",
"folders",
"like",
"node_modules",
"and",
"vendor",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/buffalo/cmd/fix/middleware.go#L137-L161 | test |
gobuffalo/buffalo | render/template_engine.go | GoTemplateEngine | func GoTemplateEngine(input string, data map[string]interface{}, helpers map[string]interface{}) (string, error) {
// since go templates don't have the concept of an optional map argument like Plush does
// add this "null" map so it can be used in templates like this:
// {{ partial "flash.html" .nilOpts }}
data["ni... | go | func GoTemplateEngine(input string, data map[string]interface{}, helpers map[string]interface{}) (string, error) {
// since go templates don't have the concept of an optional map argument like Plush does
// add this "null" map so it can be used in templates like this:
// {{ partial "flash.html" .nilOpts }}
data["ni... | [
"func",
"GoTemplateEngine",
"(",
"input",
"string",
",",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"helpers",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"data",
"[",
"\"nilOpts\"",... | // GoTemplateEngine implements the TemplateEngine interface for using standard Go templates | [
"GoTemplateEngine",
"implements",
"the",
"TemplateEngine",
"interface",
"for",
"using",
"standard",
"Go",
"templates"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/render/template_engine.go#L12-L31 | test |
gobuffalo/buffalo | route_mappings.go | GET | func (a *App) GET(p string, h Handler) *RouteInfo {
return a.addRoute("GET", p, h)
} | go | func (a *App) GET(p string, h Handler) *RouteInfo {
return a.addRoute("GET", p, h)
} | [
"func",
"(",
"a",
"*",
"App",
")",
"GET",
"(",
"p",
"string",
",",
"h",
"Handler",
")",
"*",
"RouteInfo",
"{",
"return",
"a",
".",
"addRoute",
"(",
"\"GET\"",
",",
"p",
",",
"h",
")",
"\n",
"}"
] | // GET maps an HTTP "GET" request to the path and the specified handler. | [
"GET",
"maps",
"an",
"HTTP",
"GET",
"request",
"to",
"the",
"path",
"and",
"the",
"specified",
"handler",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_mappings.go#L24-L26 | test |
gobuffalo/buffalo | route_mappings.go | Redirect | func (a *App) Redirect(status int, from, to string) *RouteInfo {
return a.GET(from, func(c Context) error {
return c.Redirect(status, to)
})
} | go | func (a *App) Redirect(status int, from, to string) *RouteInfo {
return a.GET(from, func(c Context) error {
return c.Redirect(status, to)
})
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Redirect",
"(",
"status",
"int",
",",
"from",
",",
"to",
"string",
")",
"*",
"RouteInfo",
"{",
"return",
"a",
".",
"GET",
"(",
"from",
",",
"func",
"(",
"c",
"Context",
")",
"error",
"{",
"return",
"c",
".",
... | // Redirect from one URL to another URL. Only works for "GET" requests. | [
"Redirect",
"from",
"one",
"URL",
"to",
"another",
"URL",
".",
"Only",
"works",
"for",
"GET",
"requests",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_mappings.go#L59-L63 | test |
gobuffalo/buffalo | route_mappings.go | ANY | func (a *App) ANY(p string, h Handler) {
a.GET(p, h)
a.POST(p, h)
a.PUT(p, h)
a.PATCH(p, h)
a.HEAD(p, h)
a.OPTIONS(p, h)
a.DELETE(p, h)
} | go | func (a *App) ANY(p string, h Handler) {
a.GET(p, h)
a.POST(p, h)
a.PUT(p, h)
a.PATCH(p, h)
a.HEAD(p, h)
a.OPTIONS(p, h)
a.DELETE(p, h)
} | [
"func",
"(",
"a",
"*",
"App",
")",
"ANY",
"(",
"p",
"string",
",",
"h",
"Handler",
")",
"{",
"a",
".",
"GET",
"(",
"p",
",",
"h",
")",
"\n",
"a",
".",
"POST",
"(",
"p",
",",
"h",
")",
"\n",
"a",
".",
"PUT",
"(",
"p",
",",
"h",
")",
"\... | // ANY accepts a request across any HTTP method for the specified path
// and routes it to the specified Handler. | [
"ANY",
"accepts",
"a",
"request",
"across",
"any",
"HTTP",
"method",
"for",
"the",
"specified",
"path",
"and",
"routes",
"it",
"to",
"the",
"specified",
"Handler",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_mappings.go#L198-L206 | test |
gobuffalo/buffalo | route_mappings.go | buildRouteName | func (a *App) buildRouteName(p string) string {
if p == "/" || p == "" {
return "root"
}
resultParts := []string{}
parts := strings.Split(p, "/")
for index, part := range parts {
if strings.Contains(part, "{") || part == "" {
continue
}
shouldSingularize := (len(parts) > index+1) && strings.Contains... | go | func (a *App) buildRouteName(p string) string {
if p == "/" || p == "" {
return "root"
}
resultParts := []string{}
parts := strings.Split(p, "/")
for index, part := range parts {
if strings.Contains(part, "{") || part == "" {
continue
}
shouldSingularize := (len(parts) > index+1) && strings.Contains... | [
"func",
"(",
"a",
"*",
"App",
")",
"buildRouteName",
"(",
"p",
"string",
")",
"string",
"{",
"if",
"p",
"==",
"\"/\"",
"||",
"p",
"==",
"\"\"",
"{",
"return",
"\"root\"",
"\n",
"}",
"\n",
"resultParts",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"... | //buildRouteName builds a route based on the path passed. | [
"buildRouteName",
"builds",
"a",
"route",
"based",
"on",
"the",
"path",
"passed",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_mappings.go#L278-L316 | test |
gobuffalo/buffalo | genny/mail/mail.go | New | func New(opts *Options) (*genny.Group, error) {
gg := &genny.Group{}
if err := opts.Validate(); err != nil {
return gg, err
}
if !opts.SkipInit {
g, err := initGenerator(opts)
if err != nil {
return gg, err
}
gg.Add(g)
}
g := genny.New()
h := template.FuncMap{}
data := map[string]interface{}{
... | go | func New(opts *Options) (*genny.Group, error) {
gg := &genny.Group{}
if err := opts.Validate(); err != nil {
return gg, err
}
if !opts.SkipInit {
g, err := initGenerator(opts)
if err != nil {
return gg, err
}
gg.Add(g)
}
g := genny.New()
h := template.FuncMap{}
data := map[string]interface{}{
... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Group",
",",
"error",
")",
"{",
"gg",
":=",
"&",
"genny",
".",
"Group",
"{",
"}",
"\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"... | // New mailer generator. It will init the mailers directory if it doesn't already exist | [
"New",
"mailer",
"generator",
".",
"It",
"will",
"init",
"the",
"mailers",
"directory",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/mail/mail.go#L12-L41 | test |
gobuffalo/buffalo | mail/internal/mail/smtp.go | NewDialer | func NewDialer(host string, port int, username, password string) *Dialer {
return &Dialer{
Host: host,
Port: port,
Username: username,
Password: password,
SSL: port == 465,
Timeout: 10 * time.Second,
RetryFailure: true,
}
} | go | func NewDialer(host string, port int, username, password string) *Dialer {
return &Dialer{
Host: host,
Port: port,
Username: username,
Password: password,
SSL: port == 465,
Timeout: 10 * time.Second,
RetryFailure: true,
}
} | [
"func",
"NewDialer",
"(",
"host",
"string",
",",
"port",
"int",
",",
"username",
",",
"password",
"string",
")",
"*",
"Dialer",
"{",
"return",
"&",
"Dialer",
"{",
"Host",
":",
"host",
",",
"Port",
":",
"port",
",",
"Username",
":",
"username",
",",
"... | // NewDialer returns a new SMTP Dialer. The given parameters are used to connect
// to the SMTP server. | [
"NewDialer",
"returns",
"a",
"new",
"SMTP",
"Dialer",
".",
"The",
"given",
"parameters",
"are",
"used",
"to",
"connect",
"to",
"the",
"SMTP",
"server",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/smtp.go#L54-L64 | test |
gobuffalo/buffalo | mail/internal/mail/smtp.go | Dial | func (d *Dialer) Dial() (SendCloser, error) {
conn, err := NetDialTimeout("tcp", addr(d.Host, d.Port), d.Timeout)
if err != nil {
return nil, err
}
if d.SSL {
conn = tlsClient(conn, d.tlsConfig())
}
c, err := smtpNewClient(conn, d.Host)
if err != nil {
return nil, err
}
if d.Timeout > 0 {
conn.SetDe... | go | func (d *Dialer) Dial() (SendCloser, error) {
conn, err := NetDialTimeout("tcp", addr(d.Host, d.Port), d.Timeout)
if err != nil {
return nil, err
}
if d.SSL {
conn = tlsClient(conn, d.tlsConfig())
}
c, err := smtpNewClient(conn, d.Host)
if err != nil {
return nil, err
}
if d.Timeout > 0 {
conn.SetDe... | [
"func",
"(",
"d",
"*",
"Dialer",
")",
"Dial",
"(",
")",
"(",
"SendCloser",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"NetDialTimeout",
"(",
"\"tcp\"",
",",
"addr",
"(",
"d",
".",
"Host",
",",
"d",
".",
"Port",
")",
",",
"d",
".",
"Timeo... | // Dial dials and authenticates to an SMTP server. The returned SendCloser
// should be closed when done using it. | [
"Dial",
"dials",
"and",
"authenticates",
"to",
"an",
"SMTP",
"server",
".",
"The",
"returned",
"SendCloser",
"should",
"be",
"closed",
"when",
"done",
"using",
"it",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/smtp.go#L73-L139 | test |
gobuffalo/buffalo | mail/internal/mail/smtp.go | DialAndSend | func (d *Dialer) DialAndSend(m ...*Message) error {
s, err := d.Dial()
if err != nil {
return err
}
defer s.Close()
return Send(s, m...)
} | go | func (d *Dialer) DialAndSend(m ...*Message) error {
s, err := d.Dial()
if err != nil {
return err
}
defer s.Close()
return Send(s, m...)
} | [
"func",
"(",
"d",
"*",
"Dialer",
")",
"DialAndSend",
"(",
"m",
"...",
"*",
"Message",
")",
"error",
"{",
"s",
",",
"err",
":=",
"d",
".",
"Dial",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"s",
"... | // DialAndSend opens a connection to the SMTP server, sends the given emails and
// closes the connection. | [
"DialAndSend",
"opens",
"a",
"connection",
"to",
"the",
"SMTP",
"server",
"sends",
"the",
"given",
"emails",
"and",
"closes",
"the",
"connection",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/smtp.go#L195-L203 | test |
gobuffalo/buffalo | flash.go | Set | func (f Flash) Set(key string, values []string) {
f.data[key] = values
} | go | func (f Flash) Set(key string, values []string) {
f.data[key] = values
} | [
"func",
"(",
"f",
"Flash",
")",
"Set",
"(",
"key",
"string",
",",
"values",
"[",
"]",
"string",
")",
"{",
"f",
".",
"data",
"[",
"key",
"]",
"=",
"values",
"\n",
"}"
] | //Set allows to set a list of values into a particular key. | [
"Set",
"allows",
"to",
"set",
"a",
"list",
"of",
"values",
"into",
"a",
"particular",
"key",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/flash.go#L24-L26 | test |
gobuffalo/buffalo | flash.go | Add | func (f Flash) Add(key, value string) {
if len(f.data[key]) == 0 {
f.data[key] = []string{value}
return
}
f.data[key] = append(f.data[key], value)
} | go | func (f Flash) Add(key, value string) {
if len(f.data[key]) == 0 {
f.data[key] = []string{value}
return
}
f.data[key] = append(f.data[key], value)
} | [
"func",
"(",
"f",
"Flash",
")",
"Add",
"(",
"key",
",",
"value",
"string",
")",
"{",
"if",
"len",
"(",
"f",
".",
"data",
"[",
"key",
"]",
")",
"==",
"0",
"{",
"f",
".",
"data",
"[",
"key",
"]",
"=",
"[",
"]",
"string",
"{",
"value",
"}",
... | //Add adds a flash value for a flash key, if the key already has values the list for that value grows. | [
"Add",
"adds",
"a",
"flash",
"value",
"for",
"a",
"flash",
"key",
"if",
"the",
"key",
"already",
"has",
"values",
"the",
"list",
"for",
"that",
"value",
"grows",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/flash.go#L29-L36 | test |
gobuffalo/buffalo | flash.go | persist | func (f Flash) persist(session *Session) {
b, _ := json.Marshal(f.data)
session.Set(flashKey, b)
session.Save()
} | go | func (f Flash) persist(session *Session) {
b, _ := json.Marshal(f.data)
session.Set(flashKey, b)
session.Save()
} | [
"func",
"(",
"f",
"Flash",
")",
"persist",
"(",
"session",
"*",
"Session",
")",
"{",
"b",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"f",
".",
"data",
")",
"\n",
"session",
".",
"Set",
"(",
"flashKey",
",",
"b",
")",
"\n",
"session",
".",
"Sa... | //Persist the flash inside the session. | [
"Persist",
"the",
"flash",
"inside",
"the",
"session",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/flash.go#L39-L43 | test |
gobuffalo/buffalo | flash.go | newFlash | func newFlash(session *Session) *Flash {
result := &Flash{
data: map[string][]string{},
}
if session.Session != nil {
if f := session.Get(flashKey); f != nil {
json.Unmarshal(f.([]byte), &result.data)
}
}
return result
} | go | func newFlash(session *Session) *Flash {
result := &Flash{
data: map[string][]string{},
}
if session.Session != nil {
if f := session.Get(flashKey); f != nil {
json.Unmarshal(f.([]byte), &result.data)
}
}
return result
} | [
"func",
"newFlash",
"(",
"session",
"*",
"Session",
")",
"*",
"Flash",
"{",
"result",
":=",
"&",
"Flash",
"{",
"data",
":",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
",",
"}",
"\n",
"if",
"session",
".",
"Session",
"!=",
"nil",
"{"... | //newFlash creates a new Flash and loads the session data inside its data. | [
"newFlash",
"creates",
"a",
"new",
"Flash",
"and",
"loads",
"the",
"session",
"data",
"inside",
"its",
"data",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/flash.go#L46-L57 | test |
gobuffalo/buffalo | cookies.go | Get | func (c *Cookies) Get(name string) (string, error) {
ck, err := c.req.Cookie(name)
if err != nil {
return "", err
}
return ck.Value, nil
} | go | func (c *Cookies) Get(name string) (string, error) {
ck, err := c.req.Cookie(name)
if err != nil {
return "", err
}
return ck.Value, nil
} | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ck",
",",
"err",
":=",
"c",
".",
"req",
".",
"Cookie",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
... | // Get returns the value of the cookie with the given name. Returns http.ErrNoCookie if there's no cookie with that name in the request. | [
"Get",
"returns",
"the",
"value",
"of",
"the",
"cookie",
"with",
"the",
"given",
"name",
".",
"Returns",
"http",
".",
"ErrNoCookie",
"if",
"there",
"s",
"no",
"cookie",
"with",
"that",
"name",
"in",
"the",
"request",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/cookies.go#L15-L22 | test |
gobuffalo/buffalo | cookies.go | Set | func (c *Cookies) Set(name, value string, maxAge time.Duration) {
ck := http.Cookie{
Name: name,
Value: value,
MaxAge: int(maxAge.Seconds()),
}
http.SetCookie(c.res, &ck)
} | go | func (c *Cookies) Set(name, value string, maxAge time.Duration) {
ck := http.Cookie{
Name: name,
Value: value,
MaxAge: int(maxAge.Seconds()),
}
http.SetCookie(c.res, &ck)
} | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"Set",
"(",
"name",
",",
"value",
"string",
",",
"maxAge",
"time",
".",
"Duration",
")",
"{",
"ck",
":=",
"http",
".",
"Cookie",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"value",
",",
"MaxAge",
":",
"int... | // Set a cookie on the response, which will expire after the given duration. | [
"Set",
"a",
"cookie",
"on",
"the",
"response",
"which",
"will",
"expire",
"after",
"the",
"given",
"duration",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/cookies.go#L25-L33 | test |
gobuffalo/buffalo | cookies.go | SetWithExpirationTime | func (c *Cookies) SetWithExpirationTime(name, value string, expires time.Time) {
ck := http.Cookie{
Name: name,
Value: value,
Expires: expires,
}
http.SetCookie(c.res, &ck)
} | go | func (c *Cookies) SetWithExpirationTime(name, value string, expires time.Time) {
ck := http.Cookie{
Name: name,
Value: value,
Expires: expires,
}
http.SetCookie(c.res, &ck)
} | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"SetWithExpirationTime",
"(",
"name",
",",
"value",
"string",
",",
"expires",
"time",
".",
"Time",
")",
"{",
"ck",
":=",
"http",
".",
"Cookie",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"value",
",",
"Expires... | // SetWithExpirationTime sets a cookie that will expire at a specific time.
// Note that the time is determined by the client's browser, so it might not expire at the expected time,
// for example if the client has changed the time on their computer. | [
"SetWithExpirationTime",
"sets",
"a",
"cookie",
"that",
"will",
"expire",
"at",
"a",
"specific",
"time",
".",
"Note",
"that",
"the",
"time",
"is",
"determined",
"by",
"the",
"client",
"s",
"browser",
"so",
"it",
"might",
"not",
"expire",
"at",
"the",
"expe... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/cookies.go#L38-L46 | test |
gobuffalo/buffalo | cookies.go | Delete | func (c *Cookies) Delete(name string) {
ck := http.Cookie{
Name: name,
Value: "v",
// Setting a time in the distant past, like the unix epoch, removes the cookie,
// since it has long expired.
Expires: time.Unix(0, 0),
}
http.SetCookie(c.res, &ck)
} | go | func (c *Cookies) Delete(name string) {
ck := http.Cookie{
Name: name,
Value: "v",
// Setting a time in the distant past, like the unix epoch, removes the cookie,
// since it has long expired.
Expires: time.Unix(0, 0),
}
http.SetCookie(c.res, &ck)
} | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"Delete",
"(",
"name",
"string",
")",
"{",
"ck",
":=",
"http",
".",
"Cookie",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"\"v\"",
",",
"Expires",
":",
"time",
".",
"Unix",
"(",
"0",
",",
"0",
")",
",",
... | // Delete sets a header that tells the browser to remove the cookie with the given name. | [
"Delete",
"sets",
"a",
"header",
"that",
"tells",
"the",
"browser",
"to",
"remove",
"the",
"cookie",
"with",
"the",
"given",
"name",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/cookies.go#L63-L73 | test |
gobuffalo/buffalo | mail/mail.go | NewMessage | func NewMessage() Message {
return Message{
Context: context.Background(),
Headers: map[string]string{},
Data: render.Data{},
moot: &sync.RWMutex{},
}
} | go | func NewMessage() Message {
return Message{
Context: context.Background(),
Headers: map[string]string{},
Data: render.Data{},
moot: &sync.RWMutex{},
}
} | [
"func",
"NewMessage",
"(",
")",
"Message",
"{",
"return",
"Message",
"{",
"Context",
":",
"context",
".",
"Background",
"(",
")",
",",
"Headers",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
",",
"Data",
":",
"render",
".",
"Data",
"{",
"}",
... | // NewMessage builds a new message. | [
"NewMessage",
"builds",
"a",
"new",
"message",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/mail.go#L12-L19 | test |
gobuffalo/buffalo | mail/mail.go | NewFromData | func NewFromData(data render.Data) Message {
d := render.Data{}
for k, v := range data {
d[k] = v
}
m := NewMessage()
m.Data = d
return m
} | go | func NewFromData(data render.Data) Message {
d := render.Data{}
for k, v := range data {
d[k] = v
}
m := NewMessage()
m.Data = d
return m
} | [
"func",
"NewFromData",
"(",
"data",
"render",
".",
"Data",
")",
"Message",
"{",
"d",
":=",
"render",
".",
"Data",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"d",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"m",
":=",
"New... | // NewFromData builds a new message with raw template data given | [
"NewFromData",
"builds",
"a",
"new",
"message",
"with",
"raw",
"template",
"data",
"given"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/mail.go#L22-L30 | test |
gobuffalo/buffalo | mail/mail.go | New | func New(c buffalo.Context) Message {
m := NewFromData(c.Data())
m.Context = c
return m
} | go | func New(c buffalo.Context) Message {
m := NewFromData(c.Data())
m.Context = c
return m
} | [
"func",
"New",
"(",
"c",
"buffalo",
".",
"Context",
")",
"Message",
"{",
"m",
":=",
"NewFromData",
"(",
"c",
".",
"Data",
"(",
")",
")",
"\n",
"m",
".",
"Context",
"=",
"c",
"\n",
"return",
"m",
"\n",
"}"
] | // New builds a new message with the current buffalo.Context | [
"New",
"builds",
"a",
"new",
"message",
"with",
"the",
"current",
"buffalo",
".",
"Context"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/mail.go#L33-L37 | test |
gobuffalo/buffalo | render/sse.go | CloseNotify | func (es *EventSource) CloseNotify() <-chan bool {
if cn, ok := es.w.(closeNotifier); ok {
return cn.CloseNotify()
}
return nil
} | go | func (es *EventSource) CloseNotify() <-chan bool {
if cn, ok := es.w.(closeNotifier); ok {
return cn.CloseNotify()
}
return nil
} | [
"func",
"(",
"es",
"*",
"EventSource",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"if",
"cn",
",",
"ok",
":=",
"es",
".",
"w",
".",
"(",
"closeNotifier",
")",
";",
"ok",
"{",
"return",
"cn",
".",
"CloseNotify",
"(",
")",
"\n",
"}",
... | // CloseNotify return true across the channel when the connection
// in the browser has been severed. | [
"CloseNotify",
"return",
"true",
"across",
"the",
"channel",
"when",
"the",
"connection",
"in",
"the",
"browser",
"has",
"been",
"severed",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/render/sse.go#L54-L59 | test |
gobuffalo/buffalo | render/sse.go | NewEventSource | func NewEventSource(w http.ResponseWriter) (*EventSource, error) {
es := &EventSource{w: w}
var ok bool
es.fl, ok = w.(http.Flusher)
if !ok {
return es, errors.New("streaming is not supported")
}
es.w.Header().Set("Content-Type", "text/event-stream")
es.w.Header().Set("Cache-Control", "no-cache")
es.w.Header... | go | func NewEventSource(w http.ResponseWriter) (*EventSource, error) {
es := &EventSource{w: w}
var ok bool
es.fl, ok = w.(http.Flusher)
if !ok {
return es, errors.New("streaming is not supported")
}
es.w.Header().Set("Content-Type", "text/event-stream")
es.w.Header().Set("Cache-Control", "no-cache")
es.w.Header... | [
"func",
"NewEventSource",
"(",
"w",
"http",
".",
"ResponseWriter",
")",
"(",
"*",
"EventSource",
",",
"error",
")",
"{",
"es",
":=",
"&",
"EventSource",
"{",
"w",
":",
"w",
"}",
"\n",
"var",
"ok",
"bool",
"\n",
"es",
".",
"fl",
",",
"ok",
"=",
"w... | // NewEventSource returns a new EventSource instance while ensuring
// that the http.ResponseWriter is able to handle EventSource messages.
// It also makes sure to set the proper response heads. | [
"NewEventSource",
"returns",
"a",
"new",
"EventSource",
"instance",
"while",
"ensuring",
"that",
"the",
"http",
".",
"ResponseWriter",
"is",
"able",
"to",
"handle",
"EventSource",
"messages",
".",
"It",
"also",
"makes",
"sure",
"to",
"set",
"the",
"proper",
"r... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/render/sse.go#L64-L77 | test |
gobuffalo/buffalo | worker/simple.go | NewSimpleWithContext | func NewSimpleWithContext(ctx context.Context) *Simple {
ctx, cancel := context.WithCancel(ctx)
l := logrus.New()
l.Level = logrus.InfoLevel
l.Formatter = &logrus.TextFormatter{}
return &Simple{
Logger: l,
ctx: ctx,
cancel: cancel,
handlers: map[string]Handler{},
moot: &sync.Mutex{},
}
} | go | func NewSimpleWithContext(ctx context.Context) *Simple {
ctx, cancel := context.WithCancel(ctx)
l := logrus.New()
l.Level = logrus.InfoLevel
l.Formatter = &logrus.TextFormatter{}
return &Simple{
Logger: l,
ctx: ctx,
cancel: cancel,
handlers: map[string]Handler{},
moot: &sync.Mutex{},
}
} | [
"func",
"NewSimpleWithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Simple",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"l",
":=",
"logrus",
".",
"New",
"(",
")",
"\n",
"l",
".",
"Level",
"=",
... | // NewSimpleWithContext creates a basic implementation of the Worker interface
// that is backed using just the standard library and goroutines. | [
"NewSimpleWithContext",
"creates",
"a",
"basic",
"implementation",
"of",
"the",
"Worker",
"interface",
"that",
"is",
"backed",
"using",
"just",
"the",
"standard",
"library",
"and",
"goroutines",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L23-L37 | test |
gobuffalo/buffalo | worker/simple.go | Register | func (w *Simple) Register(name string, h Handler) error {
w.moot.Lock()
defer w.moot.Unlock()
if _, ok := w.handlers[name]; ok {
return fmt.Errorf("handler already mapped for name %s", name)
}
w.handlers[name] = h
return nil
} | go | func (w *Simple) Register(name string, h Handler) error {
w.moot.Lock()
defer w.moot.Unlock()
if _, ok := w.handlers[name]; ok {
return fmt.Errorf("handler already mapped for name %s", name)
}
w.handlers[name] = h
return nil
} | [
"func",
"(",
"w",
"*",
"Simple",
")",
"Register",
"(",
"name",
"string",
",",
"h",
"Handler",
")",
"error",
"{",
"w",
".",
"moot",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"moot",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":... | // Register Handler with the worker | [
"Register",
"Handler",
"with",
"the",
"worker"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L50-L58 | test |
gobuffalo/buffalo | worker/simple.go | Start | func (w *Simple) Start(ctx context.Context) error {
w.Logger.Info("Starting Simple Background Worker")
w.ctx, w.cancel = context.WithCancel(ctx)
return nil
} | go | func (w *Simple) Start(ctx context.Context) error {
w.Logger.Info("Starting Simple Background Worker")
w.ctx, w.cancel = context.WithCancel(ctx)
return nil
} | [
"func",
"(",
"w",
"*",
"Simple",
")",
"Start",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"w",
".",
"Logger",
".",
"Info",
"(",
"\"Starting Simple Background Worker\"",
")",
"\n",
"w",
".",
"ctx",
",",
"w",
".",
"cancel",
"=",
"context",... | // Start the worker | [
"Start",
"the",
"worker"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L61-L65 | test |
gobuffalo/buffalo | worker/simple.go | Stop | func (w Simple) Stop() error {
w.Logger.Info("Stopping Simple Background Worker")
w.cancel()
return nil
} | go | func (w Simple) Stop() error {
w.Logger.Info("Stopping Simple Background Worker")
w.cancel()
return nil
} | [
"func",
"(",
"w",
"Simple",
")",
"Stop",
"(",
")",
"error",
"{",
"w",
".",
"Logger",
".",
"Info",
"(",
"\"Stopping Simple Background Worker\"",
")",
"\n",
"w",
".",
"cancel",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Stop the worker | [
"Stop",
"the",
"worker"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L68-L72 | test |
gobuffalo/buffalo | worker/simple.go | Perform | func (w Simple) Perform(job Job) error {
w.Logger.Debugf("Performing job %s", job)
if job.Handler == "" {
err := fmt.Errorf("no handler name given for %s", job)
w.Logger.Error(err)
return err
}
w.moot.Lock()
defer w.moot.Unlock()
if h, ok := w.handlers[job.Handler]; ok {
go func() {
err := safe.RunE(fu... | go | func (w Simple) Perform(job Job) error {
w.Logger.Debugf("Performing job %s", job)
if job.Handler == "" {
err := fmt.Errorf("no handler name given for %s", job)
w.Logger.Error(err)
return err
}
w.moot.Lock()
defer w.moot.Unlock()
if h, ok := w.handlers[job.Handler]; ok {
go func() {
err := safe.RunE(fu... | [
"func",
"(",
"w",
"Simple",
")",
"Perform",
"(",
"job",
"Job",
")",
"error",
"{",
"w",
".",
"Logger",
".",
"Debugf",
"(",
"\"Performing job %s\"",
",",
"job",
")",
"\n",
"if",
"job",
".",
"Handler",
"==",
"\"\"",
"{",
"err",
":=",
"fmt",
".",
"Erro... | // Perform a job as soon as possibly using a goroutine. | [
"Perform",
"a",
"job",
"as",
"soon",
"as",
"possibly",
"using",
"a",
"goroutine",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L75-L100 | test |
gobuffalo/buffalo | worker/simple.go | PerformAt | func (w Simple) PerformAt(job Job, t time.Time) error {
return w.PerformIn(job, time.Until(t))
} | go | func (w Simple) PerformAt(job Job, t time.Time) error {
return w.PerformIn(job, time.Until(t))
} | [
"func",
"(",
"w",
"Simple",
")",
"PerformAt",
"(",
"job",
"Job",
",",
"t",
"time",
".",
"Time",
")",
"error",
"{",
"return",
"w",
".",
"PerformIn",
"(",
"job",
",",
"time",
".",
"Until",
"(",
"t",
")",
")",
"\n",
"}"
] | // PerformAt performs a job at a particular time using a goroutine. | [
"PerformAt",
"performs",
"a",
"job",
"at",
"a",
"particular",
"time",
"using",
"a",
"goroutine",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L103-L105 | test |
gobuffalo/buffalo | worker/simple.go | PerformIn | func (w Simple) PerformIn(job Job, d time.Duration) error {
go func() {
select {
case <-time.After(d):
w.Perform(job)
case <-w.ctx.Done():
w.cancel()
}
}()
return nil
} | go | func (w Simple) PerformIn(job Job, d time.Duration) error {
go func() {
select {
case <-time.After(d):
w.Perform(job)
case <-w.ctx.Done():
w.cancel()
}
}()
return nil
} | [
"func",
"(",
"w",
"Simple",
")",
"PerformIn",
"(",
"job",
"Job",
",",
"d",
"time",
".",
"Duration",
")",
"error",
"{",
"go",
"func",
"(",
")",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"d",
")",
":",
"w",
".",
"Perform",
"(",... | // PerformIn performs a job after waiting for a specified amount
// using a goroutine. | [
"PerformIn",
"performs",
"a",
"job",
"after",
"waiting",
"for",
"a",
"specified",
"amount",
"using",
"a",
"goroutine",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/worker/simple.go#L109-L119 | test |
gobuffalo/buffalo | route_info.go | String | func (ri RouteInfo) String() string {
b, _ := json.MarshalIndent(ri, "", " ")
return string(b)
} | go | func (ri RouteInfo) String() string {
b, _ := json.MarshalIndent(ri, "", " ")
return string(b)
} | [
"func",
"(",
"ri",
"RouteInfo",
")",
"String",
"(",
")",
"string",
"{",
"b",
",",
"_",
":=",
"json",
".",
"MarshalIndent",
"(",
"ri",
",",
"\"\"",
",",
"\" \"",
")",
"\n",
"return",
"string",
"(",
"b",
")",
"\n",
"}"
] | // String returns a JSON representation of the RouteInfo | [
"String",
"returns",
"a",
"JSON",
"representation",
"of",
"the",
"RouteInfo"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_info.go#L33-L36 | test |
gobuffalo/buffalo | route_info.go | Alias | func (ri *RouteInfo) Alias(aliases ...string) *RouteInfo {
ri.Aliases = append(ri.Aliases, aliases...)
for _, a := range aliases {
ri.App.router.Handle(a, ri).Methods(ri.Method)
}
return ri
} | go | func (ri *RouteInfo) Alias(aliases ...string) *RouteInfo {
ri.Aliases = append(ri.Aliases, aliases...)
for _, a := range aliases {
ri.App.router.Handle(a, ri).Methods(ri.Method)
}
return ri
} | [
"func",
"(",
"ri",
"*",
"RouteInfo",
")",
"Alias",
"(",
"aliases",
"...",
"string",
")",
"*",
"RouteInfo",
"{",
"ri",
".",
"Aliases",
"=",
"append",
"(",
"ri",
".",
"Aliases",
",",
"aliases",
"...",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
... | // Alias path patterns to the this route. This is not the
// same as a redirect. | [
"Alias",
"path",
"patterns",
"to",
"the",
"this",
"route",
".",
"This",
"is",
"not",
"the",
"same",
"as",
"a",
"redirect",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_info.go#L40-L46 | test |
gobuffalo/buffalo | route_info.go | Name | func (ri *RouteInfo) Name(name string) *RouteInfo {
routeIndex := -1
for index, route := range ri.App.Routes() {
if route.Path == ri.Path && route.Method == ri.Method {
routeIndex = index
break
}
}
name = flect.Camelize(name)
if !strings.HasSuffix(name, "Path") {
name = name + "Path"
}
ri.PathName... | go | func (ri *RouteInfo) Name(name string) *RouteInfo {
routeIndex := -1
for index, route := range ri.App.Routes() {
if route.Path == ri.Path && route.Method == ri.Method {
routeIndex = index
break
}
}
name = flect.Camelize(name)
if !strings.HasSuffix(name, "Path") {
name = name + "Path"
}
ri.PathName... | [
"func",
"(",
"ri",
"*",
"RouteInfo",
")",
"Name",
"(",
"name",
"string",
")",
"*",
"RouteInfo",
"{",
"routeIndex",
":=",
"-",
"1",
"\n",
"for",
"index",
",",
"route",
":=",
"range",
"ri",
".",
"App",
".",
"Routes",
"(",
")",
"{",
"if",
"route",
"... | // Name allows users to set custom names for the routes. | [
"Name",
"allows",
"users",
"to",
"set",
"custom",
"names",
"for",
"the",
"routes",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_info.go#L49-L70 | test |
gobuffalo/buffalo | route_info.go | BuildPathHelper | func (ri *RouteInfo) BuildPathHelper() RouteHelperFunc {
cRoute := ri
return func(opts map[string]interface{}) (template.HTML, error) {
pairs := []string{}
for k, v := range opts {
pairs = append(pairs, k)
pairs = append(pairs, fmt.Sprintf("%v", v))
}
url, err := cRoute.MuxRoute.URL(pairs...)
if err ... | go | func (ri *RouteInfo) BuildPathHelper() RouteHelperFunc {
cRoute := ri
return func(opts map[string]interface{}) (template.HTML, error) {
pairs := []string{}
for k, v := range opts {
pairs = append(pairs, k)
pairs = append(pairs, fmt.Sprintf("%v", v))
}
url, err := cRoute.MuxRoute.URL(pairs...)
if err ... | [
"func",
"(",
"ri",
"*",
"RouteInfo",
")",
"BuildPathHelper",
"(",
")",
"RouteHelperFunc",
"{",
"cRoute",
":=",
"ri",
"\n",
"return",
"func",
"(",
"opts",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"template",
".",
"HTML",
",",
"error",... | // BuildPathHelper Builds a routeHelperfunc for a particular RouteInfo | [
"BuildPathHelper",
"Builds",
"a",
"routeHelperfunc",
"for",
"a",
"particular",
"RouteInfo"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route_info.go#L73-L92 | test |
gobuffalo/buffalo | genny/ci/ci.go | New | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
g.Transformer(genny.Replace("-no-pop", ""))
g.Transformer(genny.Dot())
box := packr.New("buffalo:genny:ci", "../ci/templates")
var fname string
switch opts.Provider {
case "travis"... | go | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
g.Transformer(genny.Replace("-no-pop", ""))
g.Transformer(genny.Dot())
box := packr.New("buffalo:genny:ci", "../ci/templates")
var fname string
switch opts.Provider {
case "travis"... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // New generator for adding travis or gitlab | [
"New",
"generator",
"for",
"adding",
"travis",
"or",
"gitlab"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/ci/ci.go#L13-L64 | test |
gobuffalo/buffalo | genny/actions/actions.go | New | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
g.RunFn(construct(opts))
return g, nil
} | go | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
g.RunFn(construct(opts))
return g, nil
} | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // New returns a new generator for build actions on a Buffalo app | [
"New",
"returns",
"a",
"new",
"generator",
"for",
"build",
"actions",
"on",
"a",
"Buffalo",
"app"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/actions/actions.go#L16-L25 | test |
gobuffalo/buffalo | binding/binding.go | RegisterCustomDecoder | func RegisterCustomDecoder(fn CustomTypeDecoder, types []interface{}, fields []interface{}) {
rawFunc := (func([]string) (interface{}, error))(fn)
decoder.RegisterCustomType(rawFunc, types, fields)
} | go | func RegisterCustomDecoder(fn CustomTypeDecoder, types []interface{}, fields []interface{}) {
rawFunc := (func([]string) (interface{}, error))(fn)
decoder.RegisterCustomType(rawFunc, types, fields)
} | [
"func",
"RegisterCustomDecoder",
"(",
"fn",
"CustomTypeDecoder",
",",
"types",
"[",
"]",
"interface",
"{",
"}",
",",
"fields",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"rawFunc",
":=",
"(",
"func",
"(",
"[",
"]",
"string",
")",
"(",
"interface",
"{",... | // RegisterCustomDecoder allows to define custom type decoders. | [
"RegisterCustomDecoder",
"allows",
"to",
"define",
"custom",
"type",
"decoders",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/binding/binding.go#L59-L62 | test |
gobuffalo/buffalo | middleware.go | Replace | func (ms *MiddlewareStack) Replace(mw1 MiddlewareFunc, mw2 MiddlewareFunc) {
m1k := funcKey(mw1)
stack := []MiddlewareFunc{}
for _, mw := range ms.stack {
if funcKey(mw) == m1k {
stack = append(stack, mw2)
} else {
stack = append(stack, mw)
}
}
ms.stack = stack
} | go | func (ms *MiddlewareStack) Replace(mw1 MiddlewareFunc, mw2 MiddlewareFunc) {
m1k := funcKey(mw1)
stack := []MiddlewareFunc{}
for _, mw := range ms.stack {
if funcKey(mw) == m1k {
stack = append(stack, mw2)
} else {
stack = append(stack, mw)
}
}
ms.stack = stack
} | [
"func",
"(",
"ms",
"*",
"MiddlewareStack",
")",
"Replace",
"(",
"mw1",
"MiddlewareFunc",
",",
"mw2",
"MiddlewareFunc",
")",
"{",
"m1k",
":=",
"funcKey",
"(",
"mw1",
")",
"\n",
"stack",
":=",
"[",
"]",
"MiddlewareFunc",
"{",
"}",
"\n",
"for",
"_",
",",
... | // Replace a piece of middleware with another piece of middleware. Great for
// testing. | [
"Replace",
"a",
"piece",
"of",
"middleware",
"with",
"another",
"piece",
"of",
"middleware",
".",
"Great",
"for",
"testing",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/middleware.go#L90-L101 | test |
gobuffalo/buffalo | route.go | Routes | func (a *App) Routes() RouteList {
if a.root != nil {
return a.root.routes
}
return a.routes
} | go | func (a *App) Routes() RouteList {
if a.root != nil {
return a.root.routes
}
return a.routes
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Routes",
"(",
")",
"RouteList",
"{",
"if",
"a",
".",
"root",
"!=",
"nil",
"{",
"return",
"a",
".",
"root",
".",
"routes",
"\n",
"}",
"\n",
"return",
"a",
".",
"routes",
"\n",
"}"
] | // Routes returns a list of all of the routes defined
// in this application. | [
"Routes",
"returns",
"a",
"list",
"of",
"all",
"of",
"the",
"routes",
"defined",
"in",
"this",
"application",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/route.go#L15-L20 | test |
gobuffalo/buffalo | wrappers.go | WrapBuffaloHandler | func WrapBuffaloHandler(h Handler) http.Handler {
a := New(Options{})
// it doesn't matter what we actually map it
// GET, POST, etc... we just need the underlying
// RouteInfo, which implements http.Handler
ri := a.GET("/", h)
return ri
} | go | func WrapBuffaloHandler(h Handler) http.Handler {
a := New(Options{})
// it doesn't matter what we actually map it
// GET, POST, etc... we just need the underlying
// RouteInfo, which implements http.Handler
ri := a.GET("/", h)
return ri
} | [
"func",
"WrapBuffaloHandler",
"(",
"h",
"Handler",
")",
"http",
".",
"Handler",
"{",
"a",
":=",
"New",
"(",
"Options",
"{",
"}",
")",
"\n",
"ri",
":=",
"a",
".",
"GET",
"(",
"\"/\"",
",",
"h",
")",
"\n",
"return",
"ri",
"\n",
"}"
] | // WrapBuffaloHandler wraps a buffalo.Handler to
// standard http.Handler | [
"WrapBuffaloHandler",
"wraps",
"a",
"buffalo",
".",
"Handler",
"to",
"standard",
"http",
".",
"Handler"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/wrappers.go#L22-L29 | test |
gobuffalo/buffalo | buffalo/cmd/fix/npm.go | PackageJSONCheck | func PackageJSONCheck(r *Runner) error {
fmt.Println("~~~ Checking package.json ~~~")
if !r.App.WithWebpack {
return nil
}
box := webpack.Templates
f, err := box.FindString("package.json.tmpl")
if err != nil {
return err
}
tmpl, err := template.New("package.json").Parse(f)
if err != nil {
return err
... | go | func PackageJSONCheck(r *Runner) error {
fmt.Println("~~~ Checking package.json ~~~")
if !r.App.WithWebpack {
return nil
}
box := webpack.Templates
f, err := box.FindString("package.json.tmpl")
if err != nil {
return err
}
tmpl, err := template.New("package.json").Parse(f)
if err != nil {
return err
... | [
"func",
"PackageJSONCheck",
"(",
"r",
"*",
"Runner",
")",
"error",
"{",
"fmt",
".",
"Println",
"(",
"\"~~~ Checking package.json ~~~\"",
")",
"\n",
"if",
"!",
"r",
".",
"App",
".",
"WithWebpack",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"box",
":=",
"webpa... | // PackageJSONCheck will compare the current default Buffalo
// package.json against the applications package.json. If they are
// different you have the option to overwrite the existing package.json
// file with the new one. | [
"PackageJSONCheck",
"will",
"compare",
"the",
"current",
"default",
"Buffalo",
"package",
".",
"json",
"against",
"the",
"applications",
"package",
".",
"json",
".",
"If",
"they",
"are",
"different",
"you",
"have",
"the",
"option",
"to",
"overwrite",
"the",
"e... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/buffalo/cmd/fix/npm.go#L19-L87 | test |
gobuffalo/buffalo | buffalo/cmd/fix/imports.go | match | func (c ImportConverter) match(importpath string) (string, bool) {
for key, value := range c.Data {
if !strings.HasPrefix(importpath, key) {
continue
}
result := strings.Replace(importpath, key, value, 1)
return result, true
}
return importpath, false
} | go | func (c ImportConverter) match(importpath string) (string, bool) {
for key, value := range c.Data {
if !strings.HasPrefix(importpath, key) {
continue
}
result := strings.Replace(importpath, key, value, 1)
return result, true
}
return importpath, false
} | [
"func",
"(",
"c",
"ImportConverter",
")",
"match",
"(",
"importpath",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"c",
".",
"Data",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"importpath",
",... | // match takes an import path and replacement map. | [
"match",
"takes",
"an",
"import",
"path",
"and",
"replacement",
"map",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/buffalo/cmd/fix/imports.go#L151-L162 | test |
gobuffalo/buffalo | mail/internal/mail/send.go | Send | func Send(s Sender, msg ...*Message) error {
for i, m := range msg {
if err := send(s, m); err != nil {
return &SendError{Cause: err, Index: uint(i)}
}
}
return nil
} | go | func Send(s Sender, msg ...*Message) error {
for i, m := range msg {
if err := send(s, m); err != nil {
return &SendError{Cause: err, Index: uint(i)}
}
}
return nil
} | [
"func",
"Send",
"(",
"s",
"Sender",
",",
"msg",
"...",
"*",
"Message",
")",
"error",
"{",
"for",
"i",
",",
"m",
":=",
"range",
"msg",
"{",
"if",
"err",
":=",
"send",
"(",
"s",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"SendE... | // Send sends emails using the given Sender. | [
"Send",
"sends",
"emails",
"using",
"the",
"given",
"Sender",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/internal/mail/send.go#L36-L44 | test |
gobuffalo/buffalo | genny/grift/options.go | Last | func (opts Options) Last(n name.Ident) bool {
return opts.Parts[len(opts.Parts)-1].String() == n.String()
} | go | func (opts Options) Last(n name.Ident) bool {
return opts.Parts[len(opts.Parts)-1].String() == n.String()
} | [
"func",
"(",
"opts",
"Options",
")",
"Last",
"(",
"n",
"name",
".",
"Ident",
")",
"bool",
"{",
"return",
"opts",
".",
"Parts",
"[",
"len",
"(",
"opts",
".",
"Parts",
")",
"-",
"1",
"]",
".",
"String",
"(",
")",
"==",
"n",
".",
"String",
"(",
... | // Last checks if the name is the last of the parts | [
"Last",
"checks",
"if",
"the",
"name",
"is",
"the",
"last",
"of",
"the",
"parts"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/grift/options.go#L20-L22 | test |
gobuffalo/buffalo | server.go | Stop | func (a *App) Stop(err error) error {
a.cancel()
if err != nil && errors.Cause(err) != context.Canceled {
a.Logger.Error(err)
return err
}
return nil
} | go | func (a *App) Stop(err error) error {
a.cancel()
if err != nil && errors.Cause(err) != context.Canceled {
a.Logger.Error(err)
return err
}
return nil
} | [
"func",
"(",
"a",
"*",
"App",
")",
"Stop",
"(",
"err",
"error",
")",
"error",
"{",
"a",
".",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"errors",
".",
"Cause",
"(",
"err",
")",
"!=",
"context",
".",
"Canceled",
"{",
"a",
".",
"... | // Stop the application and attempt to gracefully shutdown | [
"Stop",
"the",
"application",
"and",
"attempt",
"to",
"gracefully",
"shutdown"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/server.go#L101-L108 | test |
gobuffalo/buffalo | buffalo/cmd/fix/dep.go | DepEnsure | func DepEnsure(r *Runner) error {
if r.App.WithPop {
upkg = append(upkg, "github.com/gobuffalo/fizz", "github.com/gobuffalo/pop")
}
if !r.App.WithDep {
fmt.Println("~~~ Running go get ~~~")
return modGetUpdate(r)
}
fmt.Println("~~~ Running dep ensure ~~~")
return runDepEnsure(r)
} | go | func DepEnsure(r *Runner) error {
if r.App.WithPop {
upkg = append(upkg, "github.com/gobuffalo/fizz", "github.com/gobuffalo/pop")
}
if !r.App.WithDep {
fmt.Println("~~~ Running go get ~~~")
return modGetUpdate(r)
}
fmt.Println("~~~ Running dep ensure ~~~")
return runDepEnsure(r)
} | [
"func",
"DepEnsure",
"(",
"r",
"*",
"Runner",
")",
"error",
"{",
"if",
"r",
".",
"App",
".",
"WithPop",
"{",
"upkg",
"=",
"append",
"(",
"upkg",
",",
"\"github.com/gobuffalo/fizz\"",
",",
"\"github.com/gobuffalo/pop\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"... | // DepEnsure runs `dep ensure -v` or `go get -u` depending on app tooling
// to make sure that any newly changed imports are added to dep or installed. | [
"DepEnsure",
"runs",
"dep",
"ensure",
"-",
"v",
"or",
"go",
"get",
"-",
"u",
"depending",
"on",
"app",
"tooling",
"to",
"make",
"sure",
"that",
"any",
"newly",
"changed",
"imports",
"are",
"added",
"to",
"dep",
"or",
"installed",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/buffalo/cmd/fix/dep.go#L30-L41 | test |
gobuffalo/buffalo | runtime/build.go | String | func (b BuildInfo) String() string {
return fmt.Sprintf("%s (%s)", b.Version, b.Time)
} | go | func (b BuildInfo) String() string {
return fmt.Sprintf("%s (%s)", b.Version, b.Time)
} | [
"func",
"(",
"b",
"BuildInfo",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"%s (%s)\"",
",",
"b",
".",
"Version",
",",
"b",
".",
"Time",
")",
"\n",
"}"
] | // String implements fmt.String | [
"String",
"implements",
"fmt",
".",
"String"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/runtime/build.go#L16-L18 | test |
gobuffalo/buffalo | genny/resource/resource.go | New | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
if !opts.SkipTemplates {
core := packr.New("github.com/gobuffalo/buffalo/genny/resource/templates/core", "../resource/templates/core")
if err := g.Box(core); err != nil {
return g... | go | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, err
}
if !opts.SkipTemplates {
core := packr.New("github.com/gobuffalo/buffalo/genny/resource/templates/core", "../resource/templates/core")
if err := g.Box(core); err != nil {
return g... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // New resource generator | [
"New",
"resource",
"generator"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/resource/resource.go#L15-L69 | test |
gobuffalo/buffalo | mail/message.go | AddBody | func (m *Message) AddBody(r render.Renderer, data render.Data) error {
buf := bytes.NewBuffer([]byte{})
err := r.Render(buf, m.merge(data))
if err != nil {
return err
}
m.Bodies = append(m.Bodies, Body{
Content: buf.String(),
ContentType: r.ContentType(),
})
return nil
} | go | func (m *Message) AddBody(r render.Renderer, data render.Data) error {
buf := bytes.NewBuffer([]byte{})
err := r.Render(buf, m.merge(data))
if err != nil {
return err
}
m.Bodies = append(m.Bodies, Body{
Content: buf.String(),
ContentType: r.ContentType(),
})
return nil
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"AddBody",
"(",
"r",
"render",
".",
"Renderer",
",",
"data",
"render",
".",
"Data",
")",
"error",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"[",
"]",
"byte",
"{",
"}",
")",
"\n",
"err",
":=",
"r",
... | // AddBody the message by receiving a renderer and rendering data, first message will be
// used as the main message Body rest of them will be passed as alternative bodies on the
// email message | [
"AddBody",
"the",
"message",
"by",
"receiving",
"a",
"renderer",
"and",
"rendering",
"data",
"first",
"message",
"will",
"be",
"used",
"as",
"the",
"main",
"message",
"Body",
"rest",
"of",
"them",
"will",
"be",
"passed",
"as",
"alternative",
"bodies",
"on",
... | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/message.go#L44-L58 | test |
gobuffalo/buffalo | mail/message.go | AddBodies | func (m *Message) AddBodies(data render.Data, renderers ...render.Renderer) error {
for _, r := range renderers {
err := m.AddBody(r, data)
if err != nil {
return err
}
}
return nil
} | go | func (m *Message) AddBodies(data render.Data, renderers ...render.Renderer) error {
for _, r := range renderers {
err := m.AddBody(r, data)
if err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"AddBodies",
"(",
"data",
"render",
".",
"Data",
",",
"renderers",
"...",
"render",
".",
"Renderer",
")",
"error",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"renderers",
"{",
"err",
":=",
"m",
".",
"AddBody",
... | // AddBodies Allows to add multiple bodies to the message, it returns errors that
// could happen in the rendering. | [
"AddBodies",
"Allows",
"to",
"add",
"multiple",
"bodies",
"to",
"the",
"message",
"it",
"returns",
"errors",
"that",
"could",
"happen",
"in",
"the",
"rendering",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/message.go#L62-L71 | test |
gobuffalo/buffalo | mail/message.go | AddAttachment | func (m *Message) AddAttachment(name, contentType string, r io.Reader) error {
m.Attachments = append(m.Attachments, Attachment{
Name: name,
ContentType: contentType,
Reader: r,
Embedded: false,
})
return nil
} | go | func (m *Message) AddAttachment(name, contentType string, r io.Reader) error {
m.Attachments = append(m.Attachments, Attachment{
Name: name,
ContentType: contentType,
Reader: r,
Embedded: false,
})
return nil
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"AddAttachment",
"(",
"name",
",",
"contentType",
"string",
",",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"m",
".",
"Attachments",
"=",
"append",
"(",
"m",
".",
"Attachments",
",",
"Attachment",
"{",
"Name",
... | //AddAttachment adds the attachment to the list of attachments the Message has. | [
"AddAttachment",
"adds",
"the",
"attachment",
"to",
"the",
"list",
"of",
"attachments",
"the",
"Message",
"has",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/message.go#L74-L83 | test |
gobuffalo/buffalo | mail/message.go | AddEmbedded | func (m *Message) AddEmbedded(name string, r io.Reader) error {
m.Attachments = append(m.Attachments, Attachment{
Name: name,
Reader: r,
Embedded: true,
})
return nil
} | go | func (m *Message) AddEmbedded(name string, r io.Reader) error {
m.Attachments = append(m.Attachments, Attachment{
Name: name,
Reader: r,
Embedded: true,
})
return nil
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"AddEmbedded",
"(",
"name",
"string",
",",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"m",
".",
"Attachments",
"=",
"append",
"(",
"m",
".",
"Attachments",
",",
"Attachment",
"{",
"Name",
":",
"name",
",",
"... | //AddEmbedded adds the attachment to the list of attachments
// the Message has and uses inline instead of attachement property. | [
"AddEmbedded",
"adds",
"the",
"attachment",
"to",
"the",
"list",
"of",
"attachments",
"the",
"Message",
"has",
"and",
"uses",
"inline",
"instead",
"of",
"attachement",
"property",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/message.go#L87-L95 | test |
gobuffalo/buffalo | mail/message.go | SetHeader | func (m *Message) SetHeader(field, value string) {
m.Headers[field] = value
} | go | func (m *Message) SetHeader(field, value string) {
m.Headers[field] = value
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"SetHeader",
"(",
"field",
",",
"value",
"string",
")",
"{",
"m",
".",
"Headers",
"[",
"field",
"]",
"=",
"value",
"\n",
"}"
] | // SetHeader sets the heder field and value for the message | [
"SetHeader",
"sets",
"the",
"heder",
"field",
"and",
"value",
"for",
"the",
"message"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/mail/message.go#L98-L100 | test |
gobuffalo/buffalo | genny/newapp/web/web.go | New | func New(opts *Options) (*genny.Group, error) {
if err := opts.Validate(); err != nil {
return nil, err
}
gg, err := core.New(opts.Options)
if err != nil {
return gg, err
}
g := genny.New()
g.Transformer(genny.Dot())
data := map[string]interface{}{
"opts": opts,
}
helpers := template.FuncMap{}
t :=... | go | func New(opts *Options) (*genny.Group, error) {
if err := opts.Validate(); err != nil {
return nil, err
}
gg, err := core.New(opts.Options)
if err != nil {
return gg, err
}
g := genny.New()
g.Transformer(genny.Dot())
data := map[string]interface{}{
"opts": opts,
}
helpers := template.FuncMap{}
t :=... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Group",
",",
"error",
")",
"{",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"gg",
... | // New generator for creating a Buffalo Web application | [
"New",
"generator",
"for",
"creating",
"a",
"Buffalo",
"Web",
"application"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/newapp/web/web.go#L15-L58 | test |
gobuffalo/buffalo | genny/assets/standard/standard.go | New | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
g.Box(packr.New("buffalo:genny:assets:standard", "../standard/templates"))
data := map[string]interface{}{}
h := template.FuncMap{}
t := gogen.TemplateTransformer(data, h)
g.Transformer(t)
g.RunFn(func(r *genny.Runner) error {
f, err := r.F... | go | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
g.Box(packr.New("buffalo:genny:assets:standard", "../standard/templates"))
data := map[string]interface{}{}
h := template.FuncMap{}
t := gogen.TemplateTransformer(data, h)
g.Transformer(t)
g.RunFn(func(r *genny.Runner) error {
f, err := r.F... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"g",
".",
"Box",
"(",
"packr",
".",
"New",
"(",
"\"buffalo:genny:assets:standard\"",
",",
... | // New generator for creating basic asset files | [
"New",
"generator",
"for",
"creating",
"basic",
"asset",
"files"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/assets/standard/standard.go#L13-L33 | test |
gobuffalo/buffalo | genny/info/info.go | New | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, errors.WithStack(err)
}
g.RunFn(appDetails(opts))
cBox := packr.Folder(filepath.Join(opts.App.Root, "config"))
g.RunFn(configs(opts, cBox))
aBox := packr.Folder(opts.App.Root)
g.RunFn(pkg... | go | func New(opts *Options) (*genny.Generator, error) {
g := genny.New()
if err := opts.Validate(); err != nil {
return g, errors.WithStack(err)
}
g.RunFn(appDetails(opts))
cBox := packr.Folder(filepath.Join(opts.App.Root, "config"))
g.RunFn(configs(opts, cBox))
aBox := packr.Folder(opts.App.Root)
g.RunFn(pkg... | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
... | // New returns a generator that performs buffalo
// related rx checks | [
"New",
"returns",
"a",
"generator",
"that",
"performs",
"buffalo",
"related",
"rx",
"checks"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/info/info.go#L13-L29 | test |
gobuffalo/buffalo | genny/build/cleanup.go | Cleanup | func Cleanup(opts *Options) genny.RunFn {
return func(r *genny.Runner) error {
defer os.RemoveAll(filepath.Join(opts.Root, "a"))
if err := jam.Clean(); err != nil {
return err
}
var err error
opts.rollback.Range(func(k, v interface{}) bool {
f := genny.NewFileS(k.(string), v.(string))
r.Logger.Debu... | go | func Cleanup(opts *Options) genny.RunFn {
return func(r *genny.Runner) error {
defer os.RemoveAll(filepath.Join(opts.Root, "a"))
if err := jam.Clean(); err != nil {
return err
}
var err error
opts.rollback.Range(func(k, v interface{}) bool {
f := genny.NewFileS(k.(string), v.(string))
r.Logger.Debu... | [
"func",
"Cleanup",
"(",
"opts",
"*",
"Options",
")",
"genny",
".",
"RunFn",
"{",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"defer",
"os",
".",
"RemoveAll",
"(",
"filepath",
".",
"Join",
"(",
"opts",
".",
"Root",
",... | // Cleanup all of the generated files | [
"Cleanup",
"all",
"of",
"the",
"generated",
"files"
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/genny/build/cleanup.go#L14-L46 | test |
gobuffalo/buffalo | render/html.go | MDTemplateEngine | func MDTemplateEngine(input string, data map[string]interface{}, helpers map[string]interface{}) (string, error) {
if ct, ok := data["contentType"].(string); ok && ct == "text/plain" {
return plush.BuffaloRenderer(input, data, helpers)
}
source := github_flavored_markdown.Markdown([]byte(input))
source = []byte(h... | go | func MDTemplateEngine(input string, data map[string]interface{}, helpers map[string]interface{}) (string, error) {
if ct, ok := data["contentType"].(string); ok && ct == "text/plain" {
return plush.BuffaloRenderer(input, data, helpers)
}
source := github_flavored_markdown.Markdown([]byte(input))
source = []byte(h... | [
"func",
"MDTemplateEngine",
"(",
"input",
"string",
",",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"helpers",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"ct",
",",
"ok",
... | // MDTemplateEngine runs the input through github flavored markdown before sending it to the Plush engine. | [
"MDTemplateEngine",
"runs",
"the",
"input",
"through",
"github",
"flavored",
"markdown",
"before",
"sending",
"it",
"to",
"the",
"Plush",
"engine",
"."
] | 7f360181f4ccd79dcc9dcea2c904a4801f194f04 | https://github.com/gobuffalo/buffalo/blob/7f360181f4ccd79dcc9dcea2c904a4801f194f04/render/html.go#L43-L50 | test |
kubernetes/test-infra | prow/plugins/updateconfig/updateconfig.go | Update | func Update(fg FileGetter, kc corev1.ConfigMapInterface, name, namespace string, updates []ConfigMapUpdate, logger *logrus.Entry) error {
cm, getErr := kc.Get(name, metav1.GetOptions{})
isNotFound := errors.IsNotFound(getErr)
if getErr != nil && !isNotFound {
return fmt.Errorf("failed to fetch current state of con... | go | func Update(fg FileGetter, kc corev1.ConfigMapInterface, name, namespace string, updates []ConfigMapUpdate, logger *logrus.Entry) error {
cm, getErr := kc.Get(name, metav1.GetOptions{})
isNotFound := errors.IsNotFound(getErr)
if getErr != nil && !isNotFound {
return fmt.Errorf("failed to fetch current state of con... | [
"func",
"Update",
"(",
"fg",
"FileGetter",
",",
"kc",
"corev1",
".",
"ConfigMapInterface",
",",
"name",
",",
"namespace",
"string",
",",
"updates",
"[",
"]",
"ConfigMapUpdate",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"error",
"{",
"cm",
",",
"ge... | // Update updates the configmap with the data from the identified files | [
"Update",
"updates",
"the",
"configmap",
"with",
"the",
"data",
"from",
"the",
"identified",
"files"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/updateconfig/updateconfig.go#L90-L164 | test |
kubernetes/test-infra | prow/plugins/updateconfig/updateconfig.go | FilterChanges | func FilterChanges(cfg plugins.ConfigUpdater, changes []github.PullRequestChange, log *logrus.Entry) map[ConfigMapID][]ConfigMapUpdate {
toUpdate := map[ConfigMapID][]ConfigMapUpdate{}
for _, change := range changes {
var cm plugins.ConfigMapSpec
found := false
for key, configMap := range cfg.Maps {
var mat... | go | func FilterChanges(cfg plugins.ConfigUpdater, changes []github.PullRequestChange, log *logrus.Entry) map[ConfigMapID][]ConfigMapUpdate {
toUpdate := map[ConfigMapID][]ConfigMapUpdate{}
for _, change := range changes {
var cm plugins.ConfigMapSpec
found := false
for key, configMap := range cfg.Maps {
var mat... | [
"func",
"FilterChanges",
"(",
"cfg",
"plugins",
".",
"ConfigUpdater",
",",
"changes",
"[",
"]",
"github",
".",
"PullRequestChange",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"map",
"[",
"ConfigMapID",
"]",
"[",
"]",
"ConfigMapUpdate",
"{",
"toUpdate",
... | // FilterChanges determines which of the changes are relevant for config updating, returning mapping of
// config map to key to filename to update that key from. | [
"FilterChanges",
"determines",
"which",
"of",
"the",
"changes",
"are",
"relevant",
"for",
"config",
"updating",
"returning",
"mapping",
"of",
"config",
"map",
"to",
"key",
"to",
"filename",
"to",
"update",
"that",
"key",
"from",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/updateconfig/updateconfig.go#L180-L231 | test |
kubernetes/test-infra | prow/plugins/label/label.go | getLabelsFromREMatches | func getLabelsFromREMatches(matches [][]string) (labels []string) {
for _, match := range matches {
for _, label := range strings.Split(match[0], " ")[1:] {
label = strings.ToLower(match[1] + "/" + strings.TrimSpace(label))
labels = append(labels, label)
}
}
return
} | go | func getLabelsFromREMatches(matches [][]string) (labels []string) {
for _, match := range matches {
for _, label := range strings.Split(match[0], " ")[1:] {
label = strings.ToLower(match[1] + "/" + strings.TrimSpace(label))
labels = append(labels, label)
}
}
return
} | [
"func",
"getLabelsFromREMatches",
"(",
"matches",
"[",
"]",
"[",
"]",
"string",
")",
"(",
"labels",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"match",
":=",
"range",
"matches",
"{",
"for",
"_",
",",
"label",
":=",
"range",
"strings",
".",
"Split... | // Get Labels from Regexp matches | [
"Get",
"Labels",
"from",
"Regexp",
"matches"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/label/label.go#L87-L95 | test |
kubernetes/test-infra | prow/plugins/label/label.go | getLabelsFromGenericMatches | func getLabelsFromGenericMatches(matches [][]string, additionalLabels []string) []string {
if len(additionalLabels) == 0 {
return nil
}
var labels []string
for _, match := range matches {
parts := strings.Split(match[0], " ")
if ((parts[0] != "/label") && (parts[0] != "/remove-label")) || len(parts) != 2 {
... | go | func getLabelsFromGenericMatches(matches [][]string, additionalLabels []string) []string {
if len(additionalLabels) == 0 {
return nil
}
var labels []string
for _, match := range matches {
parts := strings.Split(match[0], " ")
if ((parts[0] != "/label") && (parts[0] != "/remove-label")) || len(parts) != 2 {
... | [
"func",
"getLabelsFromGenericMatches",
"(",
"matches",
"[",
"]",
"[",
"]",
"string",
",",
"additionalLabels",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"additionalLabels",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
... | // getLabelsFromGenericMatches returns label matches with extra labels if those
// have been configured in the plugin config. | [
"getLabelsFromGenericMatches",
"returns",
"label",
"matches",
"with",
"extra",
"labels",
"if",
"those",
"have",
"been",
"configured",
"in",
"the",
"plugin",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/label/label.go#L99-L116 | test |
kubernetes/test-infra | prow/config/agent.go | Start | func (ca *Agent) Start(prowConfig, jobConfig string) error {
c, err := Load(prowConfig, jobConfig)
if err != nil {
return err
}
ca.Set(c)
go func() {
var lastModTime time.Time
// Rarely, if two changes happen in the same second, mtime will
// be the same for the second change, and an mtime-based check woul... | go | func (ca *Agent) Start(prowConfig, jobConfig string) error {
c, err := Load(prowConfig, jobConfig)
if err != nil {
return err
}
ca.Set(c)
go func() {
var lastModTime time.Time
// Rarely, if two changes happen in the same second, mtime will
// be the same for the second change, and an mtime-based check woul... | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Start",
"(",
"prowConfig",
",",
"jobConfig",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"Load",
"(",
"prowConfig",
",",
"jobConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}... | // Start will begin polling the config file at the path. If the first load
// fails, Start will return the error and abort. Future load failures will log
// the failure message but continue attempting to load. | [
"Start",
"will",
"begin",
"polling",
"the",
"config",
"file",
"at",
"the",
"path",
".",
"If",
"the",
"first",
"load",
"fails",
"Start",
"will",
"return",
"the",
"error",
"and",
"abort",
".",
"Future",
"load",
"failures",
"will",
"log",
"the",
"failure",
... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/agent.go#L46-L100 | test |
kubernetes/test-infra | prow/config/agent.go | Subscribe | func (ca *Agent) Subscribe(subscription DeltaChan) {
ca.mut.Lock()
defer ca.mut.Unlock()
ca.subscriptions = append(ca.subscriptions, subscription)
} | go | func (ca *Agent) Subscribe(subscription DeltaChan) {
ca.mut.Lock()
defer ca.mut.Unlock()
ca.subscriptions = append(ca.subscriptions, subscription)
} | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Subscribe",
"(",
"subscription",
"DeltaChan",
")",
"{",
"ca",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ca",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"ca",
".",
"subscriptions",
"=",
"append",
"(",
... | // Subscribe registers the channel for messages on config reload.
// The caller can expect a copy of the previous and current config
// to be sent down the subscribed channel when a new configuration
// is loaded. | [
"Subscribe",
"registers",
"the",
"channel",
"for",
"messages",
"on",
"config",
"reload",
".",
"The",
"caller",
"can",
"expect",
"a",
"copy",
"of",
"the",
"previous",
"and",
"current",
"config",
"to",
"be",
"sent",
"down",
"the",
"subscribed",
"channel",
"whe... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/agent.go#L106-L110 | test |
kubernetes/test-infra | prow/config/agent.go | Config | func (ca *Agent) Config() *Config {
ca.mut.RLock()
defer ca.mut.RUnlock()
return ca.c
} | go | func (ca *Agent) Config() *Config {
ca.mut.RLock()
defer ca.mut.RUnlock()
return ca.c
} | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Config",
"(",
")",
"*",
"Config",
"{",
"ca",
".",
"mut",
".",
"RLock",
"(",
")",
"\n",
"defer",
"ca",
".",
"mut",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ca",
".",
"c",
"\n",
"}"
] | // Config returns the latest config. Do not modify the config. | [
"Config",
"returns",
"the",
"latest",
"config",
".",
"Do",
"not",
"modify",
"the",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/agent.go#L116-L120 | test |
kubernetes/test-infra | prow/config/agent.go | Set | func (ca *Agent) Set(c *Config) {
ca.mut.Lock()
defer ca.mut.Unlock()
var oldConfig Config
if ca.c != nil {
oldConfig = *ca.c
}
delta := Delta{oldConfig, *c}
ca.c = c
for _, subscription := range ca.subscriptions {
go func(sub DeltaChan) { // wait a minute to send each event
end := time.NewTimer(time.Min... | go | func (ca *Agent) Set(c *Config) {
ca.mut.Lock()
defer ca.mut.Unlock()
var oldConfig Config
if ca.c != nil {
oldConfig = *ca.c
}
delta := Delta{oldConfig, *c}
ca.c = c
for _, subscription := range ca.subscriptions {
go func(sub DeltaChan) { // wait a minute to send each event
end := time.NewTimer(time.Min... | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Set",
"(",
"c",
"*",
"Config",
")",
"{",
"ca",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ca",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"var",
"oldConfig",
"Config",
"\n",
"if",
"ca",
".",
"c",... | // Set sets the config. Useful for testing. | [
"Set",
"sets",
"the",
"config",
".",
"Useful",
"for",
"testing",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/agent.go#L123-L144 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | IsMember | func (f *FakeClient) IsMember(org, user string) (bool, error) {
for _, m := range f.OrgMembers[org] {
if m == user {
return true, nil
}
}
return false, nil
} | go | func (f *FakeClient) IsMember(org, user string) (bool, error) {
for _, m := range f.OrgMembers[org] {
if m == user {
return true, nil
}
}
return false, nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"IsMember",
"(",
"org",
",",
"user",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"f",
".",
"OrgMembers",
"[",
"org",
"]",
"{",
"if",
"m",
"==",
"user",
"{",
... | // IsMember returns true if user is in org. | [
"IsMember",
"returns",
"true",
"if",
"user",
"is",
"in",
"org",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L110-L117 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | ListIssueComments | func (f *FakeClient) ListIssueComments(owner, repo string, number int) ([]github.IssueComment, error) {
return append([]github.IssueComment{}, f.IssueComments[number]...), nil
} | go | func (f *FakeClient) ListIssueComments(owner, repo string, number int) ([]github.IssueComment, error) {
return append([]github.IssueComment{}, f.IssueComments[number]...), nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListIssueComments",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"IssueComment",
",",
"error",
")",
"{",
"return",
"append",
"(",
"[",
"]",
"github",
".",
"Is... | // ListIssueComments returns comments. | [
"ListIssueComments",
"returns",
"comments",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L120-L122 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | ListPullRequestComments | func (f *FakeClient) ListPullRequestComments(owner, repo string, number int) ([]github.ReviewComment, error) {
return append([]github.ReviewComment{}, f.PullRequestComments[number]...), nil
} | go | func (f *FakeClient) ListPullRequestComments(owner, repo string, number int) ([]github.ReviewComment, error) {
return append([]github.ReviewComment{}, f.PullRequestComments[number]...), nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListPullRequestComments",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"ReviewComment",
",",
"error",
")",
"{",
"return",
"append",
"(",
"[",
"]",
"github",
"."... | // ListPullRequestComments returns review comments. | [
"ListPullRequestComments",
"returns",
"review",
"comments",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L125-L127 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | ListReviews | func (f *FakeClient) ListReviews(owner, repo string, number int) ([]github.Review, error) {
return append([]github.Review{}, f.Reviews[number]...), nil
} | go | func (f *FakeClient) ListReviews(owner, repo string, number int) ([]github.Review, error) {
return append([]github.Review{}, f.Reviews[number]...), nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListReviews",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"Review",
",",
"error",
")",
"{",
"return",
"append",
"(",
"[",
"]",
"github",
".",
"Review",
"{"... | // ListReviews returns reviews. | [
"ListReviews",
"returns",
"reviews",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L130-L132 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | ListIssueEvents | func (f *FakeClient) ListIssueEvents(owner, repo string, number int) ([]github.ListedIssueEvent, error) {
return append([]github.ListedIssueEvent{}, f.IssueEvents[number]...), nil
} | go | func (f *FakeClient) ListIssueEvents(owner, repo string, number int) ([]github.ListedIssueEvent, error) {
return append([]github.ListedIssueEvent{}, f.IssueEvents[number]...), nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListIssueEvents",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"ListedIssueEvent",
",",
"error",
")",
"{",
"return",
"append",
"(",
"[",
"]",
"github",
".",
"... | // ListIssueEvents returns issue events | [
"ListIssueEvents",
"returns",
"issue",
"events"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L135-L137 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | CreateComment | func (f *FakeClient) CreateComment(owner, repo string, number int, comment string) error {
f.IssueCommentsAdded = append(f.IssueCommentsAdded, fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, comment))
f.IssueComments[number] = append(f.IssueComments[number], github.IssueComment{
ID: f.IssueCommentID,
Body: comm... | go | func (f *FakeClient) CreateComment(owner, repo string, number int, comment string) error {
f.IssueCommentsAdded = append(f.IssueCommentsAdded, fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, comment))
f.IssueComments[number] = append(f.IssueComments[number], github.IssueComment{
ID: f.IssueCommentID,
Body: comm... | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateComment",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
",",
"comment",
"string",
")",
"error",
"{",
"f",
".",
"IssueCommentsAdded",
"=",
"append",
"(",
"f",
".",
"IssueCommentsAdded",
",",
"f... | // CreateComment adds a comment to a PR | [
"CreateComment",
"adds",
"a",
"comment",
"to",
"a",
"PR"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L140-L149 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | CreateReview | func (f *FakeClient) CreateReview(org, repo string, number int, r github.DraftReview) error {
f.Reviews[number] = append(f.Reviews[number], github.Review{
ID: f.ReviewID,
User: github.User{Login: botName},
Body: r.Body,
})
f.ReviewID++
return nil
} | go | func (f *FakeClient) CreateReview(org, repo string, number int, r github.DraftReview) error {
f.Reviews[number] = append(f.Reviews[number], github.Review{
ID: f.ReviewID,
User: github.User{Login: botName},
Body: r.Body,
})
f.ReviewID++
return nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateReview",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"r",
"github",
".",
"DraftReview",
")",
"error",
"{",
"f",
".",
"Reviews",
"[",
"number",
"]",
"=",
"append",
"(",
"f",
".",
"Re... | // CreateReview adds a review to a PR | [
"CreateReview",
"adds",
"a",
"review",
"to",
"a",
"PR"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L152-L160 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | CreateCommentReaction | func (f *FakeClient) CreateCommentReaction(org, repo string, ID int, reaction string) error {
f.CommentReactionsAdded = append(f.CommentReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | go | func (f *FakeClient) CreateCommentReaction(org, repo string, ID int, reaction string) error {
f.CommentReactionsAdded = append(f.CommentReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateCommentReaction",
"(",
"org",
",",
"repo",
"string",
",",
"ID",
"int",
",",
"reaction",
"string",
")",
"error",
"{",
"f",
".",
"CommentReactionsAdded",
"=",
"append",
"(",
"f",
".",
"CommentReactionsAdded",
... | // CreateCommentReaction adds emoji to a comment. | [
"CreateCommentReaction",
"adds",
"emoji",
"to",
"a",
"comment",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L163-L166 | test |
kubernetes/test-infra | prow/github/fakegithub/fakegithub.go | CreateIssueReaction | func (f *FakeClient) CreateIssueReaction(org, repo string, ID int, reaction string) error {
f.IssueReactionsAdded = append(f.IssueReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | go | func (f *FakeClient) CreateIssueReaction(org, repo string, ID int, reaction string) error {
f.IssueReactionsAdded = append(f.IssueReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateIssueReaction",
"(",
"org",
",",
"repo",
"string",
",",
"ID",
"int",
",",
"reaction",
"string",
")",
"error",
"{",
"f",
".",
"IssueReactionsAdded",
"=",
"append",
"(",
"f",
".",
"IssueReactionsAdded",
",",
... | // CreateIssueReaction adds an emoji to an issue. | [
"CreateIssueReaction",
"adds",
"an",
"emoji",
"to",
"an",
"issue",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L169-L172 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.