id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
144,800
aclindsa/ofxgo
invstmt.go
MarshalXML
func (p *PositionList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { invPosListElement := xml.StartElement{Name: xml.Name{Local: "INVPOSLIST"}} if err := e.EncodeToken(invPosListElement); err != nil { return err } for _, position := range *p { start := xml.StartElement{Name: xml.Name{Local: positio...
go
func (p *PositionList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { invPosListElement := xml.StartElement{Name: xml.Name{Local: "INVPOSLIST"}} if err := e.EncodeToken(invPosListElement); err != nil { return err } for _, position := range *p { start := xml.StartElement{Name: xml.Name{Local: positio...
[ "func", "(", "p", "*", "PositionList", ")", "MarshalXML", "(", "e", "*", "xml", ".", "Encoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "invPosListElement", ":=", "xml", ".", "StartElement", "{", "Name", ":", "xml", ".", "Name", "{...
// MarshalXML handles marshalling a PositionList to an XML string
[ "MarshalXML", "handles", "marshalling", "a", "PositionList", "to", "an", "XML", "string" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/invstmt.go#L888-L924
144,801
aclindsa/ofxgo
invstmt.go
MarshalXML
func (o *OOList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { ooListElement := xml.StartElement{Name: xml.Name{Local: "INVOOLIST"}} if err := e.EncodeToken(ooListElement); err != nil { return err } for _, openorder := range *o { start := xml.StartElement{Name: xml.Name{Local: openorder.OrderType()...
go
func (o *OOList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { ooListElement := xml.StartElement{Name: xml.Name{Local: "INVOOLIST"}} if err := e.EncodeToken(ooListElement); err != nil { return err } for _, openorder := range *o { start := xml.StartElement{Name: xml.Name{Local: openorder.OrderType()...
[ "func", "(", "o", "*", "OOList", ")", "MarshalXML", "(", "e", "*", "xml", ".", "Encoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "ooListElement", ":=", "xml", ".", "StartElement", "{", "Name", ":", "xml", ".", "Name", "{", "Loca...
// MarshalXML handles marshalling an OOList to an XML string
[ "MarshalXML", "handles", "marshalling", "an", "OOList", "to", "an", "XML", "string" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/invstmt.go#L1193-L1253
144,802
aclindsa/ofxgo
profile.go
UnmarshalXML
func (msl *MessageSetList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { for { var msgset MessageSet tok, err := nextNonWhitespaceToken(d) if err != nil { return err } else if end, ok := tok.(xml.EndElement); ok && end.Name.Local == start.Name.Local { // If we found the end of our starting...
go
func (msl *MessageSetList) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { for { var msgset MessageSet tok, err := nextNonWhitespaceToken(d) if err != nil { return err } else if end, ok := tok.(xml.EndElement); ok && end.Name.Local == start.Name.Local { // If we found the end of our starting...
[ "func", "(", "msl", "*", "MessageSetList", ")", "UnmarshalXML", "(", "d", "*", "xml", ".", "Decoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "for", "{", "var", "msgset", "MessageSet", "\n", "tok", ",", "err", ":=", "nextNonWhitespac...
// UnmarshalXML handles unmarshalling a MessageSetList element from an XML string
[ "UnmarshalXML", "handles", "unmarshalling", "a", "MessageSetList", "element", "from", "an", "XML", "string" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/profile.go#L93-L128
144,803
aclindsa/ofxgo
profile.go
MarshalXML
func (msl *MessageSetList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { messageSetListElement := xml.StartElement{Name: xml.Name{Local: "MSGSETLIST"}} if err := e.EncodeToken(messageSetListElement); err != nil { return err } for _, messageset := range *msl { if !strings.HasSuffix(messageset.Name, ...
go
func (msl *MessageSetList) MarshalXML(e *xml.Encoder, start xml.StartElement) error { messageSetListElement := xml.StartElement{Name: xml.Name{Local: "MSGSETLIST"}} if err := e.EncodeToken(messageSetListElement); err != nil { return err } for _, messageset := range *msl { if !strings.HasSuffix(messageset.Name, ...
[ "func", "(", "msl", "*", "MessageSetList", ")", "MarshalXML", "(", "e", "*", "xml", ".", "Encoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "messageSetListElement", ":=", "xml", ".", "StartElement", "{", "Name", ":", "xml", ".", "Nam...
// MarshalXML handles marshalling a MessageSetList element to an XML string
[ "MarshalXML", "handles", "marshalling", "a", "MessageSetList", "element", "to", "an", "XML", "string" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/profile.go#L131-L157
144,804
aclindsa/ofxgo
vanguard_client.go
rawRequestCookies
func rawRequestCookies(URL string, r io.Reader, cookies []*http.Cookie) (*http.Response, error) { if !strings.HasPrefix(URL, "https://") { return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol") } request, err := http.NewRequest("POST", URL, r) if err != n...
go
func rawRequestCookies(URL string, r io.Reader, cookies []*http.Cookie) (*http.Response, error) { if !strings.HasPrefix(URL, "https://") { return nil, errors.New("Refusing to send OFX request with possible plain-text password over non-https protocol") } request, err := http.NewRequest("POST", URL, r) if err != n...
[ "func", "rawRequestCookies", "(", "URL", "string", ",", "r", "io", ".", "Reader", ",", "cookies", "[", "]", "*", "http", ".", "Cookie", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "!", "strings", ".", "HasPrefix", "(", "UR...
// rawRequestCookies is RawRequest with the added feature of sending cookies
[ "rawRequestCookies", "is", "RawRequest", "with", "the", "added", "feature", "of", "sending", "cookies" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/vanguard_client.go#L24-L48
144,805
aclindsa/ofxgo
response.go
guessVersion
func guessVersion(r *bufio.Reader) (bool, error) { b, _ := r.Peek(guessVersionCheckBytes) if b == nil { return false, errors.New("Failed to read OFX header") } sgmlIndex := bytes.Index(b, []byte("OFXHEADER:")) xmlIndex := bytes.Index(b, []byte("OFXHEADER=")) if sgmlIndex < 0 { return true, nil } else if xmlI...
go
func guessVersion(r *bufio.Reader) (bool, error) { b, _ := r.Peek(guessVersionCheckBytes) if b == nil { return false, errors.New("Failed to read OFX header") } sgmlIndex := bytes.Index(b, []byte("OFXHEADER:")) xmlIndex := bytes.Index(b, []byte("OFXHEADER=")) if sgmlIndex < 0 { return true, nil } else if xmlI...
[ "func", "guessVersion", "(", "r", "*", "bufio", ".", "Reader", ")", "(", "bool", ",", "error", ")", "{", "b", ",", "_", ":=", "r", ".", "Peek", "(", "guessVersionCheckBytes", ")", "\n", "if", "b", "==", "nil", "{", "return", "false", ",", "errors",...
// Defaults to XML if it can't determine the version or if there is any // ambiguity
[ "Defaults", "to", "XML", "if", "it", "can", "t", "determine", "the", "version", "or", "if", "there", "is", "any", "ambiguity" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/response.go#L188-L202
144,806
aclindsa/ofxgo
request.go
SetClientFields
func (oq *Request) SetClientFields(c Client) { oq.Signon.DtClient.Time = time.Now() // Overwrite fields that the client controls oq.Version = c.OfxVersion() oq.Signon.AppID = c.ID() oq.Signon.AppVer = c.Version() oq.indent = c.IndentRequests() }
go
func (oq *Request) SetClientFields(c Client) { oq.Signon.DtClient.Time = time.Now() // Overwrite fields that the client controls oq.Version = c.OfxVersion() oq.Signon.AppID = c.ID() oq.Signon.AppVer = c.Version() oq.indent = c.IndentRequests() }
[ "func", "(", "oq", "*", "Request", ")", "SetClientFields", "(", "c", "Client", ")", "{", "oq", ".", "Signon", ".", "DtClient", ".", "Time", "=", "time", ".", "Now", "(", ")", "\n\n", "// Overwrite fields that the client controls", "oq", ".", "Version", "="...
// SetClientFields overwrites the fields in this Request object controlled by // the Client
[ "SetClientFields", "overwrites", "the", "fields", "in", "this", "Request", "object", "controlled", "by", "the", "Client" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/request.go#L65-L73
144,807
aclindsa/ofxgo
util.go
nextNonWhitespaceToken
func nextNonWhitespaceToken(decoder *xml.Decoder) (xml.Token, error) { for { tok, err := decoder.Token() if err != nil { return nil, err } else if chars, ok := tok.(xml.CharData); ok { strippedBytes := bytes.TrimSpace(chars) if len(strippedBytes) != 0 { return tok, nil } } else { return tok,...
go
func nextNonWhitespaceToken(decoder *xml.Decoder) (xml.Token, error) { for { tok, err := decoder.Token() if err != nil { return nil, err } else if chars, ok := tok.(xml.CharData); ok { strippedBytes := bytes.TrimSpace(chars) if len(strippedBytes) != 0 { return tok, nil } } else { return tok,...
[ "func", "nextNonWhitespaceToken", "(", "decoder", "*", "xml", ".", "Decoder", ")", "(", "xml", ".", "Token", ",", "error", ")", "{", "for", "{", "tok", ",", "err", ":=", "decoder", ".", "Token", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// Returns the next available Token from the xml.Decoder that is not CharData // made up entirely of whitespace. This is useful to skip whitespace when // manually unmarshaling XML.
[ "Returns", "the", "next", "available", "Token", "from", "the", "xml", ".", "Decoder", "that", "is", "not", "CharData", "made", "up", "entirely", "of", "whitespace", ".", "This", "is", "useful", "to", "skip", "whitespace", "when", "manually", "unmarshaling", ...
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/util.go#L11-L25
144,808
aclindsa/ofxgo
common.go
Valid
func (s *Status) Valid() (bool, error) { switch s.Severity { case "INFO", "WARN", "ERROR": default: return false, errors.New("Invalid STATUS>SEVERITY") } if arr, ok := statusMeanings[s.Code]; ok { if arr[1] != string(s.Severity) { return false, errors.New("Unexpected SEVERITY for STATUS>CODE") } } else ...
go
func (s *Status) Valid() (bool, error) { switch s.Severity { case "INFO", "WARN", "ERROR": default: return false, errors.New("Invalid STATUS>SEVERITY") } if arr, ok := statusMeanings[s.Code]; ok { if arr[1] != string(s.Severity) { return false, errors.New("Unexpected SEVERITY for STATUS>CODE") } } else ...
[ "func", "(", "s", "*", "Status", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "switch", "s", ".", "Severity", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "default", ":", "return", "false", ",", "errors", ".",...
// Valid returns whether the Status is valid according to the OFX spec
[ "Valid", "returns", "whether", "the", "Status", "is", "valid", "according", "to", "the", "OFX", "spec" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/common.go#L258-L274
144,809
aclindsa/ofxgo
common.go
CodeMeaning
func (s *Status) CodeMeaning() (string, error) { if arr, ok := statusMeanings[s.Code]; ok { return arr[0], nil } return "", errors.New("Unknown OFX status code") }
go
func (s *Status) CodeMeaning() (string, error) { if arr, ok := statusMeanings[s.Code]; ok { return arr[0], nil } return "", errors.New("Unknown OFX status code") }
[ "func", "(", "s", "*", "Status", ")", "CodeMeaning", "(", ")", "(", "string", ",", "error", ")", "{", "if", "arr", ",", "ok", ":=", "statusMeanings", "[", "s", ".", "Code", "]", ";", "ok", "{", "return", "arr", "[", "0", "]", ",", "nil", "\n", ...
// CodeMeaning returns the meaning of the current status Code
[ "CodeMeaning", "returns", "the", "meaning", "of", "the", "current", "status", "Code" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/common.go#L277-L282
144,810
aclindsa/ofxgo
common.go
Valid
func (b BankAcct) Valid() (bool, error) { if len(b.BankID) == 0 { return false, errors.New("BankAcct.BankID empty") } if len(b.AcctID) == 0 { return false, errors.New("BankAcct.AcctID empty") } if !b.AcctType.Valid() { return false, errors.New("Invalid or unspecified BankAcct.AcctType") } return true, nil ...
go
func (b BankAcct) Valid() (bool, error) { if len(b.BankID) == 0 { return false, errors.New("BankAcct.BankID empty") } if len(b.AcctID) == 0 { return false, errors.New("BankAcct.AcctID empty") } if !b.AcctType.Valid() { return false, errors.New("Invalid or unspecified BankAcct.AcctType") } return true, nil ...
[ "func", "(", "b", "BankAcct", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "b", ".", "BankID", ")", "==", "0", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", ...
// Valid returns whether the BankAcct is valid according to the OFX spec
[ "Valid", "returns", "whether", "the", "BankAcct", "is", "valid", "according", "to", "the", "OFX", "spec" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/common.go#L304-L315
144,811
aclindsa/ofxgo
common.go
Valid
func (c CCAcct) Valid() (bool, error) { if len(c.AcctID) == 0 { return false, errors.New("CCAcct.AcctID empty") } return true, nil }
go
func (c CCAcct) Valid() (bool, error) { if len(c.AcctID) == 0 { return false, errors.New("CCAcct.AcctID empty") } return true, nil }
[ "func", "(", "c", "CCAcct", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "c", ".", "AcctID", ")", "==", "0", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return",...
// Valid returns whether the CCAcct is valid according to the OFX spec
[ "Valid", "returns", "whether", "the", "CCAcct", "is", "valid", "according", "to", "the", "OFX", "spec" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/common.go#L325-L330
144,812
aclindsa/ofxgo
common.go
Valid
func (c Currency) Valid() (bool, error) { if c.CurRate.IsInt() && c.CurRate.Num().Int64() == 0 { return false, errors.New("CurRate may not be zero") } else if ok, err := c.CurSym.Valid(); !ok { return false, err } return true, nil }
go
func (c Currency) Valid() (bool, error) { if c.CurRate.IsInt() && c.CurRate.Num().Int64() == 0 { return false, errors.New("CurRate may not be zero") } else if ok, err := c.CurSym.Valid(); !ok { return false, err } return true, nil }
[ "func", "(", "c", "Currency", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "c", ".", "CurRate", ".", "IsInt", "(", ")", "&&", "c", ".", "CurRate", ".", "Num", "(", ")", ".", "Int64", "(", ")", "==", "0", "{", "return", ...
// Valid returns whether the Currency is valid according to the OFX spec
[ "Valid", "returns", "whether", "the", "Currency", "is", "valid", "according", "to", "the", "OFX", "spec" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/common.go#L351-L358
144,813
aclindsa/ofxgo
types.go
String
func (a Amount) String() string { return strings.TrimRight(strings.TrimRight(a.FloatString(100), "0"), ".") }
go
func (a Amount) String() string { return strings.TrimRight(strings.TrimRight(a.FloatString(100), "0"), ".") }
[ "func", "(", "a", "Amount", ")", "String", "(", ")", "string", "{", "return", "strings", ".", "TrimRight", "(", "strings", ".", "TrimRight", "(", "a", ".", "FloatString", "(", "100", ")", ",", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "}" ]
// String prints a string representation of an Amount
[ "String", "prints", "a", "string", "representation", "of", "an", "Amount" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L74-L76
144,814
aclindsa/ofxgo
types.go
Equal
func (a Amount) Equal(o Amount) bool { return (&a).Cmp(&o.Rat) == 0 }
go
func (a Amount) Equal(o Amount) bool { return (&a).Cmp(&o.Rat) == 0 }
[ "func", "(", "a", "Amount", ")", "Equal", "(", "o", "Amount", ")", "bool", "{", "return", "(", "&", "a", ")", ".", "Cmp", "(", "&", "o", ".", "Rat", ")", "==", "0", "\n", "}" ]
// Equal returns true if two Amounts are equal in value
[ "Equal", "returns", "true", "if", "two", "Amounts", "are", "equal", "in", "value" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L84-L86
144,815
aclindsa/ofxgo
types.go
String
func (od Date) String() string { format := od.Format(ofxDateFormats[0]) zonename, zoneoffset := od.Zone() if zoneoffset < 0 { format += "[" + fmt.Sprintf("%+d", zoneoffset/3600) } else { format += "[" + fmt.Sprintf("%d", zoneoffset/3600) } fractionaloffset := (zoneoffset % 3600) / 36 if fractionaloffset > 0 ...
go
func (od Date) String() string { format := od.Format(ofxDateFormats[0]) zonename, zoneoffset := od.Zone() if zoneoffset < 0 { format += "[" + fmt.Sprintf("%+d", zoneoffset/3600) } else { format += "[" + fmt.Sprintf("%d", zoneoffset/3600) } fractionaloffset := (zoneoffset % 3600) / 36 if fractionaloffset > 0 ...
[ "func", "(", "od", "Date", ")", "String", "(", ")", "string", "{", "format", ":=", "od", ".", "Format", "(", "ofxDateFormats", "[", "0", "]", ")", "\n", "zonename", ",", "zoneoffset", ":=", "od", ".", "Zone", "(", ")", "\n", "if", "zoneoffset", "<"...
// String returns a string representation of the Date abiding by the OFX spec
[ "String", "returns", "a", "string", "representation", "of", "the", "Date", "abiding", "by", "the", "OFX", "spec" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L169-L188
144,816
aclindsa/ofxgo
types.go
MarshalXML
func (od *Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error { return e.EncodeElement(od.String(), start) }
go
func (od *Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error { return e.EncodeElement(od.String(), start) }
[ "func", "(", "od", "*", "Date", ")", "MarshalXML", "(", "e", "*", "xml", ".", "Encoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "return", "e", ".", "EncodeElement", "(", "od", ".", "String", "(", ")", ",", "start", ")", "\n", ...
// MarshalXML marshals a Date to XML
[ "MarshalXML", "marshals", "a", "Date", "to", "XML" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L191-L193
144,817
aclindsa/ofxgo
types.go
NewDateGMT
func NewDateGMT(year int, month time.Month, day, hour, min, sec, nsec int) *Date { return &Date{Time: time.Date(year, month, day, hour, min, sec, nsec, gmt)} }
go
func NewDateGMT(year int, month time.Month, day, hour, min, sec, nsec int) *Date { return &Date{Time: time.Date(year, month, day, hour, min, sec, nsec, gmt)} }
[ "func", "NewDateGMT", "(", "year", "int", ",", "month", "time", ".", "Month", ",", "day", ",", "hour", ",", "min", ",", "sec", ",", "nsec", "int", ")", "*", "Date", "{", "return", "&", "Date", "{", "Time", ":", "time", ".", "Date", "(", "year", ...
// NewDateGMT returns a new Date object with the provided date and time in the // GMT timezone
[ "NewDateGMT", "returns", "a", "new", "Date", "object", "with", "the", "provided", "date", "and", "time", "in", "the", "GMT", "timezone" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L210-L212
144,818
aclindsa/ofxgo
types.go
MarshalXML
func (ob *Boolean) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if *ob { return e.EncodeElement("Y", start) } return e.EncodeElement("N", start) }
go
func (ob *Boolean) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if *ob { return e.EncodeElement("Y", start) } return e.EncodeElement("N", start) }
[ "func", "(", "ob", "*", "Boolean", ")", "MarshalXML", "(", "e", "*", "xml", ".", "Encoder", ",", "start", "xml", ".", "StartElement", ")", "error", "{", "if", "*", "ob", "{", "return", "e", ".", "EncodeElement", "(", "\"", "\"", ",", "start", ")", ...
// MarshalXML marshals a Boolean to XML
[ "MarshalXML", "marshals", "a", "Boolean", "to", "XML" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L263-L268
144,819
aclindsa/ofxgo
types.go
RecommendedFormat
func (ou UID) RecommendedFormat() (bool, error) { if len(ou) != 36 { return false, errors.New("UID not 36 characters long") } if ou[8] != '-' || ou[13] != '-' || ou[18] != '-' || ou[23] != '-' { return false, errors.New("UID missing hyphens at the appropriate places") } return true, nil }
go
func (ou UID) RecommendedFormat() (bool, error) { if len(ou) != 36 { return false, errors.New("UID not 36 characters long") } if ou[8] != '-' || ou[13] != '-' || ou[18] != '-' || ou[23] != '-' { return false, errors.New("UID missing hyphens at the appropriate places") } return true, nil }
[ "func", "(", "ou", "UID", ")", "RecommendedFormat", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "ou", ")", "!=", "36", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "ou", ...
// RecommendedFormat returns true iff this UID meets the OFX specification's // recommendation that UIDs follow the standard UUID 36-character format
[ "RecommendedFormat", "returns", "true", "iff", "this", "UID", "meets", "the", "OFX", "specification", "s", "recommendation", "that", "UIDs", "follow", "the", "standard", "UUID", "36", "-", "character", "format" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L297-L305
144,820
aclindsa/ofxgo
types.go
Valid
func (ou UID) Valid() (bool, error) { if len(ou) == 0 || len(ou) > 36 { return false, errors.New("UID invalid length") } return true, nil }
go
func (ou UID) Valid() (bool, error) { if len(ou) == 0 || len(ou) > 36 { return false, errors.New("UID invalid length") } return true, nil }
[ "func", "(", "ou", "UID", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "ou", ")", "==", "0", "||", "len", "(", "ou", ")", ">", "36", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", ...
// Valid returns true, nil if the UID is valid. This is less strict than // RecommendedFormat, and will always return true, nil if it does.
[ "Valid", "returns", "true", "nil", "if", "the", "UID", "is", "valid", ".", "This", "is", "less", "strict", "than", "RecommendedFormat", "and", "will", "always", "return", "true", "nil", "if", "it", "does", "." ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L309-L314
144,821
aclindsa/ofxgo
types.go
RandomUID
func RandomUID() (*UID, error) { uidbytes := make([]byte, 16) n, err := rand.Read(uidbytes[:]) if err != nil { return nil, err } if n != 16 { return nil, errors.New("RandomUID failed to read 16 random bytes") } uid := UID(fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uidbytes[:4], uidbytes[4:6], uidbytes[6:8], ui...
go
func RandomUID() (*UID, error) { uidbytes := make([]byte, 16) n, err := rand.Read(uidbytes[:]) if err != nil { return nil, err } if n != 16 { return nil, errors.New("RandomUID failed to read 16 random bytes") } uid := UID(fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uidbytes[:4], uidbytes[4:6], uidbytes[6:8], ui...
[ "func", "RandomUID", "(", ")", "(", "*", "UID", ",", "error", ")", "{", "uidbytes", ":=", "make", "(", "[", "]", "byte", ",", "16", ")", "\n", "n", ",", "err", ":=", "rand", ".", "Read", "(", "uidbytes", "[", ":", "]", ")", "\n", "if", "err",...
// RandomUID creates a new randomly-generated UID
[ "RandomUID", "creates", "a", "new", "randomly", "-", "generated", "UID" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L322-L333
144,822
aclindsa/ofxgo
types.go
Equal
func (c CurrSymbol) Equal(o CurrSymbol) bool { return c.String() == o.String() }
go
func (c CurrSymbol) Equal(o CurrSymbol) bool { return c.String() == o.String() }
[ "func", "(", "c", "CurrSymbol", ")", "Equal", "(", "o", "CurrSymbol", ")", "bool", "{", "return", "c", ".", "String", "(", ")", "==", "o", ".", "String", "(", ")", "\n", "}" ]
// Equal returns true if the two Currencies are the same
[ "Equal", "returns", "true", "if", "the", "two", "Currencies", "are", "the", "same" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L366-L368
144,823
aclindsa/ofxgo
types.go
Valid
func (c CurrSymbol) Valid() (bool, error) { if c.String() == "XXX" { return false, fmt.Errorf("Invalid CurrSymbol: %s", c.Unit) } return true, nil }
go
func (c CurrSymbol) Valid() (bool, error) { if c.String() == "XXX" { return false, fmt.Errorf("Invalid CurrSymbol: %s", c.Unit) } return true, nil }
[ "func", "(", "c", "CurrSymbol", ")", "Valid", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "c", ".", "String", "(", ")", "==", "\"", "\"", "{", "return", "false", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "Unit", ")",...
// Valid returns true, nil if the CurrSymbol is valid.
[ "Valid", "returns", "true", "nil", "if", "the", "CurrSymbol", "is", "valid", "." ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L371-L376
144,824
aclindsa/ofxgo
types.go
NewCurrSymbol
func NewCurrSymbol(s string) (*CurrSymbol, error) { unit, err := currency.ParseISO(s) if err != nil { return nil, errors.New("Error parsing string to create new CurrSymbol:" + err.Error()) } return &CurrSymbol{unit}, nil }
go
func NewCurrSymbol(s string) (*CurrSymbol, error) { unit, err := currency.ParseISO(s) if err != nil { return nil, errors.New("Error parsing string to create new CurrSymbol:" + err.Error()) } return &CurrSymbol{unit}, nil }
[ "func", "NewCurrSymbol", "(", "s", "string", ")", "(", "*", "CurrSymbol", ",", "error", ")", "{", "unit", ",", "err", ":=", "currency", ".", "ParseISO", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New",...
// NewCurrSymbol returns a new CurrSymbol given a three-letter ISO-4217 // currency symbol as a string
[ "NewCurrSymbol", "returns", "a", "new", "CurrSymbol", "given", "a", "three", "-", "letter", "ISO", "-", "4217", "currency", "symbol", "as", "a", "string" ]
f41286cac7db7d418bb483e19a58de0aae9be786
https://github.com/aclindsa/ofxgo/blob/f41286cac7db7d418bb483e19a58de0aae9be786/types.go#L380-L386
144,825
square/squalor
ast.go
Serialize
func Serialize(s Serializer) (string, error) { w := &standardWriter{} if err := s.Serialize(w); err != nil { return "", err } return w.String(), nil }
go
func Serialize(s Serializer) (string, error) { w := &standardWriter{} if err := s.Serialize(w); err != nil { return "", err } return w.String(), nil }
[ "func", "Serialize", "(", "s", "Serializer", ")", "(", "string", ",", "error", ")", "{", "w", ":=", "&", "standardWriter", "{", "}", "\n", "if", "err", ":=", "s", ".", "Serialize", "(", "w", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\""...
// Serialize serializes a serializer to a string.
[ "Serialize", "serializes", "a", "serializer", "to", "a", "string", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/ast.go#L35-L41
144,826
square/squalor
ast.go
SerializeWithPlaceholders
func SerializeWithPlaceholders(s Serializer) (string, error) { w := &placeholderWriter{} if err := s.Serialize(w); err != nil { return "", err } return w.String(), nil }
go
func SerializeWithPlaceholders(s Serializer) (string, error) { w := &placeholderWriter{} if err := s.Serialize(w); err != nil { return "", err } return w.String(), nil }
[ "func", "SerializeWithPlaceholders", "(", "s", "Serializer", ")", "(", "string", ",", "error", ")", "{", "w", ":=", "&", "placeholderWriter", "{", "}", "\n", "if", "err", ":=", "s", ".", "Serialize", "(", "w", ")", ";", "err", "!=", "nil", "{", "retu...
// SerializeWithPlaceholders serializes a serializer to a string but without substituting // values. It may be useful for logging.
[ "SerializeWithPlaceholders", "serializes", "a", "serializer", "to", "a", "string", "but", "without", "substituting", "values", ".", "It", "may", "be", "useful", "for", "logging", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/ast.go#L45-L51
144,827
square/squalor
ast.go
NewWhere
func NewWhere(typ string, expr BoolExpr) *Where { if expr == nil { return nil } return &Where{Type: typ, Expr: expr} }
go
func NewWhere(typ string, expr BoolExpr) *Where { if expr == nil { return nil } return &Where{Type: typ, Expr: expr} }
[ "func", "NewWhere", "(", "typ", "string", ",", "expr", "BoolExpr", ")", "*", "Where", "{", "if", "expr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "&", "Where", "{", "Type", ":", "typ", ",", "Expr", ":", "expr", "}", "\n", "}"...
// NewWhere creates a WHERE or HAVING clause out // of a BoolExpr. If the expression is nil, it returns nil.
[ "NewWhere", "creates", "a", "WHERE", "or", "HAVING", "clause", "out", "of", "a", "BoolExpr", ".", "If", "the", "expression", "is", "nil", "it", "returns", "nil", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/ast.go#L737-L742
144,828
square/squalor
encode.go
getTmpBuffer
func getTmpBuffer(w io.Writer, n int) []byte { if buf, ok := w.(*bytes.Buffer); ok { buf.Grow(n) b := buf.Bytes() return b[len(b):] } return nil }
go
func getTmpBuffer(w io.Writer, n int) []byte { if buf, ok := w.(*bytes.Buffer); ok { buf.Grow(n) b := buf.Bytes() return b[len(b):] } return nil }
[ "func", "getTmpBuffer", "(", "w", "io", ".", "Writer", ",", "n", "int", ")", "[", "]", "byte", "{", "if", "buf", ",", "ok", ":=", "w", ".", "(", "*", "bytes", ".", "Buffer", ")", ";", "ok", "{", "buf", ".", "Grow", "(", "n", ")", "\n", "b",...
// Retrieve a tmp buffer for use during SQL value encoding. The // contents of the buffer will only survive until the next call to // io.Writer.Write.
[ "Retrieve", "a", "tmp", "buffer", "for", "use", "during", "SQL", "value", "encoding", ".", "The", "contents", "of", "the", "buffer", "will", "only", "survive", "until", "the", "next", "call", "to", "io", ".", "Writer", ".", "Write", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/encode.go#L39-L46
144,829
square/squalor
reflect.go
getMapping
func getMapping(t reflect.Type, mapFunc func(string) string) fieldMap { type typeQueue struct { t reflect.Type p []int } queue := []typeQueue{typeQueue{deref(t), []int{}}} m := fieldMap{} for len(queue) != 0 { // Pop the first item off of the queue. tq := queue[0] queue = queue[1:] // Iterate through ...
go
func getMapping(t reflect.Type, mapFunc func(string) string) fieldMap { type typeQueue struct { t reflect.Type p []int } queue := []typeQueue{typeQueue{deref(t), []int{}}} m := fieldMap{} for len(queue) != 0 { // Pop the first item off of the queue. tq := queue[0] queue = queue[1:] // Iterate through ...
[ "func", "getMapping", "(", "t", "reflect", ".", "Type", ",", "mapFunc", "func", "(", "string", ")", "string", ")", "fieldMap", "{", "type", "typeQueue", "struct", "{", "t", "reflect", ".", "Type", "\n", "p", "[", "]", "int", "\n", "}", "\n\n", "queue...
// getMapping returns a mapping for the type t, using the tagName and // the mapFunc to determine the canonical names of fields. Based on // reflectx.getMapping, but the returned map is from string to // reflect.StructField instead of string to index slice.
[ "getMapping", "returns", "a", "mapping", "for", "the", "type", "t", "using", "the", "tagName", "and", "the", "mapFunc", "to", "determine", "the", "canonical", "names", "of", "fields", ".", "Based", "on", "reflectx", ".", "getMapping", "but", "the", "returned...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/reflect.go#L39-L93
144,830
square/squalor
reflect.go
deref
func deref(t reflect.Type) reflect.Type { if t.Kind() == reflect.Ptr { t = t.Elem() } return t }
go
func deref(t reflect.Type) reflect.Type { if t.Kind() == reflect.Ptr { t = t.Elem() } return t }
[ "func", "deref", "(", "t", "reflect", ".", "Type", ")", "reflect", ".", "Type", "{", "if", "t", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "t", "=", "t", ".", "Elem", "(", ")", "\n", "}", "\n", "return", "t", "\n", "}" ]
// deref is Indirect for reflect.Type
[ "deref", "is", "Indirect", "for", "reflect", ".", "Type" ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/reflect.go#L188-L193
144,831
square/squalor
db.go
NewDB
func NewDB(db *sql.DB, options ...DBOption) (*DB, error) { newDB := &DB{ DB: db, AllowStringQueries: true, IgnoreUnmappedCols: true, IgnoreMissingCols: false, Logger: nil, OpentracingEnabled: false, context: context.Background(), deadlineQuer...
go
func NewDB(db *sql.DB, options ...DBOption) (*DB, error) { newDB := &DB{ DB: db, AllowStringQueries: true, IgnoreUnmappedCols: true, IgnoreMissingCols: false, Logger: nil, OpentracingEnabled: false, context: context.Background(), deadlineQuer...
[ "func", "NewDB", "(", "db", "*", "sql", ".", "DB", ",", "options", "...", "DBOption", ")", "(", "*", "DB", ",", "error", ")", "{", "newDB", ":=", "&", "DB", "{", "DB", ":", "db", ",", "AllowStringQueries", ":", "true", ",", "IgnoreUnmappedCols", ":...
// NewDB creates a new DB from an sql.DB. Zero or more DBOptions may be passed in and will // be processed in order.
[ "NewDB", "creates", "a", "new", "DB", "from", "an", "sql", ".", "DB", ".", "Zero", "or", "more", "DBOptions", "may", "be", "passed", "in", "and", "will", "be", "processed", "in", "order", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L468-L488
144,832
square/squalor
db.go
GetModel
func (db *DB) GetModel(obj interface{}) (*Model, error) { return db.getModel(reflect.TypeOf(obj)) }
go
func (db *DB) GetModel(obj interface{}) (*Model, error) { return db.getModel(reflect.TypeOf(obj)) }
[ "func", "(", "db", "*", "DB", ")", "GetModel", "(", "obj", "interface", "{", "}", ")", "(", "*", "Model", ",", "error", ")", "{", "return", "db", ".", "getModel", "(", "reflect", ".", "TypeOf", "(", "obj", ")", ")", "\n", "}" ]
// GetModel retrieves the model for the specified object. Obj must be // a struct. An error is returned if obj has not been bound to a table // via a call to BindModel.
[ "GetModel", "retrieves", "the", "model", "for", "the", "specified", "object", ".", "Obj", "must", "be", "a", "struct", ".", "An", "error", "is", "returned", "if", "obj", "has", "not", "been", "bound", "to", "a", "table", "via", "a", "call", "to", "Bind...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L534-L536
144,833
square/squalor
db.go
MustBindModel
func (db *DB) MustBindModel(name string, obj interface{}) *Model { model, err := db.BindModel(name, obj) if err != nil { panic(fmt.Errorf("%s: unable to bind model: %s", name, err)) } return model }
go
func (db *DB) MustBindModel(name string, obj interface{}) *Model { model, err := db.BindModel(name, obj) if err != nil { panic(fmt.Errorf("%s: unable to bind model: %s", name, err)) } return model }
[ "func", "(", "db", "*", "DB", ")", "MustBindModel", "(", "name", "string", ",", "obj", "interface", "{", "}", ")", "*", "Model", "{", "model", ",", "err", ":=", "db", ".", "BindModel", "(", "name", ",", "obj", ")", "\n", "if", "err", "!=", "nil",...
// MustBindModel binds the supplied interface with the named table, // panicking if an error occurs.
[ "MustBindModel", "binds", "the", "supplied", "interface", "with", "the", "named", "table", "panicking", "if", "an", "error", "occurs", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L623-L629
144,834
square/squalor
db.go
rewriteQuery
func rewriteQuery(ctx context.Context, db *DB, start time.Time, q interface{}) (interface{}, error) { if ctx != nil { if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() { // Set an execution deadline for the query. remainingMillis := int64(deadline.Sub(start) / time.Millisecond) if remainingMillis ...
go
func rewriteQuery(ctx context.Context, db *DB, start time.Time, q interface{}) (interface{}, error) { if ctx != nil { if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() { // Set an execution deadline for the query. remainingMillis := int64(deadline.Sub(start) / time.Millisecond) if remainingMillis ...
[ "func", "rewriteQuery", "(", "ctx", "context", ".", "Context", ",", "db", "*", "DB", ",", "start", "time", ".", "Time", ",", "q", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "ctx", "!=", "nil", "{", "if",...
// Rewrite the query to include a deadline if one is present in the context.
[ "Rewrite", "the", "query", "to", "include", "a", "deadline", "if", "one", "is", "present", "in", "the", "context", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L771-L788
144,835
square/squalor
db.go
QueryRowContext
func (db *DB) QueryRowContext(ctx context.Context, q interface{}, args ...interface{}) *Row { ctx, finishTrace := db.addTracerToContext(ctx, opQueryRow) defer finishTrace() start := time.Now() rewrittenQuery, err := rewriteQuery(ctx, db, start, q) if err != nil { return &Row{rows: Rows{Rows: nil, db: nil}, err: ...
go
func (db *DB) QueryRowContext(ctx context.Context, q interface{}, args ...interface{}) *Row { ctx, finishTrace := db.addTracerToContext(ctx, opQueryRow) defer finishTrace() start := time.Now() rewrittenQuery, err := rewriteQuery(ctx, db, start, q) if err != nil { return &Row{rows: Rows{Rows: nil, db: nil}, err: ...
[ "func", "(", "db", "*", "DB", ")", "QueryRowContext", "(", "ctx", "context", ".", "Context", ",", "q", "interface", "{", "}", ",", "args", "...", "interface", "{", "}", ")", "*", "Row", "{", "ctx", ",", "finishTrace", ":=", "db", ".", "addTracerToCon...
// QueryRowContext is the context version of QueryRow.
[ "QueryRowContext", "is", "the", "context", "version", "of", "QueryRow", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L828-L851
144,836
square/squalor
db.go
AddPreCommitHook
func (tx *Tx) AddPreCommitHook(pre PreCommit) { tx.preHooks = append(tx.preHooks, pre) }
go
func (tx *Tx) AddPreCommitHook(pre PreCommit) { tx.preHooks = append(tx.preHooks, pre) }
[ "func", "(", "tx", "*", "Tx", ")", "AddPreCommitHook", "(", "pre", "PreCommit", ")", "{", "tx", ".", "preHooks", "=", "append", "(", "tx", ".", "preHooks", ",", "pre", ")", "\n", "}" ]
// AddPreCommitHook adds a pre-commit hook to this transaction.
[ "AddPreCommitHook", "adds", "a", "pre", "-", "commit", "hook", "to", "this", "transaction", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L947-L949
144,837
square/squalor
db.go
AddPostCommitHook
func (tx *Tx) AddPostCommitHook(post PostCommit) { tx.postHooks = append(tx.postHooks, post) }
go
func (tx *Tx) AddPostCommitHook(post PostCommit) { tx.postHooks = append(tx.postHooks, post) }
[ "func", "(", "tx", "*", "Tx", ")", "AddPostCommitHook", "(", "post", "PostCommit", ")", "{", "tx", ".", "postHooks", "=", "append", "(", "tx", ".", "postHooks", ",", "post", ")", "\n", "}" ]
// AddPostCommitHook adds a post-commit hook to this transaction.
[ "AddPostCommitHook", "adds", "a", "post", "-", "commit", "hook", "to", "this", "transaction", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L952-L954
144,838
square/squalor
db.go
ExecContext
func (tx *Tx) ExecContext(ctx context.Context, query interface{}, args ...interface{}) (sql.Result, error) { ctx, finishTrace := tx.DB.addTracerToContext(ctx, opExec) defer finishTrace() serializer, err := tx.DB.getSerializer(query) if err != nil { return nil, err } querystr, err := Serialize(serializer) if er...
go
func (tx *Tx) ExecContext(ctx context.Context, query interface{}, args ...interface{}) (sql.Result, error) { ctx, finishTrace := tx.DB.addTracerToContext(ctx, opExec) defer finishTrace() serializer, err := tx.DB.getSerializer(query) if err != nil { return nil, err } querystr, err := Serialize(serializer) if er...
[ "func", "(", "tx", "*", "Tx", ")", "ExecContext", "(", "ctx", "context", ".", "Context", ",", "query", "interface", "{", "}", ",", "args", "...", "interface", "{", "}", ")", "(", "sql", ".", "Result", ",", "error", ")", "{", "ctx", ",", "finishTrac...
// ExecContext executes a query using the provided context.
[ "ExecContext", "executes", "a", "query", "using", "the", "provided", "context", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L993-L1011
144,839
square/squalor
db.go
Delete
func (tx *Tx) Delete(list ...interface{}) (int64, error) { return deleteObjects(tx.Context(), tx.DB, tx, list) }
go
func (tx *Tx) Delete(list ...interface{}) (int64, error) { return deleteObjects(tx.Context(), tx.DB, tx, list) }
[ "func", "(", "tx", "*", "Tx", ")", "Delete", "(", "list", "...", "interface", "{", "}", ")", "(", "int64", ",", "error", ")", "{", "return", "deleteObjects", "(", "tx", ".", "Context", "(", ")", ",", "tx", ".", "DB", ",", "tx", ",", "list", ")"...
// Delete runs a batched SQL DELETE statement, grouping the objects by // the model type of the list elements. List elements must be pointers // to structs. // // On success, returns the number of rows deleted. // // Returns an error if an element in the list has not been registered // with BindModel.
[ "Delete", "runs", "a", "batched", "SQL", "DELETE", "statement", "grouping", "the", "objects", "by", "the", "model", "type", "of", "the", "list", "elements", ".", "List", "elements", "must", "be", "pointers", "to", "structs", ".", "On", "success", "returns", ...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L1021-L1023
144,840
square/squalor
db.go
StructScan
func (r *Rows) StructScan(dest interface{}) error { v := reflect.ValueOf(dest) if v.Kind() != reflect.Ptr { return fmt.Errorf("dest must be a pointer: %T", dest) } v = v.Elem() t := v.Type() if r.structT != t { r.structT = t if err := r.initScan(t); err != nil { return err } } if err := r.scanValue...
go
func (r *Rows) StructScan(dest interface{}) error { v := reflect.ValueOf(dest) if v.Kind() != reflect.Ptr { return fmt.Errorf("dest must be a pointer: %T", dest) } v = v.Elem() t := v.Type() if r.structT != t { r.structT = t if err := r.initScan(t); err != nil { return err } } if err := r.scanValue...
[ "func", "(", "r", "*", "Rows", ")", "StructScan", "(", "dest", "interface", "{", "}", ")", "error", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "dest", ")", "\n", "if", "v", ".", "Kind", "(", ")", "!=", "reflect", ".", "Ptr", "{", "return", ...
// StructScan copies the columns in the current row into the struct // pointed at by dest.
[ "StructScan", "copies", "the", "columns", "in", "the", "current", "row", "into", "the", "struct", "pointed", "at", "by", "dest", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L1248-L1268
144,841
square/squalor
db.go
Scan
func (r *Row) Scan(dest ...interface{}) error { if r.err != nil { return r.err } // TODO(bradfitz): for now we need to defensively clone all // []byte that the driver returned (not permitting // *RawBytes in Rows.Scan), since we're about to close // the Rows in our defer, when we return from this function. //...
go
func (r *Row) Scan(dest ...interface{}) error { if r.err != nil { return r.err } // TODO(bradfitz): for now we need to defensively clone all // []byte that the driver returned (not permitting // *RawBytes in Rows.Scan), since we're about to close // the Rows in our defer, when we return from this function. //...
[ "func", "(", "r", "*", "Row", ")", "Scan", "(", "dest", "...", "interface", "{", "}", ")", "error", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "r", ".", "err", "\n", "}", "\n\n", "// TODO(bradfitz): for now we need to defensively clone all", ...
// Scan copies the columns from the matched row into the values // pointed at by dest. If more than one row matches the query, Scan // uses the first row and discards the rest. If no row matches the // query, Scan returns ErrNoRows.
[ "Scan", "copies", "the", "columns", "from", "the", "matched", "row", "into", "the", "values", "pointed", "at", "by", "dest", ".", "If", "more", "than", "one", "row", "matches", "the", "query", "Scan", "uses", "the", "first", "row", "and", "discards", "th...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L1346-L1382
144,842
square/squalor
db.go
StructScan
func (r *Row) StructScan(dest interface{}) error { if r.err != nil { return r.err } defer r.rows.Close() if !r.rows.Next() { if err := r.rows.Err(); err != nil { return err } return sql.ErrNoRows } if err := r.rows.StructScan(dest); err != nil { return err } // Make sure the query can be processe...
go
func (r *Row) StructScan(dest interface{}) error { if r.err != nil { return r.err } defer r.rows.Close() if !r.rows.Next() { if err := r.rows.Err(); err != nil { return err } return sql.ErrNoRows } if err := r.rows.StructScan(dest); err != nil { return err } // Make sure the query can be processe...
[ "func", "(", "r", "*", "Row", ")", "StructScan", "(", "dest", "interface", "{", "}", ")", "error", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "r", ".", "err", "\n", "}", "\n\n", "defer", "r", ".", "rows", ".", "Close", "(", ")", ...
// StructScan copies the columns from the matched row into the struct // pointed at by dest. If more than one row matches the query, Scan // uses the first row and discards the rest. If no row matches the // query, Scan returns ErrNoRows.
[ "StructScan", "copies", "the", "columns", "from", "the", "matched", "row", "into", "the", "struct", "pointed", "at", "by", "dest", ".", "If", "more", "than", "one", "row", "matches", "the", "query", "Scan", "uses", "the", "first", "row", "and", "discards",...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L1388-L1406
144,843
square/squalor
db.go
Columns
func (r *Row) Columns() ([]string, error) { if r.err != nil { return nil, r.err } return r.rows.Columns() }
go
func (r *Row) Columns() ([]string, error) { if r.err != nil { return nil, r.err } return r.rows.Columns() }
[ "func", "(", "r", "*", "Row", ")", "Columns", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "nil", ",", "r", ".", "err", "\n", "}", "\n", "return", "r", ".", "rows", ".", "Colu...
// Columns returns the column names. Columns returns an error if the // row is closed, or if there was a deferred error from processing the // query.
[ "Columns", "returns", "the", "column", "names", ".", "Columns", "returns", "an", "error", "if", "the", "row", "is", "closed", "or", "if", "there", "was", "a", "deferred", "error", "from", "processing", "the", "query", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/db.go#L1411-L1416
144,844
square/squalor
table.go
NewTable
func NewTable(name string, model interface{}) *Table { t := makeTable(name) m := getDBFields(reflect.TypeOf(model)) for k := range m { col := &Column{Name: k} t.Columns = append(t.Columns, col) t.ColumnMap[k] = col } sort.Sort(byName(t.Columns)) return t }
go
func NewTable(name string, model interface{}) *Table { t := makeTable(name) m := getDBFields(reflect.TypeOf(model)) for k := range m { col := &Column{Name: k} t.Columns = append(t.Columns, col) t.ColumnMap[k] = col } sort.Sort(byName(t.Columns)) return t }
[ "func", "NewTable", "(", "name", "string", ",", "model", "interface", "{", "}", ")", "*", "Table", "{", "t", ":=", "makeTable", "(", "name", ")", "\n", "m", ":=", "getDBFields", "(", "reflect", ".", "TypeOf", "(", "model", ")", ")", "\n", "for", "k...
// NewTable constructs a table from a model struct. The resulting // table is less detailed than one created from LoadTable due to the // lack of keys of type info.
[ "NewTable", "constructs", "a", "table", "from", "a", "model", "struct", ".", "The", "resulting", "table", "is", "less", "detailed", "than", "one", "created", "from", "LoadTable", "due", "to", "the", "lack", "of", "keys", "of", "type", "info", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L147-L157
144,845
square/squalor
table.go
NewAliasedTable
func NewAliasedTable(name, alias string, model interface{}) *Table { t := NewTable(name, model) t.Alias = alias return t }
go
func NewAliasedTable(name, alias string, model interface{}) *Table { t := NewTable(name, model) t.Alias = alias return t }
[ "func", "NewAliasedTable", "(", "name", ",", "alias", "string", ",", "model", "interface", "{", "}", ")", "*", "Table", "{", "t", ":=", "NewTable", "(", "name", ",", "model", ")", "\n", "t", ".", "Alias", "=", "alias", "\n", "return", "t", "\n", "}...
// NewAliasedTable constructs a table with an alias from a model struct. The // alias will be used in column names and in joins. The resulting // table is less detailed than one created from LoadTable due to the // lack of keys of type info.
[ "NewAliasedTable", "constructs", "a", "table", "with", "an", "alias", "from", "a", "model", "struct", ".", "The", "alias", "will", "be", "used", "in", "column", "names", "and", "in", "joins", ".", "The", "resulting", "table", "is", "less", "detailed", "tha...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L163-L167
144,846
square/squalor
table.go
LoadTable
func LoadTable(db *sql.DB, name string) (*Table, error) { t := makeTable(name) err := t.loadColumns(db) if err != nil { return nil, err } err = t.loadKeys(db) if err != nil { return nil, err } return t, nil }
go
func LoadTable(db *sql.DB, name string) (*Table, error) { t := makeTable(name) err := t.loadColumns(db) if err != nil { return nil, err } err = t.loadKeys(db) if err != nil { return nil, err } return t, nil }
[ "func", "LoadTable", "(", "db", "*", "sql", ".", "DB", ",", "name", "string", ")", "(", "*", "Table", ",", "error", ")", "{", "t", ":=", "makeTable", "(", "name", ")", "\n", "err", ":=", "t", ".", "loadColumns", "(", "db", ")", "\n", "if", "err...
// LoadTable loads a table's definition from a database.
[ "LoadTable", "loads", "a", "table", "s", "definition", "from", "a", "database", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L170-L181
144,847
square/squalor
table.go
GetKey
func (t *Table) GetKey(cols ...string) *Key { for _, key := range t.Keys { if key.matches(cols...) { return key } } return nil }
go
func (t *Table) GetKey(cols ...string) *Key { for _, key := range t.Keys { if key.matches(cols...) { return key } } return nil }
[ "func", "(", "t", "*", "Table", ")", "GetKey", "(", "cols", "...", "string", ")", "*", "Key", "{", "for", "_", ",", "key", ":=", "range", "t", ".", "Keys", "{", "if", "key", ".", "matches", "(", "cols", "...", ")", "{", "return", "key", "\n", ...
// GetKey retrieves a key from the table definition.
[ "GetKey", "retrieves", "a", "key", "from", "the", "table", "definition", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L200-L207
144,848
square/squalor
table.go
UseIndex
func (t *Table) UseIndex(indexes ...string) *Table { return t.setIndexHint(astUse, indexes) }
go
func (t *Table) UseIndex(indexes ...string) *Table { return t.setIndexHint(astUse, indexes) }
[ "func", "(", "t", "*", "Table", ")", "UseIndex", "(", "indexes", "...", "string", ")", "*", "Table", "{", "return", "t", ".", "setIndexHint", "(", "astUse", ",", "indexes", ")", "\n", "}" ]
// Apply a "USE INDEX" hint to a table. This will replace any existing index hints.
[ "Apply", "a", "USE", "INDEX", "hint", "to", "a", "table", ".", "This", "will", "replace", "any", "existing", "index", "hints", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L210-L212
144,849
square/squalor
table.go
ForceIndex
func (t *Table) ForceIndex(indexes ...string) *Table { return t.setIndexHint(astForce, indexes) }
go
func (t *Table) ForceIndex(indexes ...string) *Table { return t.setIndexHint(astForce, indexes) }
[ "func", "(", "t", "*", "Table", ")", "ForceIndex", "(", "indexes", "...", "string", ")", "*", "Table", "{", "return", "t", ".", "setIndexHint", "(", "astForce", ",", "indexes", ")", "\n", "}" ]
// Apply a "FORCE INDEX" hint to a table. This will replace any existing index hints.
[ "Apply", "a", "FORCE", "INDEX", "hint", "to", "a", "table", ".", "This", "will", "replace", "any", "existing", "index", "hints", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L215-L217
144,850
square/squalor
table.go
IgnoreIndex
func (t *Table) IgnoreIndex(indexes ...string) *Table { return t.setIndexHint(astIgnore, indexes) }
go
func (t *Table) IgnoreIndex(indexes ...string) *Table { return t.setIndexHint(astIgnore, indexes) }
[ "func", "(", "t", "*", "Table", ")", "IgnoreIndex", "(", "indexes", "...", "string", ")", "*", "Table", "{", "return", "t", ".", "setIndexHint", "(", "astIgnore", ",", "indexes", ")", "\n", "}" ]
// Apply an "IGNORE INDEX" hint to a table. This will replace any existing index hints.
[ "Apply", "an", "IGNORE", "INDEX", "hint", "to", "a", "table", ".", "This", "will", "replace", "any", "existing", "index", "hints", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L220-L222
144,851
square/squalor
table.go
C
func (t *Table) C(cols ...string) ValExprBuilder { if len(cols) == 0 { return ValExprBuilder{makeErrVal("no columns specified")} } if len(cols) == 1 { name := cols[0] if _, ok := t.ColumnMap[name]; !ok { return ValExprBuilder{makeErrVal("unknown column: %s", name)} } return ValExprBuilder{&ColName{Name...
go
func (t *Table) C(cols ...string) ValExprBuilder { if len(cols) == 0 { return ValExprBuilder{makeErrVal("no columns specified")} } if len(cols) == 1 { name := cols[0] if _, ok := t.ColumnMap[name]; !ok { return ValExprBuilder{makeErrVal("unknown column: %s", name)} } return ValExprBuilder{&ColName{Name...
[ "func", "(", "t", "*", "Table", ")", "C", "(", "cols", "...", "string", ")", "ValExprBuilder", "{", "if", "len", "(", "cols", ")", "==", "0", "{", "return", "ValExprBuilder", "{", "makeErrVal", "(", "\"", "\"", ")", "}", "\n", "}", "\n\n", "if", ...
// C returns an expression for the specified list of columns. An error // expression is created if any of the columns do not exist in the table. An // error expression is created if no columns are specified.
[ "C", "returns", "an", "expression", "for", "the", "specified", "list", "of", "columns", ".", "An", "error", "expression", "is", "created", "if", "any", "of", "the", "columns", "do", "not", "exist", "in", "the", "table", ".", "An", "error", "expression", ...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L238-L259
144,852
square/squalor
table.go
ValidateModel
func (t *Table) ValidateModel(model interface{}) error { m := getDBFields(reflect.TypeOf(model)) return t.validateFields(m) }
go
func (t *Table) ValidateModel(model interface{}) error { m := getDBFields(reflect.TypeOf(model)) return t.validateFields(m) }
[ "func", "(", "t", "*", "Table", ")", "ValidateModel", "(", "model", "interface", "{", "}", ")", "error", "{", "m", ":=", "getDBFields", "(", "reflect", ".", "TypeOf", "(", "model", ")", ")", "\n", "return", "t", ".", "validateFields", "(", "m", ")", ...
// ValidateModel validates that the model is compatible for the // table's schema. It checks that every column in the database is // mapped to a field in the model and every field in the model has a // corresponding column in the table schema.
[ "ValidateModel", "validates", "that", "the", "model", "is", "compatible", "for", "the", "table", "s", "schema", ".", "It", "checks", "that", "every", "column", "in", "the", "database", "is", "mapped", "to", "a", "field", "in", "the", "model", "and", "every...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L344-L347
144,853
square/squalor
table.go
aliasOrName
func (t *Table) aliasOrName() string { if t.Alias != "" { return t.Alias } return t.Name }
go
func (t *Table) aliasOrName() string { if t.Alias != "" { return t.Alias } return t.Name }
[ "func", "(", "t", "*", "Table", ")", "aliasOrName", "(", ")", "string", "{", "if", "t", ".", "Alias", "!=", "\"", "\"", "{", "return", "t", ".", "Alias", "\n", "}", "\n", "return", "t", ".", "Name", "\n", "}" ]
// aliasOrName will return table's alias if it is not blank, // otherwise it will return the table's name.
[ "aliasOrName", "will", "return", "table", "s", "alias", "if", "it", "is", "not", "blank", "otherwise", "it", "will", "return", "the", "table", "s", "name", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L351-L356
144,854
square/squalor
table.go
loadColumns
func (t *Table) loadColumns(db *sql.DB) error { rows, err := db.Query("SHOW FULL COLUMNS FROM " + t.Name) if err != nil { return err } defer rows.Close() cols, err := rows.Columns() if err != nil { return err } var ( col string sqlType string nullable string extra string ) m := map[stri...
go
func (t *Table) loadColumns(db *sql.DB) error { rows, err := db.Query("SHOW FULL COLUMNS FROM " + t.Name) if err != nil { return err } defer rows.Close() cols, err := rows.Columns() if err != nil { return err } var ( col string sqlType string nullable string extra string ) m := map[stri...
[ "func", "(", "t", "*", "Table", ")", "loadColumns", "(", "db", "*", "sql", ".", "DB", ")", "error", "{", "rows", ",", "err", ":=", "db", ".", "Query", "(", "\"", "\"", "+", "t", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return",...
// loadColumns loads a table's columns from a database. MySQL // specific.
[ "loadColumns", "loads", "a", "table", "s", "columns", "from", "a", "database", ".", "MySQL", "specific", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/table.go#L360-L409
144,855
square/squalor
builder.go
On
func (b *JoinBuilder) On(expr BoolExpr) *JoinBuilder { b.Cond = &OnJoinCond{Expr: unwrapBoolExpr(expr)} return b }
go
func (b *JoinBuilder) On(expr BoolExpr) *JoinBuilder { b.Cond = &OnJoinCond{Expr: unwrapBoolExpr(expr)} return b }
[ "func", "(", "b", "*", "JoinBuilder", ")", "On", "(", "expr", "BoolExpr", ")", "*", "JoinBuilder", "{", "b", ".", "Cond", "=", "&", "OnJoinCond", "{", "Expr", ":", "unwrapBoolExpr", "(", "expr", ")", "}", "\n", "return", "b", "\n", "}" ]
// On sets an ON join condition for the expression, replacing any // existing join condition.
[ "On", "sets", "an", "ON", "join", "condition", "for", "the", "expression", "replacing", "any", "existing", "join", "condition", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L144-L147
144,856
square/squalor
builder.go
Using
func (b *JoinBuilder) Using(cols ...interface{}) *JoinBuilder { var vals Columns for _, c := range cols { var name string switch t := c.(type) { case string: name = t case ValExprBuilder: if n, ok := t.ValExpr.(*ColName); ok { name = n.Name break } } var v ValExpr if len(name) == 0 { ...
go
func (b *JoinBuilder) Using(cols ...interface{}) *JoinBuilder { var vals Columns for _, c := range cols { var name string switch t := c.(type) { case string: name = t case ValExprBuilder: if n, ok := t.ValExpr.(*ColName); ok { name = n.Name break } } var v ValExpr if len(name) == 0 { ...
[ "func", "(", "b", "*", "JoinBuilder", ")", "Using", "(", "cols", "...", "interface", "{", "}", ")", "*", "JoinBuilder", "{", "var", "vals", "Columns", "\n", "for", "_", ",", "c", ":=", "range", "cols", "{", "var", "name", "string", "\n", "switch", ...
// Using sets a USING join condition for the expression, replacing any // existing join condition. The columns must exist in both the left // and right sides of the join expression.
[ "Using", "sets", "a", "USING", "join", "condition", "for", "the", "expression", "replacing", "any", "existing", "join", "condition", ".", "The", "columns", "must", "exist", "in", "both", "the", "left", "and", "right", "sides", "of", "the", "join", "expressio...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L152-L178
144,857
square/squalor
builder.go
Add
func (b *InsertBuilder) Add(vals ...interface{}) *InsertBuilder { var rows Values if b.Insert.Rows != nil { rows = b.Insert.Rows.(Values) } b.Insert.Rows = append(rows, makeValTuple(vals)) return b }
go
func (b *InsertBuilder) Add(vals ...interface{}) *InsertBuilder { var rows Values if b.Insert.Rows != nil { rows = b.Insert.Rows.(Values) } b.Insert.Rows = append(rows, makeValTuple(vals)) return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "Add", "(", "vals", "...", "interface", "{", "}", ")", "*", "InsertBuilder", "{", "var", "rows", "Values", "\n", "if", "b", ".", "Insert", ".", "Rows", "!=", "nil", "{", "rows", "=", "b", ".", "Insert", ...
// Add appends a single row of values to the statement.
[ "Add", "appends", "a", "single", "row", "of", "values", "to", "the", "statement", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L239-L246
144,858
square/squalor
builder.go
OnDupKeyUpdate
func (b *InsertBuilder) OnDupKeyUpdate(col interface{}, val interface{}) *InsertBuilder { b.Insert.OnDup = append(b.Insert.OnDup, makeUpdateExpr(b.table, col, val)) return b }
go
func (b *InsertBuilder) OnDupKeyUpdate(col interface{}, val interface{}) *InsertBuilder { b.Insert.OnDup = append(b.Insert.OnDup, makeUpdateExpr(b.table, col, val)) return b }
[ "func", "(", "b", "*", "InsertBuilder", ")", "OnDupKeyUpdate", "(", "col", "interface", "{", "}", ",", "val", "interface", "{", "}", ")", "*", "InsertBuilder", "{", "b", ".", "Insert", ".", "OnDup", "=", "append", "(", "b", ".", "Insert", ".", "OnDup...
// OnDupKeyUpdate specifies an ON DUPLICATE KEY UPDATE expression to // be performed when a duplicate primary key is encountered during // insertion. The specified column must exist within the table being // inserted into.
[ "OnDupKeyUpdate", "specifies", "an", "ON", "DUPLICATE", "KEY", "UPDATE", "expression", "to", "be", "performed", "when", "a", "duplicate", "primary", "key", "is", "encountered", "during", "insertion", ".", "The", "specified", "column", "must", "exist", "within", ...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L262-L265
144,859
square/squalor
builder.go
OnDupKeyUpdateColumn
func (b *InsertBuilder) OnDupKeyUpdateColumn(col interface{}) *InsertBuilder { colName := getColName(b.table, col) val := &FuncExpr{Name: "VALUES", Exprs: []SelectExpr{&NonStarExpr{Expr: colName}}} return b.OnDupKeyUpdate(col, val) }
go
func (b *InsertBuilder) OnDupKeyUpdateColumn(col interface{}) *InsertBuilder { colName := getColName(b.table, col) val := &FuncExpr{Name: "VALUES", Exprs: []SelectExpr{&NonStarExpr{Expr: colName}}} return b.OnDupKeyUpdate(col, val) }
[ "func", "(", "b", "*", "InsertBuilder", ")", "OnDupKeyUpdateColumn", "(", "col", "interface", "{", "}", ")", "*", "InsertBuilder", "{", "colName", ":=", "getColName", "(", "b", ".", "table", ",", "col", ")", "\n", "val", ":=", "&", "FuncExpr", "{", "Na...
// OnDupKeyUpdateColumn specifies on ON DUPLICATE KEY UPDATE // expression to be performed when a duplicate primary key is // encountered during insertion. The specified column must exist // within the table being inserted into. The value to use for updating // is taken from the corresponding column value in the row be...
[ "OnDupKeyUpdateColumn", "specifies", "on", "ON", "DUPLICATE", "KEY", "UPDATE", "expression", "to", "be", "performed", "when", "a", "duplicate", "primary", "key", "is", "encountered", "during", "insertion", ".", "The", "specified", "column", "must", "exist", "withi...
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L273-L277
144,860
square/squalor
builder.go
AddRows
func (b *ReplaceBuilder) AddRows(rows Values) *ReplaceBuilder { if b.Insert.Rows == nil { b.Insert.Rows = rows } else { b.Insert.Rows = append(b.Insert.Rows.(Values), rows...) } return b }
go
func (b *ReplaceBuilder) AddRows(rows Values) *ReplaceBuilder { if b.Insert.Rows == nil { b.Insert.Rows = rows } else { b.Insert.Rows = append(b.Insert.Rows.(Values), rows...) } return b }
[ "func", "(", "b", "*", "ReplaceBuilder", ")", "AddRows", "(", "rows", "Values", ")", "*", "ReplaceBuilder", "{", "if", "b", ".", "Insert", ".", "Rows", "==", "nil", "{", "b", ".", "Insert", ".", "Rows", "=", "rows", "\n", "}", "else", "{", "b", "...
// AddRows appends multiple rows of values to the statement.
[ "AddRows", "appends", "multiple", "rows", "of", "values", "to", "the", "statement", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L329-L336
144,861
square/squalor
builder.go
Having
func (b *SelectBuilder) Having(expr BoolExpr) *SelectBuilder { b.Select.Having = &Where{ Type: astHaving, Expr: unwrapBoolExpr(expr), } return b }
go
func (b *SelectBuilder) Having(expr BoolExpr) *SelectBuilder { b.Select.Having = &Where{ Type: astHaving, Expr: unwrapBoolExpr(expr), } return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "Having", "(", "expr", "BoolExpr", ")", "*", "SelectBuilder", "{", "b", ".", "Select", ".", "Having", "=", "&", "Where", "{", "Type", ":", "astHaving", ",", "Expr", ":", "unwrapBoolExpr", "(", "expr", ")", ...
// Having sets the HAVING clause for the statement, replacing any // existing having clause.
[ "Having", "sets", "the", "HAVING", "clause", "for", "the", "statement", "replacing", "any", "existing", "having", "clause", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L455-L461
144,862
square/squalor
builder.go
GroupBy
func (b *SelectBuilder) GroupBy(vals ...ValExpr) *SelectBuilder { for i := range vals { vals[i] = unwrapValExpr(vals[i]) } b.Select.GroupBy = GroupBy(vals) return b }
go
func (b *SelectBuilder) GroupBy(vals ...ValExpr) *SelectBuilder { for i := range vals { vals[i] = unwrapValExpr(vals[i]) } b.Select.GroupBy = GroupBy(vals) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "GroupBy", "(", "vals", "...", "ValExpr", ")", "*", "SelectBuilder", "{", "for", "i", ":=", "range", "vals", "{", "vals", "[", "i", "]", "=", "unwrapValExpr", "(", "vals", "[", "i", "]", ")", "\n", "}", ...
// GroupBy sets the GROUP BY clause for the statement, replacing any // existing group by clause.
[ "GroupBy", "sets", "the", "GROUP", "BY", "clause", "for", "the", "statement", "replacing", "any", "existing", "group", "by", "clause", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L465-L471
144,863
square/squalor
builder.go
Offset
func (b *SelectBuilder) Offset(offset interface{}) *SelectBuilder { if b.Select.Limit == nil { panic("offset without limit") } b.Select.Limit.Offset = makeValExpr(offset) return b }
go
func (b *SelectBuilder) Offset(offset interface{}) *SelectBuilder { if b.Select.Limit == nil { panic("offset without limit") } b.Select.Limit.Offset = makeValExpr(offset) return b }
[ "func", "(", "b", "*", "SelectBuilder", ")", "Offset", "(", "offset", "interface", "{", "}", ")", "*", "SelectBuilder", "{", "if", "b", ".", "Select", ".", "Limit", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "b", ".", "Sele...
// Offset sets the OFFSET clause for the statement. It is an error to // set the offset before setting the limit.
[ "Offset", "sets", "the", "OFFSET", "clause", "for", "the", "statement", ".", "It", "is", "an", "error", "to", "set", "the", "offset", "before", "setting", "the", "limit", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L492-L498
144,864
square/squalor
builder.go
Limit
func (b *UpdateBuilder) Limit(count interface{}) *UpdateBuilder { if b.Update.Limit == nil { b.Update.Limit = &Limit{} } b.Update.Limit.Rowcount = makeValExpr(count) return b }
go
func (b *UpdateBuilder) Limit(count interface{}) *UpdateBuilder { if b.Update.Limit == nil { b.Update.Limit = &Limit{} } b.Update.Limit.Rowcount = makeValExpr(count) return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Limit", "(", "count", "interface", "{", "}", ")", "*", "UpdateBuilder", "{", "if", "b", ".", "Update", ".", "Limit", "==", "nil", "{", "b", ".", "Update", ".", "Limit", "=", "&", "Limit", "{", "}", "\...
// Limit sets the limit clause for the statement, replacing any // existing limit clause.
[ "Limit", "sets", "the", "limit", "clause", "for", "the", "statement", "replacing", "any", "existing", "limit", "clause", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L518-L524
144,865
square/squalor
builder.go
OrderBy
func (b *UpdateBuilder) OrderBy(exprs ...interface{}) *UpdateBuilder { b.Update.OrderBy = makeOrderBy(exprs...) return b }
go
func (b *UpdateBuilder) OrderBy(exprs ...interface{}) *UpdateBuilder { b.Update.OrderBy = makeOrderBy(exprs...) return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "OrderBy", "(", "exprs", "...", "interface", "{", "}", ")", "*", "UpdateBuilder", "{", "b", ".", "Update", ".", "OrderBy", "=", "makeOrderBy", "(", "exprs", "...", ")", "\n", "return", "b", "\n", "}" ]
// OrderBy sets the order by clause for the statement, replacing any // existing order by clause.
[ "OrderBy", "sets", "the", "order", "by", "clause", "for", "the", "statement", "replacing", "any", "existing", "order", "by", "clause", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L528-L531
144,866
square/squalor
builder.go
Set
func (b *UpdateBuilder) Set(col interface{}, val interface{}) *UpdateBuilder { b.Update.Exprs = append(b.Update.Exprs, makeUpdateExpr(b.table, col, val)) return b }
go
func (b *UpdateBuilder) Set(col interface{}, val interface{}) *UpdateBuilder { b.Update.Exprs = append(b.Update.Exprs, makeUpdateExpr(b.table, col, val)) return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Set", "(", "col", "interface", "{", "}", ",", "val", "interface", "{", "}", ")", "*", "UpdateBuilder", "{", "b", ".", "Update", ".", "Exprs", "=", "append", "(", "b", ".", "Update", ".", "Exprs", ",", ...
// Set appends a Set expression to the statement. The specified column // must exist within the table being updated.
[ "Set", "appends", "a", "Set", "expression", "to", "the", "statement", ".", "The", "specified", "column", "must", "exist", "within", "the", "table", "being", "updated", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L535-L538
144,867
square/squalor
builder.go
Where
func (b *UpdateBuilder) Where(expr BoolExpr) *UpdateBuilder { b.Update.Where = &Where{ Type: astWhere, Expr: unwrapBoolExpr(expr), } return b }
go
func (b *UpdateBuilder) Where(expr BoolExpr) *UpdateBuilder { b.Update.Where = &Where{ Type: astWhere, Expr: unwrapBoolExpr(expr), } return b }
[ "func", "(", "b", "*", "UpdateBuilder", ")", "Where", "(", "expr", "BoolExpr", ")", "*", "UpdateBuilder", "{", "b", ".", "Update", ".", "Where", "=", "&", "Where", "{", "Type", ":", "astWhere", ",", "Expr", ":", "unwrapBoolExpr", "(", "expr", ")", ",...
// Where sets the where clause for the statement, replacing any // existing where clause.
[ "Where", "sets", "the", "where", "clause", "for", "the", "statement", "replacing", "any", "existing", "where", "clause", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L542-L548
144,868
square/squalor
builder.go
Eq
func (b ValExprBuilder) Eq(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astEQ, makeValExpr(val)) }
go
func (b ValExprBuilder) Eq(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astEQ, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Eq", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astEQ", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Eq creates a = comparison expression.
[ "Eq", "creates", "a", "=", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L592-L594
144,869
square/squalor
builder.go
Neq
func (b ValExprBuilder) Neq(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNE, makeValExpr(val)) }
go
func (b ValExprBuilder) Neq(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNE, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Neq", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astNE", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Neq creates a != comparison expression.
[ "Neq", "creates", "a", "!", "=", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L597-L599
144,870
square/squalor
builder.go
Lt
func (b ValExprBuilder) Lt(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLT, makeValExpr(val)) }
go
func (b ValExprBuilder) Lt(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLT, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Lt", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astLT", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Lt creates a < comparison expression.
[ "Lt", "creates", "a", "<", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L611-L613
144,871
square/squalor
builder.go
Lte
func (b ValExprBuilder) Lte(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLE, makeValExpr(val)) }
go
func (b ValExprBuilder) Lte(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLE, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Lte", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astLE", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Lte creates a <= comparison expression.
[ "Lte", "creates", "a", "<", "=", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L616-L618
144,872
square/squalor
builder.go
Gt
func (b ValExprBuilder) Gt(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astGT, makeValExpr(val)) }
go
func (b ValExprBuilder) Gt(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astGT, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Gt", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astGT", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Gt creates a > comparison expression.
[ "Gt", "creates", "a", ">", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L621-L623
144,873
square/squalor
builder.go
Gte
func (b ValExprBuilder) Gte(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astGE, makeValExpr(val)) }
go
func (b ValExprBuilder) Gte(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astGE, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Gte", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astGE", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Gte creates a >= comparison expression.
[ "Gte", "creates", "a", ">", "=", "comparison", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L626-L628
144,874
square/squalor
builder.go
InTuple
func (b ValExprBuilder) InTuple(tuple Tuple) BoolExprBuilder { if valTuple, ok := tuple.(ValTuple); ok { if len(valTuple.Exprs) == 0 { return b.makeComparisonExpr(astIn, makeErrVal("empty list")) } } return b.makeComparisonExpr(astIn, tuple) }
go
func (b ValExprBuilder) InTuple(tuple Tuple) BoolExprBuilder { if valTuple, ok := tuple.(ValTuple); ok { if len(valTuple.Exprs) == 0 { return b.makeComparisonExpr(astIn, makeErrVal("empty list")) } } return b.makeComparisonExpr(astIn, tuple) }
[ "func", "(", "b", "ValExprBuilder", ")", "InTuple", "(", "tuple", "Tuple", ")", "BoolExprBuilder", "{", "if", "valTuple", ",", "ok", ":=", "tuple", ".", "(", "ValTuple", ")", ";", "ok", "{", "if", "len", "(", "valTuple", ".", "Exprs", ")", "==", "0",...
// InTuple creates an IN expression from a tuple.
[ "InTuple", "creates", "an", "IN", "expression", "from", "a", "tuple", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L636-L643
144,875
square/squalor
builder.go
NotInTuple
func (b ValExprBuilder) NotInTuple(tuple Tuple) BoolExprBuilder { if valTuple, ok := tuple.(ValTuple); ok { if len(valTuple.Exprs) == 0 { return b.makeComparisonExpr(astNotIn, makeErrVal("empty list")) } } return b.makeComparisonExpr(astNotIn, tuple) }
go
func (b ValExprBuilder) NotInTuple(tuple Tuple) BoolExprBuilder { if valTuple, ok := tuple.(ValTuple); ok { if len(valTuple.Exprs) == 0 { return b.makeComparisonExpr(astNotIn, makeErrVal("empty list")) } } return b.makeComparisonExpr(astNotIn, tuple) }
[ "func", "(", "b", "ValExprBuilder", ")", "NotInTuple", "(", "tuple", "Tuple", ")", "BoolExprBuilder", "{", "if", "valTuple", ",", "ok", ":=", "tuple", ".", "(", "ValTuple", ")", ";", "ok", "{", "if", "len", "(", "valTuple", ".", "Exprs", ")", "==", "...
// NotInTuple creates a NOT IN expression from a tuple.
[ "NotInTuple", "creates", "a", "NOT", "IN", "expression", "from", "a", "tuple", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L651-L658
144,876
square/squalor
builder.go
Like
func (b ValExprBuilder) Like(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLike, makeValExpr(val)) }
go
func (b ValExprBuilder) Like(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astLike, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "Like", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astLike", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// Like creates a LIKE expression.
[ "Like", "creates", "a", "LIKE", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L661-L663
144,877
square/squalor
builder.go
NotLike
func (b ValExprBuilder) NotLike(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNotLike, makeValExpr(val)) }
go
func (b ValExprBuilder) NotLike(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNotLike, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "NotLike", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astNotLike", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// NotLike creates a NOT LIKE expression.
[ "NotLike", "creates", "a", "NOT", "LIKE", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L666-L668
144,878
square/squalor
builder.go
RegExp
func (b ValExprBuilder) RegExp(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astRegExp, makeValExpr(val)) }
go
func (b ValExprBuilder) RegExp(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astRegExp, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "RegExp", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astRegExp", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// RegExp creates a REGEXP expression.
[ "RegExp", "creates", "a", "REGEXP", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L671-L673
144,879
square/squalor
builder.go
NotRegExp
func (b ValExprBuilder) NotRegExp(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNotRegExp, makeValExpr(val)) }
go
func (b ValExprBuilder) NotRegExp(val interface{}) BoolExprBuilder { return b.makeComparisonExpr(astNotRegExp, makeValExpr(val)) }
[ "func", "(", "b", "ValExprBuilder", ")", "NotRegExp", "(", "val", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeComparisonExpr", "(", "astNotRegExp", ",", "makeValExpr", "(", "val", ")", ")", "\n", "}" ]
// NotRegExp creates a NOT REGEXP expression.
[ "NotRegExp", "creates", "a", "NOT", "REGEXP", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L676-L678
144,880
square/squalor
builder.go
Between
func (b ValExprBuilder) Between(from interface{}, to interface{}) BoolExprBuilder { return b.makeRangeCond(astBetween, from, to) }
go
func (b ValExprBuilder) Between(from interface{}, to interface{}) BoolExprBuilder { return b.makeRangeCond(astBetween, from, to) }
[ "func", "(", "b", "ValExprBuilder", ")", "Between", "(", "from", "interface", "{", "}", ",", "to", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeRangeCond", "(", "astBetween", ",", "from", ",", "to", ")", "\n", "}" ]
// Between creates a BETWEEN expression.
[ "Between", "creates", "a", "BETWEEN", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L692-L694
144,881
square/squalor
builder.go
NotBetween
func (b ValExprBuilder) NotBetween(from interface{}, to interface{}) BoolExprBuilder { return b.makeRangeCond(astNotBetween, from, to) }
go
func (b ValExprBuilder) NotBetween(from interface{}, to interface{}) BoolExprBuilder { return b.makeRangeCond(astNotBetween, from, to) }
[ "func", "(", "b", "ValExprBuilder", ")", "NotBetween", "(", "from", "interface", "{", "}", ",", "to", "interface", "{", "}", ")", "BoolExprBuilder", "{", "return", "b", ".", "makeRangeCond", "(", "astNotBetween", ",", "from", ",", "to", ")", "\n", "}" ]
// NotBetween creates a NOT BETWEEN expression.
[ "NotBetween", "creates", "a", "NOT", "BETWEEN", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L697-L699
144,882
square/squalor
builder.go
And
func (e BoolExprBuilder) And(expr BoolExpr) BoolExprBuilder { var conditions []BoolExpr if andExpr, ok := e.BoolExpr.(*AndExpr); ok { conditions = append(conditions, andExpr.Exprs...) } else { conditions = append(conditions, e.BoolExpr) } unwrapped := unwrapBoolExpr(expr) if andExpr, ok := unwrapped.(*AndEx...
go
func (e BoolExprBuilder) And(expr BoolExpr) BoolExprBuilder { var conditions []BoolExpr if andExpr, ok := e.BoolExpr.(*AndExpr); ok { conditions = append(conditions, andExpr.Exprs...) } else { conditions = append(conditions, e.BoolExpr) } unwrapped := unwrapBoolExpr(expr) if andExpr, ok := unwrapped.(*AndEx...
[ "func", "(", "e", "BoolExprBuilder", ")", "And", "(", "expr", "BoolExpr", ")", "BoolExprBuilder", "{", "var", "conditions", "[", "]", "BoolExpr", "\n\n", "if", "andExpr", ",", "ok", ":=", "e", ".", "BoolExpr", ".", "(", "*", "AndExpr", ")", ";", "ok", ...
// And creates an AND expression.
[ "And", "creates", "an", "AND", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L857-L878
144,883
square/squalor
builder.go
Or
func (e BoolExprBuilder) Or(expr BoolExpr) BoolExprBuilder { var conditions []BoolExpr if orExpr, ok := e.BoolExpr.(*OrExpr); ok { conditions = append(conditions, orExpr.Exprs...) } else { conditions = append(conditions, e.BoolExpr) } unwrapped := unwrapBoolExpr(expr) if orExpr, ok := unwrapped.(*OrExpr); o...
go
func (e BoolExprBuilder) Or(expr BoolExpr) BoolExprBuilder { var conditions []BoolExpr if orExpr, ok := e.BoolExpr.(*OrExpr); ok { conditions = append(conditions, orExpr.Exprs...) } else { conditions = append(conditions, e.BoolExpr) } unwrapped := unwrapBoolExpr(expr) if orExpr, ok := unwrapped.(*OrExpr); o...
[ "func", "(", "e", "BoolExprBuilder", ")", "Or", "(", "expr", "BoolExpr", ")", "BoolExprBuilder", "{", "var", "conditions", "[", "]", "BoolExpr", "\n\n", "if", "orExpr", ",", "ok", ":=", "e", ".", "BoolExpr", ".", "(", "*", "OrExpr", ")", ";", "ok", "...
// Or creates an OR expression.
[ "Or", "creates", "an", "OR", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L881-L902
144,884
square/squalor
builder.go
Not
func (e BoolExprBuilder) Not() BoolExprBuilder { return BoolExprBuilder{ &NotExpr{ Op: astNotExpr, Expr: &ParenBoolExpr{Expr: e.BoolExpr}, }} }
go
func (e BoolExprBuilder) Not() BoolExprBuilder { return BoolExprBuilder{ &NotExpr{ Op: astNotExpr, Expr: &ParenBoolExpr{Expr: e.BoolExpr}, }} }
[ "func", "(", "e", "BoolExprBuilder", ")", "Not", "(", ")", "BoolExprBuilder", "{", "return", "BoolExprBuilder", "{", "&", "NotExpr", "{", "Op", ":", "astNotExpr", ",", "Expr", ":", "&", "ParenBoolExpr", "{", "Expr", ":", "e", ".", "BoolExpr", "}", ",", ...
// Not creates a NOT expression.
[ "Not", "creates", "a", "NOT", "expression", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L905-L911
144,885
square/squalor
builder.go
G
func G(list ...interface{}) ValExprBuilder { if len(list) == 0 { return ValExprBuilder{makeErrVal("empty group")} } return ValExprBuilder{makeValTuple(list)} }
go
func G(list ...interface{}) ValExprBuilder { if len(list) == 0 { return ValExprBuilder{makeErrVal("empty group")} } return ValExprBuilder{makeValTuple(list)} }
[ "func", "G", "(", "list", "...", "interface", "{", "}", ")", "ValExprBuilder", "{", "if", "len", "(", "list", ")", "==", "0", "{", "return", "ValExprBuilder", "{", "makeErrVal", "(", "\"", "\"", ")", "}", "\n", "}", "\n", "return", "ValExprBuilder", ...
// G creates a group of values.
[ "G", "creates", "a", "group", "of", "values", "." ]
afa27bf1201c5d7a66d5a3140e6d79db21d55576
https://github.com/square/squalor/blob/afa27bf1201c5d7a66d5a3140e6d79db21d55576/builder.go#L1039-L1044
144,886
jackwakefield/gopac
parser.go
FindProxy
func (parser *Parser) FindProxy(url, host string) (string, error) { if parser.rt == nil { return "", errors.New("A proxy auto-config file has not been loaded") } return parser.rt.findProxyForURL(url, host) }
go
func (parser *Parser) FindProxy(url, host string) (string, error) { if parser.rt == nil { return "", errors.New("A proxy auto-config file has not been loaded") } return parser.rt.findProxyForURL(url, host) }
[ "func", "(", "parser", "*", "Parser", ")", "FindProxy", "(", "url", ",", "host", "string", ")", "(", "string", ",", "error", ")", "{", "if", "parser", ".", "rt", "==", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ...
// FindProxy returns a proxy entry for the given URL or host returning an error // if the attempt fails.
[ "FindProxy", "returns", "a", "proxy", "entry", "for", "the", "given", "URL", "or", "host", "returning", "an", "error", "if", "the", "attempt", "fails", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/parser.go#L98-L104
144,887
knqyf263/go-deb-version
version.go
get
func (n defaultNumSlice) get(i int) int { if len(n) > i { return n[i] } return 0 }
go
func (n defaultNumSlice) get(i int) int { if len(n) > i { return n[i] } return 0 }
[ "func", "(", "n", "defaultNumSlice", ")", "get", "(", "i", "int", ")", "int", "{", "if", "len", "(", "n", ")", ">", "i", "{", "return", "n", "[", "i", "]", "\n", "}", "\n", "return", "0", "\n", "}" ]
// get function returns 0, if the slice does not have the specified index.
[ "get", "function", "returns", "0", "if", "the", "slice", "does", "not", "have", "the", "specified", "index", "." ]
9865fe14d09b1c729188ac810466dde90f897ee3
https://github.com/knqyf263/go-deb-version/blob/9865fe14d09b1c729188ac810466dde90f897ee3/version.go#L16-L21
144,888
knqyf263/go-deb-version
version.go
get
func (s defaultStringSlice) get(i int) string { if len(s) > i { return s[i] } return "" }
go
func (s defaultStringSlice) get(i int) string { if len(s) > i { return s[i] } return "" }
[ "func", "(", "s", "defaultStringSlice", ")", "get", "(", "i", "int", ")", "string", "{", "if", "len", "(", "s", ")", ">", "i", "{", "return", "s", "[", "i", "]", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// get function returns "", if the slice does not have the specified index.
[ "get", "function", "returns", "if", "the", "slice", "does", "not", "have", "the", "specified", "index", "." ]
9865fe14d09b1c729188ac810466dde90f897ee3
https://github.com/knqyf263/go-deb-version/blob/9865fe14d09b1c729188ac810466dde90f897ee3/version.go#L26-L31
144,889
knqyf263/go-deb-version
version.go
order
func order(r rune) int { // all the letters sort earlier than all the non-letters if unicode.IsLetter(r) { return int(r) } // a tilde sorts before anything if r == '~' { return -1 } return int(r) + 256 }
go
func order(r rune) int { // all the letters sort earlier than all the non-letters if unicode.IsLetter(r) { return int(r) } // a tilde sorts before anything if r == '~' { return -1 } return int(r) + 256 }
[ "func", "order", "(", "r", "rune", ")", "int", "{", "// all the letters sort earlier than all the non-letters", "if", "unicode", ".", "IsLetter", "(", "r", ")", "{", "return", "int", "(", "r", ")", "\n", "}", "\n\n", "// a tilde sorts before anything", "if", "r"...
// order function returns the number corresponding to rune
[ "order", "function", "returns", "the", "number", "corresponding", "to", "rune" ]
9865fe14d09b1c729188ac810466dde90f897ee3
https://github.com/knqyf263/go-deb-version/blob/9865fe14d09b1c729188ac810466dde90f897ee3/version.go#L234-L246
144,890
jackwakefield/gopac
utils.go
dnsDomainIs
func dnsDomainIs(host, domain string) bool { if len(host) < len(domain) { return false } return strings.HasSuffix(host, domain) }
go
func dnsDomainIs(host, domain string) bool { if len(host) < len(domain) { return false } return strings.HasSuffix(host, domain) }
[ "func", "dnsDomainIs", "(", "host", ",", "domain", "string", ")", "bool", "{", "if", "len", "(", "host", ")", "<", "len", "(", "domain", ")", "{", "return", "false", "\n", "}", "\n\n", "return", "strings", ".", "HasSuffix", "(", "host", ",", "domain"...
// dnsDomainIs return true if the host is valid for the domain.
[ "dnsDomainIs", "return", "true", "if", "the", "host", "is", "valid", "for", "the", "domain", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L188-L194
144,891
jackwakefield/gopac
utils.go
localHostOrDomainIs
func localHostOrDomainIs(host, hostdom string) bool { if host == hostdom { return true } return strings.LastIndex(hostdom, host+".") == 0 }
go
func localHostOrDomainIs(host, hostdom string) bool { if host == hostdom { return true } return strings.LastIndex(hostdom, host+".") == 0 }
[ "func", "localHostOrDomainIs", "(", "host", ",", "hostdom", "string", ")", "bool", "{", "if", "host", "==", "hostdom", "{", "return", "true", "\n", "}", "\n\n", "return", "strings", ".", "LastIndex", "(", "hostdom", ",", "host", "+", "\"", "\"", ")", "...
// localHostOrDomainIs returns true if the host matches the specified hostdom, // or if there is no domain name part in the host, but the unqualified hostdom // matches.
[ "localHostOrDomainIs", "returns", "true", "if", "the", "host", "matches", "the", "specified", "hostdom", "or", "if", "there", "is", "no", "domain", "name", "part", "in", "the", "host", "but", "the", "unqualified", "hostdom", "matches", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L199-L205
144,892
jackwakefield/gopac
utils.go
isResolvable
func isResolvable(host string) bool { if len(host) == 0 { return false } if _, err := net.ResolveIPAddr("ip4", host); err != nil { return false } return true }
go
func isResolvable(host string) bool { if len(host) == 0 { return false } if _, err := net.ResolveIPAddr("ip4", host); err != nil { return false } return true }
[ "func", "isResolvable", "(", "host", "string", ")", "bool", "{", "if", "len", "(", "host", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "if", "_", ",", "err", ":=", "net", ".", "ResolveIPAddr", "(", "\"", "\"", ",", "host", ")", ";"...
// isResolvable returns true if the host is resolvable.
[ "isResolvable", "returns", "true", "if", "the", "host", "is", "resolvable", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L208-L218
144,893
jackwakefield/gopac
utils.go
isInNet
func isInNet(host, pattern, mask string) bool { if len(host) == 0 { return false } address, err := net.ResolveIPAddr("ip4", host) if err != nil { return false } maskIp := net.IPMask(net.ParseIP(mask)) return address.IP.Mask(maskIp).String() == pattern }
go
func isInNet(host, pattern, mask string) bool { if len(host) == 0 { return false } address, err := net.ResolveIPAddr("ip4", host) if err != nil { return false } maskIp := net.IPMask(net.ParseIP(mask)) return address.IP.Mask(maskIp).String() == pattern }
[ "func", "isInNet", "(", "host", ",", "pattern", ",", "mask", "string", ")", "bool", "{", "if", "len", "(", "host", ")", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "address", ",", "err", ":=", "net", ".", "ResolveIPAddr", "(", "\"", "\"",...
// isInNet returns true if the IP address of the host matches the specified IP // address pattern. // mask is the pattern informing which parts of the IP address to match against. // 0 means ignore, 255 means match.
[ "isInNet", "returns", "true", "if", "the", "IP", "address", "of", "the", "host", "matches", "the", "specified", "IP", "address", "pattern", ".", "mask", "is", "the", "pattern", "informing", "which", "parts", "of", "the", "IP", "address", "to", "match", "ag...
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L224-L237
144,894
jackwakefield/gopac
utils.go
dnsResolve
func dnsResolve(host string) string { address, err := net.ResolveIPAddr("ip4", host) if err != nil { return "" } return address.String() }
go
func dnsResolve(host string) string { address, err := net.ResolveIPAddr("ip4", host) if err != nil { return "" } return address.String() }
[ "func", "dnsResolve", "(", "host", "string", ")", "string", "{", "address", ",", "err", ":=", "net", ".", "ResolveIPAddr", "(", "\"", "\"", ",", "host", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", ...
// dnsResolve returns the IP address of the host.
[ "dnsResolve", "returns", "the", "IP", "address", "of", "the", "host", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L240-L248
144,895
jackwakefield/gopac
utils.go
myIpAddress
func myIpAddress() otto.Value { hostname, err := os.Hostname() if err != nil { return otto.UndefinedValue() } address := dnsResolve(hostname) if value, err := otto.ToValue(address); err == nil { return value } return otto.UndefinedValue() }
go
func myIpAddress() otto.Value { hostname, err := os.Hostname() if err != nil { return otto.UndefinedValue() } address := dnsResolve(hostname) if value, err := otto.ToValue(address); err == nil { return value } return otto.UndefinedValue() }
[ "func", "myIpAddress", "(", ")", "otto", ".", "Value", "{", "hostname", ",", "err", ":=", "os", ".", "Hostname", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "otto", ".", "UndefinedValue", "(", ")", "\n", "}", "\n\n", "address", ":=", ...
// myIpAddress returns the IP address of the host machine.
[ "myIpAddress", "returns", "the", "IP", "address", "of", "the", "host", "machine", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L251-L265
144,896
jackwakefield/gopac
utils.go
shExpMatch
func shExpMatch(str, shexp string) bool { shexp = strings.Replace(shexp, ".", "\\.", -1) shexp = strings.Replace(shexp, "?", ".?", -1) shexp = strings.Replace(shexp, "*", ".*", -1) matched, err := regexp.MatchString("^"+shexp+"$", str) return err == nil && matched }
go
func shExpMatch(str, shexp string) bool { shexp = strings.Replace(shexp, ".", "\\.", -1) shexp = strings.Replace(shexp, "?", ".?", -1) shexp = strings.Replace(shexp, "*", ".*", -1) matched, err := regexp.MatchString("^"+shexp+"$", str) return err == nil && matched }
[ "func", "shExpMatch", "(", "str", ",", "shexp", "string", ")", "bool", "{", "shexp", "=", "strings", ".", "Replace", "(", "shexp", ",", "\"", "\"", ",", "\"", "\\\\", "\"", ",", "-", "1", ")", "\n", "shexp", "=", "strings", ".", "Replace", "(", "...
// shExpMatch returns true if the string matches the specified shell expression.
[ "shExpMatch", "returns", "true", "if", "the", "string", "matches", "the", "specified", "shell", "expression", "." ]
c4d2e0b9a672ebe23166683a72536344384b0e99
https://github.com/jackwakefield/gopac/blob/c4d2e0b9a672ebe23166683a72536344384b0e99/utils.go#L273-L280
144,897
zieckey/goini
ini.go
ParseFile
func (ini *INI) ParseFile(filename string) error { contents, err := ioutil.ReadFile(filename) if err != nil { return err } ini.parseSection = true ini.skipCommits = true return ini.parseINI(contents, DefaultLineSeparator, DefaultKeyValueSeparator) }
go
func (ini *INI) ParseFile(filename string) error { contents, err := ioutil.ReadFile(filename) if err != nil { return err } ini.parseSection = true ini.skipCommits = true return ini.parseINI(contents, DefaultLineSeparator, DefaultKeyValueSeparator) }
[ "func", "(", "ini", "*", "INI", ")", "ParseFile", "(", "filename", "string", ")", "error", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "i...
// ParseFile reads the INI file named by filename and parse the contents to store the data in the INI // A successful call returns err == nil
[ "ParseFile", "reads", "the", "INI", "file", "named", "by", "filename", "and", "parse", "the", "contents", "to", "store", "the", "data", "in", "the", "INI", "A", "successful", "call", "returns", "err", "==", "nil" ]
0da17d361d262d81977b926fcd55f34d2f8deed0
https://github.com/zieckey/goini/blob/0da17d361d262d81977b926fcd55f34d2f8deed0/ini.go#L51-L59
144,898
zieckey/goini
ini.go
Parse
func (ini *INI) Parse(data []byte, lineSep, kvSep string) error { return ini.parseINI(data, lineSep, kvSep) }
go
func (ini *INI) Parse(data []byte, lineSep, kvSep string) error { return ini.parseINI(data, lineSep, kvSep) }
[ "func", "(", "ini", "*", "INI", ")", "Parse", "(", "data", "[", "]", "byte", ",", "lineSep", ",", "kvSep", "string", ")", "error", "{", "return", "ini", ".", "parseINI", "(", "data", ",", "lineSep", ",", "kvSep", ")", "\n", "}" ]
// Parse parses the data to store the data in the INI // A successful call returns err == nil
[ "Parse", "parses", "the", "data", "to", "store", "the", "data", "in", "the", "INI", "A", "successful", "call", "returns", "err", "==", "nil" ]
0da17d361d262d81977b926fcd55f34d2f8deed0
https://github.com/zieckey/goini/blob/0da17d361d262d81977b926fcd55f34d2f8deed0/ini.go#L63-L65
144,899
zieckey/goini
ini.go
ParseFrom
func (ini *INI) ParseFrom(r io.Reader, lineSep, kvSep string) error { data, err := ioutil.ReadAll(r) if err == nil { return ini.parseINI(data, lineSep, kvSep) } return err }
go
func (ini *INI) ParseFrom(r io.Reader, lineSep, kvSep string) error { data, err := ioutil.ReadAll(r) if err == nil { return ini.parseINI(data, lineSep, kvSep) } return err }
[ "func", "(", "ini", "*", "INI", ")", "ParseFrom", "(", "r", "io", ".", "Reader", ",", "lineSep", ",", "kvSep", "string", ")", "error", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ")", "\n", "if", "err", "==", "nil", "{", ...
// ParseFrom reads all the data from reader r and parse the contents to store the data in the INI // A successful call returns err == nil
[ "ParseFrom", "reads", "all", "the", "data", "from", "reader", "r", "and", "parse", "the", "contents", "to", "store", "the", "data", "in", "the", "INI", "A", "successful", "call", "returns", "err", "==", "nil" ]
0da17d361d262d81977b926fcd55f34d2f8deed0
https://github.com/zieckey/goini/blob/0da17d361d262d81977b926fcd55f34d2f8deed0/ini.go#L69-L75