id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
137,300
FactomProject/factom
get.go
GetAllEBlockEntries
func GetAllEBlockEntries(keymr string) ([]*Entry, error) { es := make([]*Entry, 0) eb, err := GetEBlock(keymr) if err != nil { return es, err } for _, v := range eb.EntryList { e, err := GetEntry(v.EntryHash) if err != nil { return es, err } es = append(es, e) } return es, nil }
go
func GetAllEBlockEntries(keymr string) ([]*Entry, error) { es := make([]*Entry, 0) eb, err := GetEBlock(keymr) if err != nil { return es, err } for _, v := range eb.EntryList { e, err := GetEntry(v.EntryHash) if err != nil { return es, err } es = append(es, e) } return es, nil }
[ "func", "GetAllEBlockEntries", "(", "keymr", "string", ")", "(", "[", "]", "*", "Entry", ",", "error", ")", "{", "es", ":=", "make", "(", "[", "]", "*", "Entry", ",", "0", ")", "\n\n", "eb", ",", "err", ":=", "GetEBlock", "(", "keymr", ")", "\n",...
// GetAllEBlockEntries requests every Entry in a specific Entry Block
[ "GetAllEBlockEntries", "requests", "every", "Entry", "in", "a", "specific", "Entry", "Block" ]
fc1c06ae7272973dd767b473b384c6221e74c7d7
https://github.com/FactomProject/factom/blob/fc1c06ae7272973dd767b473b384c6221e74c7d7/get.go#L243-L260
137,301
FactomProject/factom
get.go
GetEBlock
func GetEBlock(keymr string) (*EBlock, error) { params := keyMRRequest{KeyMR: keymr} req := NewJSON2Request("entry-block", APICounter(), params) resp, err := factomdRequest(req) if err != nil { return nil, err } if resp.Error != nil { return nil, resp.Error } eb := new(EBlock) if err := json.Unmarshal(res...
go
func GetEBlock(keymr string) (*EBlock, error) { params := keyMRRequest{KeyMR: keymr} req := NewJSON2Request("entry-block", APICounter(), params) resp, err := factomdRequest(req) if err != nil { return nil, err } if resp.Error != nil { return nil, resp.Error } eb := new(EBlock) if err := json.Unmarshal(res...
[ "func", "GetEBlock", "(", "keymr", "string", ")", "(", "*", "EBlock", ",", "error", ")", "{", "params", ":=", "keyMRRequest", "{", "KeyMR", ":", "keymr", "}", "\n", "req", ":=", "NewJSON2Request", "(", "\"", "\"", ",", "APICounter", "(", ")", ",", "p...
// GetEBlock requests an Entry Block from factomd by its Key Merkle Root
[ "GetEBlock", "requests", "an", "Entry", "Block", "from", "factomd", "by", "its", "Key", "Merkle", "Root" ]
fc1c06ae7272973dd767b473b384c6221e74c7d7
https://github.com/FactomProject/factom/blob/fc1c06ae7272973dd767b473b384c6221e74c7d7/get.go#L263-L280
137,302
FactomProject/factom
wallet/wsapi/errors.go
handleV2Error
func handleV2Error(ctx *web.Context, j *factom.JSON2Request, err *factom.JSONError) { resp := factom.NewJSON2Response() if j != nil { resp.ID = j.ID } else { resp.ID = nil } resp.Error = err ctx.WriteHeader(httpBad) ctx.Write([]byte(resp.String())) }
go
func handleV2Error(ctx *web.Context, j *factom.JSON2Request, err *factom.JSONError) { resp := factom.NewJSON2Response() if j != nil { resp.ID = j.ID } else { resp.ID = nil } resp.Error = err ctx.WriteHeader(httpBad) ctx.Write([]byte(resp.String())) }
[ "func", "handleV2Error", "(", "ctx", "*", "web", ".", "Context", ",", "j", "*", "factom", ".", "JSON2Request", ",", "err", "*", "factom", ".", "JSONError", ")", "{", "resp", ":=", "factom", ".", "NewJSON2Response", "(", ")", "\n", "if", "j", "!=", "n...
// handleV2Error handles the error responses to RPC calls
[ "handleV2Error", "handles", "the", "error", "responses", "to", "RPC", "calls" ]
fc1c06ae7272973dd767b473b384c6221e74c7d7
https://github.com/FactomProject/factom/blob/fc1c06ae7272973dd767b473b384c6221e74c7d7/wallet/wsapi/errors.go#L15-L26
137,303
FactomProject/factom
wallet/v1conversion.go
ImportV1Wallet
func ImportV1Wallet(v1path, v2path string) (*Wallet, error) { w, err := NewOrOpenBoltDBWallet(v2path) if err != nil { return nil, err } fstate := stateinit.NewFactoidState(v1path) _, values := fstate.GetDB().GetKeysValues([]byte(factoid.W_NAME)) for _, v := range values { we, ok := v.(wallet.IWalletEntry) ...
go
func ImportV1Wallet(v1path, v2path string) (*Wallet, error) { w, err := NewOrOpenBoltDBWallet(v2path) if err != nil { return nil, err } fstate := stateinit.NewFactoidState(v1path) _, values := fstate.GetDB().GetKeysValues([]byte(factoid.W_NAME)) for _, v := range values { we, ok := v.(wallet.IWalletEntry) ...
[ "func", "ImportV1Wallet", "(", "v1path", ",", "v2path", "string", ")", "(", "*", "Wallet", ",", "error", ")", "{", "w", ",", "err", ":=", "NewOrOpenBoltDBWallet", "(", "v2path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "...
// This file is a dirty hack to to get the keys out of a version 1 wallet. // ImportV1Wallet takes a version 1 wallet bolt.db file and imports all of its // addresses into a factom wallet.
[ "This", "file", "is", "a", "dirty", "hack", "to", "to", "get", "the", "keys", "out", "of", "a", "version", "1", "wallet", ".", "ImportV1Wallet", "takes", "a", "version", "1", "wallet", "bolt", ".", "db", "file", "and", "imports", "all", "of", "its", ...
fc1c06ae7272973dd767b473b384c6221e74c7d7
https://github.com/FactomProject/factom/blob/fc1c06ae7272973dd767b473b384c6221e74c7d7/wallet/v1conversion.go#L20-L62
137,304
FactomProject/factom
wallet.go
BackupWallet
func BackupWallet() (string, error) { type walletBackupResponse struct { Seed string `json:"wallet-seed"` Addresses []*addressResponse `json:"addresses"` IdentityKeys []*addressResponse `json:"identity-keys"` } req := NewJSON2Request("wallet-backup", APICounter(), nil) resp, err := wal...
go
func BackupWallet() (string, error) { type walletBackupResponse struct { Seed string `json:"wallet-seed"` Addresses []*addressResponse `json:"addresses"` IdentityKeys []*addressResponse `json:"identity-keys"` } req := NewJSON2Request("wallet-backup", APICounter(), nil) resp, err := wal...
[ "func", "BackupWallet", "(", ")", "(", "string", ",", "error", ")", "{", "type", "walletBackupResponse", "struct", "{", "Seed", "string", "`json:\"wallet-seed\"`", "\n", "Addresses", "[", "]", "*", "addressResponse", "`json:\"addresses\"`", "\n", "IdentityKeys", "...
// BackupWallet returns a formatted string with the wallet seed and the secret // keys for all of the wallet addresses.
[ "BackupWallet", "returns", "a", "formatted", "string", "with", "the", "wallet", "seed", "and", "the", "secret", "keys", "for", "all", "of", "the", "wallet", "addresses", "." ]
fc1c06ae7272973dd767b473b384c6221e74c7d7
https://github.com/FactomProject/factom/blob/fc1c06ae7272973dd767b473b384c6221e74c7d7/wallet.go#L14-L48
137,305
raff/goble
goble.go
sendCBMsg
func (ble *BLE) sendCBMsg(id int, args xpc.Dict) { message := xpc.Dict{"kCBMsgId": id, "kCBMsgArgs": args} if ble.verbose { log.Printf("sendCBMsg %#v\n", message) } ble.conn.Send(xpc.Dict{"kCBMsgId": id, "kCBMsgArgs": args}, ble.verbose) }
go
func (ble *BLE) sendCBMsg(id int, args xpc.Dict) { message := xpc.Dict{"kCBMsgId": id, "kCBMsgArgs": args} if ble.verbose { log.Printf("sendCBMsg %#v\n", message) } ble.conn.Send(xpc.Dict{"kCBMsgId": id, "kCBMsgArgs": args}, ble.verbose) }
[ "func", "(", "ble", "*", "BLE", ")", "sendCBMsg", "(", "id", "int", ",", "args", "xpc", ".", "Dict", ")", "{", "message", ":=", "xpc", ".", "Dict", "{", "\"", "\"", ":", "id", ",", "\"", "\"", ":", "args", "}", "\n", "if", "ble", ".", "verbos...
// send a message to Blued
[ "send", "a", "message", "to", "Blued" ]
5a206277e7359d09af80eb4519b8fa331f5ac7da
https://github.com/raff/goble/blob/5a206277e7359d09af80eb4519b8fa331f5ac7da/goble.go#L454-L461
137,306
raff/goble
goble.go
StartAdvertisingIBeacon
func (ble *BLE) StartAdvertisingIBeacon(uuid xpc.UUID, major, minor uint16, measuredPower int8) { var buf bytes.Buffer binary.Write(&buf, binary.BigEndian, uuid[:]) binary.Write(&buf, binary.BigEndian, major) binary.Write(&buf, binary.BigEndian, minor) binary.Write(&buf, binary.BigEndian, measuredPower) ble.Star...
go
func (ble *BLE) StartAdvertisingIBeacon(uuid xpc.UUID, major, minor uint16, measuredPower int8) { var buf bytes.Buffer binary.Write(&buf, binary.BigEndian, uuid[:]) binary.Write(&buf, binary.BigEndian, major) binary.Write(&buf, binary.BigEndian, minor) binary.Write(&buf, binary.BigEndian, measuredPower) ble.Star...
[ "func", "(", "ble", "*", "BLE", ")", "StartAdvertisingIBeacon", "(", "uuid", "xpc", ".", "UUID", ",", "major", ",", "minor", "uint16", ",", "measuredPower", "int8", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "binary", ".", "Write", "(", "&",...
// start advertising as IBeacon
[ "start", "advertising", "as", "IBeacon" ]
5a206277e7359d09af80eb4519b8fa331f5ac7da
https://github.com/raff/goble/blob/5a206277e7359d09af80eb4519b8fa331f5ac7da/goble.go#L491-L499
137,307
raff/goble
xpc/xpc.go
valueToXpc
func valueToXpc(val r.Value) C.xpc_object_t { if !val.IsValid() { return nil } var xv C.xpc_object_t switch val.Kind() { case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: xv = C.xpc_int64_create(C.int64_t(val.Int())) case r.Uint, r.Uint8, r.Uint16, r.Uint32: xv = C.xpc_int64_create(C.int64_t(val.Uint())) ...
go
func valueToXpc(val r.Value) C.xpc_object_t { if !val.IsValid() { return nil } var xv C.xpc_object_t switch val.Kind() { case r.Int, r.Int8, r.Int16, r.Int32, r.Int64: xv = C.xpc_int64_create(C.int64_t(val.Int())) case r.Uint, r.Uint8, r.Uint16, r.Uint32: xv = C.xpc_int64_create(C.int64_t(val.Uint())) ...
[ "func", "valueToXpc", "(", "val", "r", ".", "Value", ")", "C", ".", "xpc_object_t", "{", "if", "!", "val", ".", "IsValid", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "var", "xv", "C", ".", "xpc_object_t", "\n\n", "switch", "val", ".", "Kind...
// valueToXpc converts a go Value to an xpc object // // note that not all the types are supported, but only the subset required for Blued
[ "valueToXpc", "converts", "a", "go", "Value", "to", "an", "xpc", "object", "note", "that", "not", "all", "the", "types", "are", "supported", "but", "only", "the", "subset", "required", "for", "Blued" ]
5a206277e7359d09af80eb4519b8fa331f5ac7da
https://github.com/raff/goble/blob/5a206277e7359d09af80eb4519b8fa331f5ac7da/xpc/xpc.go#L240-L297
137,308
raff/goble
emitter.go
Init
func (e *Emitter) Init() { e.handlers = make(map[string]EventHandlerFunc) e.event = make(chan Event) // event handler go func() { for { ev := <-e.event if fn, ok := e.handlers[ev.Name]; ok { if fn(ev) { break } } else if fn, ok := e.handlers[ALL]; ok { if fn(ev) { break } }...
go
func (e *Emitter) Init() { e.handlers = make(map[string]EventHandlerFunc) e.event = make(chan Event) // event handler go func() { for { ev := <-e.event if fn, ok := e.handlers[ev.Name]; ok { if fn(ev) { break } } else if fn, ok := e.handlers[ALL]; ok { if fn(ev) { break } }...
[ "func", "(", "e", "*", "Emitter", ")", "Init", "(", ")", "{", "e", ".", "handlers", "=", "make", "(", "map", "[", "string", "]", "EventHandlerFunc", ")", "\n", "e", ".", "event", "=", "make", "(", "chan", "Event", ")", "\n\n", "// event handler", "...
// Init initialize the emitter and start a goroutine to execute the event handlers
[ "Init", "initialize", "the", "emitter", "and", "start", "a", "goroutine", "to", "execute", "the", "event", "handlers" ]
5a206277e7359d09af80eb4519b8fa331f5ac7da
https://github.com/raff/goble/blob/5a206277e7359d09af80eb4519b8fa331f5ac7da/emitter.go#L38-L64
137,309
bitrise-io/go-utils
fileutil/fileutil.go
GetFileModeOfFile
func GetFileModeOfFile(pth string) (os.FileMode, error) { finfo, err := os.Lstat(pth) if err != nil { return 0, err } return finfo.Mode(), nil }
go
func GetFileModeOfFile(pth string) (os.FileMode, error) { finfo, err := os.Lstat(pth) if err != nil { return 0, err } return finfo.Mode(), nil }
[ "func", "GetFileModeOfFile", "(", "pth", "string", ")", "(", "os", ".", "FileMode", ",", "error", ")", "{", "finfo", ",", "err", ":=", "os", ".", "Lstat", "(", "pth", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}",...
// GetFileModeOfFile ... // this is the "permissions" info, which can be passed directly to // functions like WriteBytesToFileWithPermission or os.OpenFile
[ "GetFileModeOfFile", "...", "this", "is", "the", "permissions", "info", "which", "can", "be", "passed", "directly", "to", "functions", "like", "WriteBytesToFileWithPermission", "or", "os", ".", "OpenFile" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/fileutil/fileutil.go#L124-L130
137,310
bitrise-io/go-utils
stringutil/stringutil.go
MaxLastChars
func MaxLastChars(inStr string, maxCharCount int) string { return genericTrim(inStr, maxCharCount, true, false) }
go
func MaxLastChars(inStr string, maxCharCount int) string { return genericTrim(inStr, maxCharCount, true, false) }
[ "func", "MaxLastChars", "(", "inStr", "string", ",", "maxCharCount", "int", ")", "string", "{", "return", "genericTrim", "(", "inStr", ",", "maxCharCount", ",", "true", ",", "false", ")", "\n", "}" ]
// MaxLastChars returns the last maxCharCount characters, // or in case maxCharCount is more than or equal to the string's length // it'll just return the whole string.
[ "MaxLastChars", "returns", "the", "last", "maxCharCount", "characters", "or", "in", "case", "maxCharCount", "is", "more", "than", "or", "equal", "to", "the", "string", "s", "length", "it", "ll", "just", "return", "the", "whole", "string", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/stringutil/stringutil.go#L37-L39
137,311
bitrise-io/go-utils
pkcs12/pkcs12.go
ToPEM
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) { encodedPassword, err := bmpString(password) if err != nil { return nil, ErrIncorrectPassword } bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword) if err != nil { return nil, err } blocks := make([]*pem.Block, 0, len(b...
go
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) { encodedPassword, err := bmpString(password) if err != nil { return nil, ErrIncorrectPassword } bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword) if err != nil { return nil, err } blocks := make([]*pem.Block, 0, len(b...
[ "func", "ToPEM", "(", "pfxData", "[", "]", "byte", ",", "password", "string", ")", "(", "[", "]", "*", "pem", ".", "Block", ",", "error", ")", "{", "encodedPassword", ",", "err", ":=", "bmpString", "(", "password", ")", "\n", "if", "err", "!=", "ni...
// ConvertToPEM converts all "safe bags" contained in pfxData to PEM blocks.
[ "ConvertToPEM", "converts", "all", "safe", "bags", "contained", "in", "pfxData", "to", "PEM", "blocks", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/pkcs12/pkcs12.go#L104-L126
137,312
bitrise-io/go-utils
pkcs12/pkcs12.go
DecodeAllCerts
func DecodeAllCerts(pfxData []byte, password string) (certificates []*x509.Certificate, err error) { encodedPassword, err := bmpString(password) if err != nil { return nil, err } bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword) if err != nil { return nil, err } certificates = []*x509...
go
func DecodeAllCerts(pfxData []byte, password string) (certificates []*x509.Certificate, err error) { encodedPassword, err := bmpString(password) if err != nil { return nil, err } bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword) if err != nil { return nil, err } certificates = []*x509...
[ "func", "DecodeAllCerts", "(", "pfxData", "[", "]", "byte", ",", "password", "string", ")", "(", "certificates", "[", "]", "*", "x509", ".", "Certificate", ",", "err", "error", ")", "{", "encodedPassword", ",", "err", ":=", "bmpString", "(", "password", ...
// DecodeAllCerts extracts a certificates from pfxData.
[ "DecodeAllCerts", "extracts", "a", "certificates", "from", "pfxData", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/pkcs12/pkcs12.go#L271-L307
137,313
bitrise-io/go-utils
sliceutil/sliceutil.go
UniqueStringSlice
func UniqueStringSlice(strs []string) []string { lookupMap := map[string]interface{}{} for _, aStr := range strs { lookupMap[aStr] = 1 } uniqueStrs := []string{} for k := range lookupMap { uniqueStrs = append(uniqueStrs, k) } return uniqueStrs }
go
func UniqueStringSlice(strs []string) []string { lookupMap := map[string]interface{}{} for _, aStr := range strs { lookupMap[aStr] = 1 } uniqueStrs := []string{} for k := range lookupMap { uniqueStrs = append(uniqueStrs, k) } return uniqueStrs }
[ "func", "UniqueStringSlice", "(", "strs", "[", "]", "string", ")", "[", "]", "string", "{", "lookupMap", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "for", "_", ",", "aStr", ":=", "range", "strs", "{", "lookupMap", "[", ...
// UniqueStringSlice - returns a cleaned up list, // where every item is unique. // Does NOT guarantee any ordering, the result can // be in any order!
[ "UniqueStringSlice", "-", "returns", "a", "cleaned", "up", "list", "where", "every", "item", "is", "unique", ".", "Does", "NOT", "guarantee", "any", "ordering", "the", "result", "can", "be", "in", "any", "order!" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/sliceutil/sliceutil.go#L7-L17
137,314
bitrise-io/go-utils
command/git/git.go
New
func New(dir string) (Git, error) { if err := os.MkdirAll(dir, 0755); err != nil { return Git{}, err } return Git{dir: dir}, nil }
go
func New(dir string) (Git, error) { if err := os.MkdirAll(dir, 0755); err != nil { return Git{}, err } return Git{dir: dir}, nil }
[ "func", "New", "(", "dir", "string", ")", "(", "Git", ",", "error", ")", "{", "if", "err", ":=", "os", ".", "MkdirAll", "(", "dir", ",", "0755", ")", ";", "err", "!=", "nil", "{", "return", "Git", "{", "}", ",", "err", "\n", "}", "\n", "retur...
// New creates a new git project.
[ "New", "creates", "a", "new", "git", "project", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/git.go#L15-L20
137,315
bitrise-io/go-utils
pathutil/pathutil.go
AbsPath
func AbsPath(pth string) (string, error) { if pth == "" { return "", errors.New("No Path provided") } pth, err := ExpandTilde(pth) if err != nil { return "", err } return filepath.Abs(os.ExpandEnv(pth)) }
go
func AbsPath(pth string) (string, error) { if pth == "" { return "", errors.New("No Path provided") } pth, err := ExpandTilde(pth) if err != nil { return "", err } return filepath.Abs(os.ExpandEnv(pth)) }
[ "func", "AbsPath", "(", "pth", "string", ")", "(", "string", ",", "error", ")", "{", "if", "pth", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "pth", ",", "err", ":=", "ExpandT...
// AbsPath expands ENV vars and the ~ character // then call Go's Abs
[ "AbsPath", "expands", "ENV", "vars", "and", "the", "~", "character", "then", "call", "Go", "s", "Abs" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/pathutil/pathutil.go#L111-L122
137,316
bitrise-io/go-utils
command/git/commands.go
Clone
func (g *Git) Clone(repo string) *command.Model { return g.command("clone", repo, ".") }
go
func (g *Git) Clone(repo string) *command.Model { return g.command("clone", repo, ".") }
[ "func", "(", "g", "*", "Git", ")", "Clone", "(", "repo", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "repo", ",", "\"", "\"", ")", "\n", "}" ]
// Clone a repository into a new directory.
[ "Clone", "a", "repository", "into", "a", "new", "directory", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L13-L15
137,317
bitrise-io/go-utils
command/git/commands.go
CloneTagOrBranch
func (g *Git) CloneTagOrBranch(repo, tagOrBranch string) *command.Model { return g.command("clone", "--recursive", "--branch", tagOrBranch, repo, ".") }
go
func (g *Git) CloneTagOrBranch(repo, tagOrBranch string) *command.Model { return g.command("clone", "--recursive", "--branch", tagOrBranch, repo, ".") }
[ "func", "(", "g", "*", "Git", ")", "CloneTagOrBranch", "(", "repo", ",", "tagOrBranch", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "tagOrBranch", ",", "re...
// CloneTagOrBranch is recursively clones a tag or branch.
[ "CloneTagOrBranch", "is", "recursively", "clones", "a", "tag", "or", "branch", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L18-L20
137,318
bitrise-io/go-utils
command/git/commands.go
Fetch
func (g *Git) Fetch(opts ...string) *command.Model { args := []string{"fetch"} args = append(args, opts...) return g.command(args...) }
go
func (g *Git) Fetch(opts ...string) *command.Model { args := []string{"fetch"} args = append(args, opts...) return g.command(args...) }
[ "func", "(", "g", "*", "Git", ")", "Fetch", "(", "opts", "...", "string", ")", "*", "command", ".", "Model", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "args", "=", "append", "(", "args", ",", "opts", "...", ")", "\n", ...
// Fetch downloads objects and refs from another repository.
[ "Fetch", "downloads", "objects", "and", "refs", "from", "another", "repository", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L33-L37
137,319
bitrise-io/go-utils
command/git/commands.go
Checkout
func (g *Git) Checkout(arg string) *command.Model { return g.command("checkout", arg) }
go
func (g *Git) Checkout(arg string) *command.Model { return g.command("checkout", arg) }
[ "func", "(", "g", "*", "Git", ")", "Checkout", "(", "arg", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "arg", ")", "\n", "}" ]
// Checkout switchs branches or restore working tree files. // Arg can be a commit hash, a branch or a tag.
[ "Checkout", "switchs", "branches", "or", "restore", "working", "tree", "files", ".", "Arg", "can", "be", "a", "commit", "hash", "a", "branch", "or", "a", "tag", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L41-L43
137,320
bitrise-io/go-utils
command/git/commands.go
Merge
func (g *Git) Merge(arg string) *command.Model { return g.command("merge", arg) }
go
func (g *Git) Merge(arg string) *command.Model { return g.command("merge", arg) }
[ "func", "(", "g", "*", "Git", ")", "Merge", "(", "arg", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "arg", ")", "\n", "}" ]
// Merge joins two or more development histories together. // Arg can be a commit hash, branch or tag.
[ "Merge", "joins", "two", "or", "more", "development", "histories", "together", ".", "Arg", "can", "be", "a", "commit", "hash", "branch", "or", "tag", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L47-L49
137,321
bitrise-io/go-utils
command/git/commands.go
Clean
func (g *Git) Clean(options ...string) *command.Model { args := []string{"clean"} args = append(args, options...) return g.command(args...) }
go
func (g *Git) Clean(options ...string) *command.Model { args := []string{"clean"} args = append(args, options...) return g.command(args...) }
[ "func", "(", "g", "*", "Git", ")", "Clean", "(", "options", "...", "string", ")", "*", "command", ".", "Model", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", "}", "\n", "args", "=", "append", "(", "args", ",", "options", "...", ")", "...
// Clean removes untracked files from the working tree.
[ "Clean", "removes", "untracked", "files", "from", "the", "working", "tree", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L58-L62
137,322
bitrise-io/go-utils
command/git/commands.go
SubmoduleForeach
func (g *Git) SubmoduleForeach(command *command.Model) *command.Model { args := []string{"submodule", "foreach"} args = append(args, command.GetCmd().Args...) return g.command(args...) }
go
func (g *Git) SubmoduleForeach(command *command.Model) *command.Model { args := []string{"submodule", "foreach"} args = append(args, command.GetCmd().Args...) return g.command(args...) }
[ "func", "(", "g", "*", "Git", ")", "SubmoduleForeach", "(", "command", "*", "command", ".", "Model", ")", "*", "command", ".", "Model", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n", "args", "=", "append", "("...
// SubmoduleForeach evaluates an arbitrary git command in each checked out // submodule.
[ "SubmoduleForeach", "evaluates", "an", "arbitrary", "git", "command", "in", "each", "checked", "out", "submodule", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L71-L75
137,323
bitrise-io/go-utils
command/git/commands.go
NewBranch
func (g *Git) NewBranch(branch string) *command.Model { return g.command("checkout", "-b", branch) }
go
func (g *Git) NewBranch(branch string) *command.Model { return g.command("checkout", "-b", branch) }
[ "func", "(", "g", "*", "Git", ")", "NewBranch", "(", "branch", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "\"", "\"", ",", "branch", ")", "\n", "}" ]
// NewBranch creates a new branch as if git-branch were called and then check it out.
[ "NewBranch", "creates", "a", "new", "branch", "as", "if", "git", "-", "branch", "were", "called", "and", "then", "check", "it", "out", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L94-L96
137,324
bitrise-io/go-utils
command/git/commands.go
Log
func (g *Git) Log(format string) *command.Model { return g.command("log", "-1", "--format="+format) }
go
func (g *Git) Log(format string) *command.Model { return g.command("log", "-1", "--format="+format) }
[ "func", "(", "g", "*", "Git", ")", "Log", "(", "format", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "+", "format", ")", "\n", "}" ]
// Log shows the commit logs. The format parameter controls what is shown and how.
[ "Log", "shows", "the", "commit", "logs", ".", "The", "format", "parameter", "controls", "what", "is", "shown", "and", "how", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L104-L106
137,325
bitrise-io/go-utils
command/git/commands.go
RevList
func (g *Git) RevList(commit string, opts ...string) *command.Model { args := []string{"rev-list", commit} args = append(args, opts...) return g.command(args...) }
go
func (g *Git) RevList(commit string, opts ...string) *command.Model { args := []string{"rev-list", commit} args = append(args, opts...) return g.command(args...) }
[ "func", "(", "g", "*", "Git", ")", "RevList", "(", "commit", "string", ",", "opts", "...", "string", ")", "*", "command", ".", "Model", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "commit", "}", "\n", "args", "=", "append", "(", ...
// RevList lists commit objects in reverse chronological order.
[ "RevList", "lists", "commit", "objects", "in", "reverse", "chronological", "order", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L109-L113
137,326
bitrise-io/go-utils
command/git/commands.go
Push
func (g *Git) Push(branch string) *command.Model { return g.command("push", "-u", "origin", branch) }
go
func (g *Git) Push(branch string) *command.Model { return g.command("push", "-u", "origin", branch) }
[ "func", "(", "g", "*", "Git", ")", "Push", "(", "branch", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "branch", ")", "\n", "}" ]
// Push updates remote refs along with associated objects.
[ "Push", "updates", "remote", "refs", "along", "with", "associated", "objects", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L116-L118
137,327
bitrise-io/go-utils
command/git/commands.go
Commit
func (g *Git) Commit(message string) *command.Model { return g.command("commit", "-m", message) }
go
func (g *Git) Commit(message string) *command.Model { return g.command("commit", "-m", message) }
[ "func", "(", "g", "*", "Git", ")", "Commit", "(", "message", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "\"", "\"", ",", "message", ")", "\n", "}" ]
// Commit Stores the current contents of the index in a new commit along with a log message from the user describing the changes.
[ "Commit", "Stores", "the", "current", "contents", "of", "the", "index", "in", "a", "new", "commit", "along", "with", "a", "log", "message", "from", "the", "user", "describing", "the", "changes", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L121-L123
137,328
bitrise-io/go-utils
command/git/commands.go
RevParse
func (g *Git) RevParse(arg string) *command.Model { return g.command("rev-parse", arg) }
go
func (g *Git) RevParse(arg string) *command.Model { return g.command("rev-parse", arg) }
[ "func", "(", "g", "*", "Git", ")", "RevParse", "(", "arg", "string", ")", "*", "command", ".", "Model", "{", "return", "g", ".", "command", "(", "\"", "\"", ",", "arg", ")", "\n", "}" ]
// RevParse picks out and massage parameters.
[ "RevParse", "picks", "out", "and", "massage", "parameters", "." ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/command/git/commands.go#L126-L128
137,329
bitrise-io/go-utils
envutil/envutil.go
StringFlagOrEnv
func StringFlagOrEnv(flagValue *string, envKey string) string { if flagValue != nil && *flagValue != "" { return *flagValue } return os.Getenv(envKey) }
go
func StringFlagOrEnv(flagValue *string, envKey string) string { if flagValue != nil && *flagValue != "" { return *flagValue } return os.Getenv(envKey) }
[ "func", "StringFlagOrEnv", "(", "flagValue", "*", "string", ",", "envKey", "string", ")", "string", "{", "if", "flagValue", "!=", "nil", "&&", "*", "flagValue", "!=", "\"", "\"", "{", "return", "*", "flagValue", "\n", "}", "\n", "return", "os", ".", "G...
// StringFlagOrEnv - returns the value of the flag if specified, otherwise the env's value. // Empty string counts as not specified!
[ "StringFlagOrEnv", "-", "returns", "the", "value", "of", "the", "flag", "if", "specified", "otherwise", "the", "env", "s", "value", ".", "Empty", "string", "counts", "as", "not", "specified!" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/envutil/envutil.go#L29-L34
137,330
bitrise-io/go-utils
envutil/envutil.go
GetenvWithDefault
func GetenvWithDefault(envKey, defValue string) string { retVal := os.Getenv(envKey) if retVal == "" { return defValue } return retVal }
go
func GetenvWithDefault(envKey, defValue string) string { retVal := os.Getenv(envKey) if retVal == "" { return defValue } return retVal }
[ "func", "GetenvWithDefault", "(", "envKey", ",", "defValue", "string", ")", "string", "{", "retVal", ":=", "os", ".", "Getenv", "(", "envKey", ")", "\n", "if", "retVal", "==", "\"", "\"", "{", "return", "defValue", "\n", "}", "\n", "return", "retVal", ...
// GetenvWithDefault - returns the env if specified, default value otherwise
[ "GetenvWithDefault", "-", "returns", "the", "env", "if", "specified", "default", "value", "otherwise" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/envutil/envutil.go#L37-L43
137,331
bitrise-io/go-utils
maputil/maputil.go
MergeStringStringMap
func MergeStringStringMap(m1, m2 map[string]string) map[string]string { mergedMap := CloneStringStringMap(m1) for k, v := range m2 { mergedMap[k] = v } return mergedMap }
go
func MergeStringStringMap(m1, m2 map[string]string) map[string]string { mergedMap := CloneStringStringMap(m1) for k, v := range m2 { mergedMap[k] = v } return mergedMap }
[ "func", "MergeStringStringMap", "(", "m1", ",", "m2", "map", "[", "string", "]", "string", ")", "map", "[", "string", "]", "string", "{", "mergedMap", ":=", "CloneStringStringMap", "(", "m1", ")", "\n", "for", "k", ",", "v", ":=", "range", "m2", "{", ...
// MergeStringStringMap - returns a new map object, // DOES NOT modify either input map
[ "MergeStringStringMap", "-", "returns", "a", "new", "map", "object", "DOES", "NOT", "modify", "either", "input", "map" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/maputil/maputil.go#L40-L46
137,332
bitrise-io/go-utils
versions/versions.go
IsVersionBetween
func IsVersionBetween(verBase, verLower, verUpper string) (bool, error) { r1, err := CompareVersions(verBase, verLower) if err != nil { return false, err } if r1 == 1 { return false, nil } r2, err := CompareVersions(verBase, verUpper) if err != nil { return false, err } if r2 == -1 { return false, nil...
go
func IsVersionBetween(verBase, verLower, verUpper string) (bool, error) { r1, err := CompareVersions(verBase, verLower) if err != nil { return false, err } if r1 == 1 { return false, nil } r2, err := CompareVersions(verBase, verUpper) if err != nil { return false, err } if r2 == -1 { return false, nil...
[ "func", "IsVersionBetween", "(", "verBase", ",", "verLower", ",", "verUpper", "string", ")", "(", "bool", ",", "error", ")", "{", "r1", ",", "err", ":=", "CompareVersions", "(", "verBase", ",", "verLower", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// IsVersionBetween ... // returns true if it's between the lower and upper limit // or in case it matches the lower or the upper limit
[ "IsVersionBetween", "...", "returns", "true", "if", "it", "s", "between", "the", "lower", "and", "upper", "limit", "or", "in", "case", "it", "matches", "the", "lower", "or", "the", "upper", "limit" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/versions/versions.go#L68-L86
137,333
bitrise-io/go-utils
versions/versions.go
IsVersionGreaterOrEqual
func IsVersionGreaterOrEqual(verBase, verLower string) (bool, error) { r1, err := CompareVersions(verBase, verLower) if err != nil { return false, err } if r1 == 1 { return false, nil } return true, nil }
go
func IsVersionGreaterOrEqual(verBase, verLower string) (bool, error) { r1, err := CompareVersions(verBase, verLower) if err != nil { return false, err } if r1 == 1 { return false, nil } return true, nil }
[ "func", "IsVersionGreaterOrEqual", "(", "verBase", ",", "verLower", "string", ")", "(", "bool", ",", "error", ")", "{", "r1", ",", "err", ":=", "CompareVersions", "(", "verBase", ",", "verLower", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false...
// IsVersionGreaterOrEqual ... // returns true if verBase is greater or equal to verLower
[ "IsVersionGreaterOrEqual", "...", "returns", "true", "if", "verBase", "is", "greater", "or", "equal", "to", "verLower" ]
2a09aab8380d7842750328aebd5671bcccea89c8
https://github.com/bitrise-io/go-utils/blob/2a09aab8380d7842750328aebd5671bcccea89c8/versions/versions.go#L90-L100
137,334
danieljoos/wincred
conversion.go
utf16PtrToString
func utf16PtrToString(wstr *uint16) string { if wstr != nil { for len := 0; ; len++ { ptr := unsafe.Pointer(uintptr(unsafe.Pointer(wstr)) + uintptr(len)*unsafe.Sizeof(*wstr)) // see https://golang.org/pkg/unsafe/#Pointer (3) if *(*uint16)(ptr) == 0 { return string(utf16.Decode(*(*[]uint16)(unsafe.Pointer(&...
go
func utf16PtrToString(wstr *uint16) string { if wstr != nil { for len := 0; ; len++ { ptr := unsafe.Pointer(uintptr(unsafe.Pointer(wstr)) + uintptr(len)*unsafe.Sizeof(*wstr)) // see https://golang.org/pkg/unsafe/#Pointer (3) if *(*uint16)(ptr) == 0 { return string(utf16.Decode(*(*[]uint16)(unsafe.Pointer(&...
[ "func", "utf16PtrToString", "(", "wstr", "*", "uint16", ")", "string", "{", "if", "wstr", "!=", "nil", "{", "for", "len", ":=", "0", ";", ";", "len", "++", "{", "ptr", ":=", "unsafe", ".", "Pointer", "(", "uintptr", "(", "unsafe", ".", "Pointer", "...
// uf16PtrToString creates a Go string from a pointer to a UTF16 encoded zero-terminated string. // Such pointers are returned from the Windows API calls. // The function creates a copy of the string.
[ "uf16PtrToString", "creates", "a", "Go", "string", "from", "a", "pointer", "to", "a", "UTF16", "encoded", "zero", "-", "terminated", "string", ".", "Such", "pointers", "are", "returned", "from", "the", "Windows", "API", "calls", ".", "The", "function", "crea...
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/conversion.go#L17-L31
137,335
danieljoos/wincred
conversion.go
utf16ToByte
func utf16ToByte(wstr []uint16) (result []byte) { result = make([]byte, len(wstr)*2) for i := range wstr { binary.LittleEndian.PutUint16(result[(i*2):(i*2)+2], wstr[i]) } return }
go
func utf16ToByte(wstr []uint16) (result []byte) { result = make([]byte, len(wstr)*2) for i := range wstr { binary.LittleEndian.PutUint16(result[(i*2):(i*2)+2], wstr[i]) } return }
[ "func", "utf16ToByte", "(", "wstr", "[", "]", "uint16", ")", "(", "result", "[", "]", "byte", ")", "{", "result", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "wstr", ")", "*", "2", ")", "\n", "for", "i", ":=", "range", "wstr", "{", "...
// utf16ToByte creates a byte array from a given UTF 16 char array.
[ "utf16ToByte", "creates", "a", "byte", "array", "from", "a", "given", "UTF", "16", "char", "array", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/conversion.go#L34-L40
137,336
danieljoos/wincred
conversion.go
sysToCredential
func sysToCredential(cred *sysCREDENTIAL) (result *Credential) { if cred == nil { return nil } result = new(Credential) result.Comment = utf16PtrToString(cred.Comment) result.TargetName = utf16PtrToString(cred.TargetName) result.TargetAlias = utf16PtrToString(cred.TargetAlias) result.UserName = utf16PtrToStrin...
go
func sysToCredential(cred *sysCREDENTIAL) (result *Credential) { if cred == nil { return nil } result = new(Credential) result.Comment = utf16PtrToString(cred.Comment) result.TargetName = utf16PtrToString(cred.TargetName) result.TargetAlias = utf16PtrToString(cred.TargetAlias) result.UserName = utf16PtrToStrin...
[ "func", "sysToCredential", "(", "cred", "*", "sysCREDENTIAL", ")", "(", "result", "*", "Credential", ")", "{", "if", "cred", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "result", "=", "new", "(", "Credential", ")", "\n", "result", ".", "Comment...
// Convert the given CREDENTIAL struct to a more usable structure
[ "Convert", "the", "given", "CREDENTIAL", "struct", "to", "a", "more", "usable", "structure" ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/conversion.go#L63-L87
137,337
danieljoos/wincred
conversion.go
sysFromCredential
func sysFromCredential(cred *Credential) (result *sysCREDENTIAL) { if cred == nil { return nil } result = new(sysCREDENTIAL) result.Flags = 0 result.Type = 0 result.TargetName, _ = syscall.UTF16PtrFromString(cred.TargetName) result.Comment, _ = syscall.UTF16PtrFromString(cred.Comment) result.LastWritten = sys...
go
func sysFromCredential(cred *Credential) (result *sysCREDENTIAL) { if cred == nil { return nil } result = new(sysCREDENTIAL) result.Flags = 0 result.Type = 0 result.TargetName, _ = syscall.UTF16PtrFromString(cred.TargetName) result.Comment, _ = syscall.UTF16PtrFromString(cred.Comment) result.LastWritten = sys...
[ "func", "sysFromCredential", "(", "cred", "*", "Credential", ")", "(", "result", "*", "sysCREDENTIAL", ")", "{", "if", "cred", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "result", "=", "new", "(", "sysCREDENTIAL", ")", "\n", "result", ".", "Fl...
// Convert the given Credential object back to a CREDENTIAL struct, which can be used for calling the // Windows APIs
[ "Convert", "the", "given", "Credential", "object", "back", "to", "a", "CREDENTIAL", "struct", "which", "can", "be", "used", "for", "calling", "the", "Windows", "APIs" ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/conversion.go#L91-L131
137,338
danieljoos/wincred
wincred.go
GetGenericCredential
func GetGenericCredential(targetName string) (*GenericCredential, error) { cred, err := sysCredRead(targetName, sysCRED_TYPE_GENERIC) if cred != nil { return &GenericCredential{*cred}, err } return nil, err }
go
func GetGenericCredential(targetName string) (*GenericCredential, error) { cred, err := sysCredRead(targetName, sysCRED_TYPE_GENERIC) if cred != nil { return &GenericCredential{*cred}, err } return nil, err }
[ "func", "GetGenericCredential", "(", "targetName", "string", ")", "(", "*", "GenericCredential", ",", "error", ")", "{", "cred", ",", "err", ":=", "sysCredRead", "(", "targetName", ",", "sysCRED_TYPE_GENERIC", ")", "\n", "if", "cred", "!=", "nil", "{", "retu...
// GetGenericCredential fetches the generic credential with the given name from Windows credential manager. // It returns nil and an error if the credential could not be found or an error occurred.
[ "GetGenericCredential", "fetches", "the", "generic", "credential", "with", "the", "given", "name", "from", "Windows", "credential", "manager", ".", "It", "returns", "nil", "and", "an", "error", "if", "the", "credential", "could", "not", "be", "found", "or", "a...
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L10-L16
137,339
danieljoos/wincred
wincred.go
NewGenericCredential
func NewGenericCredential(targetName string) (result *GenericCredential) { result = new(GenericCredential) result.TargetName = targetName result.Persist = PersistLocalMachine return }
go
func NewGenericCredential(targetName string) (result *GenericCredential) { result = new(GenericCredential) result.TargetName = targetName result.Persist = PersistLocalMachine return }
[ "func", "NewGenericCredential", "(", "targetName", "string", ")", "(", "result", "*", "GenericCredential", ")", "{", "result", "=", "new", "(", "GenericCredential", ")", "\n", "result", ".", "TargetName", "=", "targetName", "\n", "result", ".", "Persist", "=",...
// NewGenericCredential creates a new generic credential object with the given name. // The persist mode of the newly created object is set to a default value that indicates local-machine-wide storage. // The credential object is NOT yet persisted to the Windows credential vault.
[ "NewGenericCredential", "creates", "a", "new", "generic", "credential", "object", "with", "the", "given", "name", ".", "The", "persist", "mode", "of", "the", "newly", "created", "object", "is", "set", "to", "a", "default", "value", "that", "indicates", "local"...
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L21-L26
137,340
danieljoos/wincred
wincred.go
Write
func (t *GenericCredential) Write() (err error) { err = sysCredWrite(&t.Credential, sysCRED_TYPE_GENERIC) return }
go
func (t *GenericCredential) Write() (err error) { err = sysCredWrite(&t.Credential, sysCRED_TYPE_GENERIC) return }
[ "func", "(", "t", "*", "GenericCredential", ")", "Write", "(", ")", "(", "err", "error", ")", "{", "err", "=", "sysCredWrite", "(", "&", "t", ".", "Credential", ",", "sysCRED_TYPE_GENERIC", ")", "\n", "return", "\n", "}" ]
// Write persists the generic credential object to Windows credential manager.
[ "Write", "persists", "the", "generic", "credential", "object", "to", "Windows", "credential", "manager", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L29-L32
137,341
danieljoos/wincred
wincred.go
Delete
func (t *GenericCredential) Delete() (err error) { err = sysCredDelete(&t.Credential, sysCRED_TYPE_GENERIC) return }
go
func (t *GenericCredential) Delete() (err error) { err = sysCredDelete(&t.Credential, sysCRED_TYPE_GENERIC) return }
[ "func", "(", "t", "*", "GenericCredential", ")", "Delete", "(", ")", "(", "err", "error", ")", "{", "err", "=", "sysCredDelete", "(", "&", "t", ".", "Credential", ",", "sysCRED_TYPE_GENERIC", ")", "\n", "return", "\n", "}" ]
// Delete removes the credential object from Windows credential manager.
[ "Delete", "removes", "the", "credential", "object", "from", "Windows", "credential", "manager", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L35-L38
137,342
danieljoos/wincred
wincred.go
GetDomainPassword
func GetDomainPassword(targetName string) (*DomainPassword, error) { cred, err := sysCredRead(targetName, sysCRED_TYPE_DOMAIN_PASSWORD) if cred != nil { return &DomainPassword{*cred}, err } return nil, err }
go
func GetDomainPassword(targetName string) (*DomainPassword, error) { cred, err := sysCredRead(targetName, sysCRED_TYPE_DOMAIN_PASSWORD) if cred != nil { return &DomainPassword{*cred}, err } return nil, err }
[ "func", "GetDomainPassword", "(", "targetName", "string", ")", "(", "*", "DomainPassword", ",", "error", ")", "{", "cred", ",", "err", ":=", "sysCredRead", "(", "targetName", ",", "sysCRED_TYPE_DOMAIN_PASSWORD", ")", "\n", "if", "cred", "!=", "nil", "{", "re...
// GetDomainPassword fetches the domain-password credential with the given target host name from Windows credential manager. // It returns nil and an error if the credential could not be found or an error occurred.
[ "GetDomainPassword", "fetches", "the", "domain", "-", "password", "credential", "with", "the", "given", "target", "host", "name", "from", "Windows", "credential", "manager", ".", "It", "returns", "nil", "and", "an", "error", "if", "the", "credential", "could", ...
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L42-L48
137,343
danieljoos/wincred
wincred.go
NewDomainPassword
func NewDomainPassword(targetName string) (result *DomainPassword) { result = new(DomainPassword) result.TargetName = targetName result.Persist = PersistLocalMachine return }
go
func NewDomainPassword(targetName string) (result *DomainPassword) { result = new(DomainPassword) result.TargetName = targetName result.Persist = PersistLocalMachine return }
[ "func", "NewDomainPassword", "(", "targetName", "string", ")", "(", "result", "*", "DomainPassword", ")", "{", "result", "=", "new", "(", "DomainPassword", ")", "\n", "result", ".", "TargetName", "=", "targetName", "\n", "result", ".", "Persist", "=", "Persi...
// NewDomainPassword creates a new domain-password credential used for login to the given target host name. // The persist mode of the newly created object is set to a default value that indicates local-machine-wide storage. // The credential object is NOT yet persisted to the Windows credential vault.
[ "NewDomainPassword", "creates", "a", "new", "domain", "-", "password", "credential", "used", "for", "login", "to", "the", "given", "target", "host", "name", ".", "The", "persist", "mode", "of", "the", "newly", "created", "object", "is", "set", "to", "a", "...
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L53-L58
137,344
danieljoos/wincred
wincred.go
Write
func (t *DomainPassword) Write() (err error) { err = sysCredWrite(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) return }
go
func (t *DomainPassword) Write() (err error) { err = sysCredWrite(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) return }
[ "func", "(", "t", "*", "DomainPassword", ")", "Write", "(", ")", "(", "err", "error", ")", "{", "err", "=", "sysCredWrite", "(", "&", "t", ".", "Credential", ",", "sysCRED_TYPE_DOMAIN_PASSWORD", ")", "\n", "return", "\n", "}" ]
// Write persists the domain-password credential to Windows credential manager.
[ "Write", "persists", "the", "domain", "-", "password", "credential", "to", "Windows", "credential", "manager", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L61-L64
137,345
danieljoos/wincred
wincred.go
Delete
func (t *DomainPassword) Delete() (err error) { err = sysCredDelete(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) return }
go
func (t *DomainPassword) Delete() (err error) { err = sysCredDelete(&t.Credential, sysCRED_TYPE_DOMAIN_PASSWORD) return }
[ "func", "(", "t", "*", "DomainPassword", ")", "Delete", "(", ")", "(", "err", "error", ")", "{", "err", "=", "sysCredDelete", "(", "&", "t", ".", "Credential", ",", "sysCRED_TYPE_DOMAIN_PASSWORD", ")", "\n", "return", "\n", "}" ]
// Delete removes the domain-password credential from Windows credential manager.
[ "Delete", "removes", "the", "domain", "-", "password", "credential", "from", "Windows", "credential", "manager", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L67-L70
137,346
danieljoos/wincred
wincred.go
SetPassword
func (t *DomainPassword) SetPassword(pw string) { t.CredentialBlob = utf16ToByte(utf16FromString(pw)) }
go
func (t *DomainPassword) SetPassword(pw string) { t.CredentialBlob = utf16ToByte(utf16FromString(pw)) }
[ "func", "(", "t", "*", "DomainPassword", ")", "SetPassword", "(", "pw", "string", ")", "{", "t", ".", "CredentialBlob", "=", "utf16ToByte", "(", "utf16FromString", "(", "pw", ")", ")", "\n", "}" ]
// SetPassword sets the CredentialBlob field of a domain password credential to the given string.
[ "SetPassword", "sets", "the", "CredentialBlob", "field", "of", "a", "domain", "password", "credential", "to", "the", "given", "string", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L73-L75
137,347
danieljoos/wincred
wincred.go
List
func List() ([]*Credential, error) { creds, err := sysCredEnumerate("", true) if err != nil && err.Error() == sysERROR_NOT_FOUND { // Ignore ERROR_NOT_FOUND and return an empty list instead creds = []*Credential{} err = nil } return creds, err }
go
func List() ([]*Credential, error) { creds, err := sysCredEnumerate("", true) if err != nil && err.Error() == sysERROR_NOT_FOUND { // Ignore ERROR_NOT_FOUND and return an empty list instead creds = []*Credential{} err = nil } return creds, err }
[ "func", "List", "(", ")", "(", "[", "]", "*", "Credential", ",", "error", ")", "{", "creds", ",", "err", ":=", "sysCredEnumerate", "(", "\"", "\"", ",", "true", ")", "\n", "if", "err", "!=", "nil", "&&", "err", ".", "Error", "(", ")", "==", "sy...
// List retrieves all credentials of the Credentials store.
[ "List", "retrieves", "all", "credentials", "of", "the", "Credentials", "store", "." ]
b892d337201d1400370ebf4fa919941c9ea222ee
https://github.com/danieljoos/wincred/blob/b892d337201d1400370ebf4fa919941c9ea222ee/wincred.go#L78-L86
137,348
NebulousLabs/fastrand
fastrand.go
init
func init() { r := &randReader{} n, err := rand.Read(r.entropy[:]) if err != nil || n != len(r.entropy) { panic("not enough entropy to fill fastrand reader at startup") } Reader = r }
go
func init() { r := &randReader{} n, err := rand.Read(r.entropy[:]) if err != nil || n != len(r.entropy) { panic("not enough entropy to fill fastrand reader at startup") } Reader = r }
[ "func", "init", "(", ")", "{", "r", ":=", "&", "randReader", "{", "}", "\n", "n", ",", "err", ":=", "rand", ".", "Read", "(", "r", ".", "entropy", "[", ":", "]", ")", "\n", "if", "err", "!=", "nil", "||", "n", "!=", "len", "(", "r", ".", ...
// init provides the initial entropy for the reader that will seed all numbers // coming out of fastrand.
[ "init", "provides", "the", "initial", "entropy", "for", "the", "reader", "that", "will", "seed", "all", "numbers", "coming", "out", "of", "fastrand", "." ]
6fb6489aac4eae79e3f8112c21708191a7a90dd7
https://github.com/NebulousLabs/fastrand/blob/6fb6489aac4eae79e3f8112c21708191a7a90dd7/fastrand.go#L42-L49
137,349
NebulousLabs/fastrand
fastrand.go
Bytes
func Bytes(n int) []byte { b := make([]byte, n) Read(b) return b }
go
func Bytes(n int) []byte { b := make([]byte, n) Read(b) return b }
[ "func", "Bytes", "(", "n", "int", ")", "[", "]", "byte", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "n", ")", "\n", "Read", "(", "b", ")", "\n", "return", "b", "\n", "}" ]
// Bytes is a helper function that returns n bytes of random data.
[ "Bytes", "is", "a", "helper", "function", "that", "returns", "n", "bytes", "of", "random", "data", "." ]
6fb6489aac4eae79e3f8112c21708191a7a90dd7
https://github.com/NebulousLabs/fastrand/blob/6fb6489aac4eae79e3f8112c21708191a7a90dd7/fastrand.go#L122-L126
137,350
NebulousLabs/fastrand
fastrand.go
Uint64n
func Uint64n(n uint64) uint64 { if n == 0 { panic("fastrand: argument to Uint64n is 0") } // To eliminate modulo bias, keep selecting at random until we fall within // a range that is evenly divisible by n. // NOTE: since n is at most math.MaxUint64, max is minimized when: // n = math.MaxUint64/2 + 1 -> max ...
go
func Uint64n(n uint64) uint64 { if n == 0 { panic("fastrand: argument to Uint64n is 0") } // To eliminate modulo bias, keep selecting at random until we fall within // a range that is evenly divisible by n. // NOTE: since n is at most math.MaxUint64, max is minimized when: // n = math.MaxUint64/2 + 1 -> max ...
[ "func", "Uint64n", "(", "n", "uint64", ")", "uint64", "{", "if", "n", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "// To eliminate modulo bias, keep selecting at random until we fall within", "// a range that is evenly divisible by n.", "// NOTE: sin...
// Uint64n returns a uniform random uint64 in [0,n). It panics if n == 0.
[ "Uint64n", "returns", "a", "uniform", "random", "uint64", "in", "[", "0", "n", ")", ".", "It", "panics", "if", "n", "==", "0", "." ]
6fb6489aac4eae79e3f8112c21708191a7a90dd7
https://github.com/NebulousLabs/fastrand/blob/6fb6489aac4eae79e3f8112c21708191a7a90dd7/fastrand.go#L129-L146
137,351
NebulousLabs/fastrand
fastrand.go
Intn
func Intn(n int) int { if n <= 0 { panic("fastrand: argument to Intn is <= 0: " + strconv.Itoa(n)) } // NOTE: since n is at most math.MaxUint64/2, max is minimized when: // n = math.MaxUint64/4 + 1 -> max = math.MaxUint64 - math.MaxUint64/4 // This gives an expected 1.333 tries before choosing a value < max. ...
go
func Intn(n int) int { if n <= 0 { panic("fastrand: argument to Intn is <= 0: " + strconv.Itoa(n)) } // NOTE: since n is at most math.MaxUint64/2, max is minimized when: // n = math.MaxUint64/4 + 1 -> max = math.MaxUint64 - math.MaxUint64/4 // This gives an expected 1.333 tries before choosing a value < max. ...
[ "func", "Intn", "(", "n", "int", ")", "int", "{", "if", "n", "<=", "0", "{", "panic", "(", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "n", ")", ")", "\n", "}", "\n", "// NOTE: since n is at most math.MaxUint64/2, max is minimized when:", "// n = math.M...
// Intn returns a uniform random int in [0,n). It panics if n <= 0.
[ "Intn", "returns", "a", "uniform", "random", "int", "in", "[", "0", "n", ")", ".", "It", "panics", "if", "n", "<", "=", "0", "." ]
6fb6489aac4eae79e3f8112c21708191a7a90dd7
https://github.com/NebulousLabs/fastrand/blob/6fb6489aac4eae79e3f8112c21708191a7a90dd7/fastrand.go#L149-L157
137,352
Lazin/go-ngram
ngram.go
SetPad
func SetPad(c rune) Option { return func(ngram *NGramIndex) error { ngram.pad = string(c) return nil } }
go
func SetPad(c rune) Option { return func(ngram *NGramIndex) error { ngram.pad = string(c) return nil } }
[ "func", "SetPad", "(", "c", "rune", ")", "Option", "{", "return", "func", "(", "ngram", "*", "NGramIndex", ")", "error", "{", "ngram", ".", "pad", "=", "string", "(", "c", ")", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// SetPad must be used to pass padding character to NGramIndex c-tor
[ "SetPad", "must", "be", "used", "to", "pass", "padding", "character", "to", "NGramIndex", "c", "-", "tor" ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L92-L97
137,353
Lazin/go-ngram
ngram.go
SetWarp
func SetWarp(warp float64) Option { return func(ngram *NGramIndex) error { if warp < 0.0 || warp > 1.0 { return errors.New("bad 'warp' value for n-gram index") } ngram.warp = warp return nil } }
go
func SetWarp(warp float64) Option { return func(ngram *NGramIndex) error { if warp < 0.0 || warp > 1.0 { return errors.New("bad 'warp' value for n-gram index") } ngram.warp = warp return nil } }
[ "func", "SetWarp", "(", "warp", "float64", ")", "Option", "{", "return", "func", "(", "ngram", "*", "NGramIndex", ")", "error", "{", "if", "warp", "<", "0.0", "||", "warp", ">", "1.0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n"...
// SetWarp must be used to pass warp to NGramIndex c-tor
[ "SetWarp", "must", "be", "used", "to", "pass", "warp", "to", "NGramIndex", "c", "-", "tor" ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L111-L119
137,354
Lazin/go-ngram
ngram.go
NewNGramIndex
func NewNGramIndex(opts ...Option) (*NGramIndex, error) { ngram := new(NGramIndex) for _, opt := range opts { if err := opt(ngram); err != nil { return nil, err } } ngram.init() return ngram, nil }
go
func NewNGramIndex(opts ...Option) (*NGramIndex, error) { ngram := new(NGramIndex) for _, opt := range opts { if err := opt(ngram); err != nil { return nil, err } } ngram.init() return ngram, nil }
[ "func", "NewNGramIndex", "(", "opts", "...", "Option", ")", "(", "*", "NGramIndex", ",", "error", ")", "{", "ngram", ":=", "new", "(", "NGramIndex", ")", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "if", "err", ":=", "opt", "(", "ngra...
// NewNGramIndex is N-gram index c-tor. In most cases must be used withot parameters. // You can pass parameters to c-tor using functions SetPad, SetWarp and SetN.
[ "NewNGramIndex", "is", "N", "-", "gram", "index", "c", "-", "tor", ".", "In", "most", "cases", "must", "be", "used", "withot", "parameters", ".", "You", "can", "pass", "parameters", "to", "c", "-", "tor", "using", "functions", "SetPad", "SetWarp", "and",...
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L123-L132
137,355
Lazin/go-ngram
ngram.go
Add
func (ngram *NGramIndex) Add(input string) (TokenID, error) { if ngram.index == nil { ngram.init() } results, error := ngram.splitInput(input) if error != nil { return -1, error } ixstr, error := ngram.spool.Append(input) if error != nil { return -1, error } for _, hash := range results { ngram.Lock() ...
go
func (ngram *NGramIndex) Add(input string) (TokenID, error) { if ngram.index == nil { ngram.init() } results, error := ngram.splitInput(input) if error != nil { return -1, error } ixstr, error := ngram.spool.Append(input) if error != nil { return -1, error } for _, hash := range results { ngram.Lock() ...
[ "func", "(", "ngram", "*", "NGramIndex", ")", "Add", "(", "input", "string", ")", "(", "TokenID", ",", "error", ")", "{", "if", "ngram", ".", "index", "==", "nil", "{", "ngram", ".", "init", "(", ")", "\n", "}", "\n", "results", ",", "error", ":=...
// Add token to index. Function returns token id, this id can be converted // to string with function "GetString".
[ "Add", "token", "to", "index", ".", "Function", "returns", "token", "id", "this", "id", "can", "be", "converted", "to", "string", "with", "function", "GetString", "." ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L136-L158
137,356
Lazin/go-ngram
ngram.go
GetString
func (ngram *NGramIndex) GetString(id TokenID) (string, error) { return ngram.spool.ReadAt(id) }
go
func (ngram *NGramIndex) GetString(id TokenID) (string, error) { return ngram.spool.ReadAt(id) }
[ "func", "(", "ngram", "*", "NGramIndex", ")", "GetString", "(", "id", "TokenID", ")", "(", "string", ",", "error", ")", "{", "return", "ngram", ".", "spool", ".", "ReadAt", "(", "id", ")", "\n", "}" ]
// GetString converts token-id to string.
[ "GetString", "converts", "token", "-", "id", "to", "string", "." ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L161-L163
137,357
Lazin/go-ngram
ngram.go
countNgrams
func (ngram *NGramIndex) countNgrams(inputNgrams []uint32) map[TokenID]int { counters := make(map[TokenID]int) for _, ngramHash := range inputNgrams { ngram.RLock() for tok := range ngram.index[ngramHash] { counters[tok]++ } ngram.RUnlock() } return counters }
go
func (ngram *NGramIndex) countNgrams(inputNgrams []uint32) map[TokenID]int { counters := make(map[TokenID]int) for _, ngramHash := range inputNgrams { ngram.RLock() for tok := range ngram.index[ngramHash] { counters[tok]++ } ngram.RUnlock() } return counters }
[ "func", "(", "ngram", "*", "NGramIndex", ")", "countNgrams", "(", "inputNgrams", "[", "]", "uint32", ")", "map", "[", "TokenID", "]", "int", "{", "counters", ":=", "make", "(", "map", "[", "TokenID", "]", "int", ")", "\n", "for", "_", ",", "ngramHash...
// countNgrams maps matched tokens to the number of ngrams, shared with input string
[ "countNgrams", "maps", "matched", "tokens", "to", "the", "number", "of", "ngrams", "shared", "with", "input", "string" ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L166-L176
137,358
Lazin/go-ngram
ngram.go
BestMatch
func (ngram *NGramIndex) BestMatch(input string, threshold ...float64) (*SearchResult, error) { if ngram.index == nil { ngram.init() } tval, error := validateThresholdValues(threshold) if error != nil { return nil, error } variants, error := ngram.match(input, tval) if error != nil { return nil, error } ...
go
func (ngram *NGramIndex) BestMatch(input string, threshold ...float64) (*SearchResult, error) { if ngram.index == nil { ngram.init() } tval, error := validateThresholdValues(threshold) if error != nil { return nil, error } variants, error := ngram.match(input, tval) if error != nil { return nil, error } ...
[ "func", "(", "ngram", "*", "NGramIndex", ")", "BestMatch", "(", "input", "string", ",", "threshold", "...", "float64", ")", "(", "*", "SearchResult", ",", "error", ")", "{", "if", "ngram", ".", "index", "==", "nil", "{", "ngram", ".", "init", "(", ")...
// BestMatch is the same as Search except that it's returning only one best result instead of all.
[ "BestMatch", "is", "the", "same", "as", "Search", "except", "that", "it", "s", "returning", "only", "one", "best", "result", "instead", "of", "all", "." ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/ngram.go#L234-L258
137,359
Lazin/go-ngram
spool.go
Append
func (pool *stringPool) Append(s string) (TokenID, error) { begin := pool.buffer.Len() bstr := []byte(s) bstr = smaz.Compress(bstr) n, error := pool.buffer.Write(bstr) if error != nil { return 0, error } end := begin + n pool.Lock() ixitem := TokenID(len(pool.items)) pool.items = append(pool.items, region{b...
go
func (pool *stringPool) Append(s string) (TokenID, error) { begin := pool.buffer.Len() bstr := []byte(s) bstr = smaz.Compress(bstr) n, error := pool.buffer.Write(bstr) if error != nil { return 0, error } end := begin + n pool.Lock() ixitem := TokenID(len(pool.items)) pool.items = append(pool.items, region{b...
[ "func", "(", "pool", "*", "stringPool", ")", "Append", "(", "s", "string", ")", "(", "TokenID", ",", "error", ")", "{", "begin", ":=", "pool", ".", "buffer", ".", "Len", "(", ")", "\n", "bstr", ":=", "[", "]", "byte", "(", "s", ")", "\n", "bstr...
// Append adds new string to string pool. Function returns token ID and error. // Strings doesn't need to be unique
[ "Append", "adds", "new", "string", "to", "string", "pool", ".", "Function", "returns", "token", "ID", "and", "error", ".", "Strings", "doesn", "t", "need", "to", "be", "unique" ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/spool.go#L26-L40
137,360
Lazin/go-ngram
spool.go
ReadAt
func (pool *stringPool) ReadAt(index TokenID) (string, error) { if index < TokenID(0) || index >= TokenID(len(pool.items)) { return "", errors.New("index out of range") } pool.RLock() item := pool.items[int(index)] pool.RUnlock() compressed := pool.buffer.Bytes()[item.begin:item.end] decompressed, error := sma...
go
func (pool *stringPool) ReadAt(index TokenID) (string, error) { if index < TokenID(0) || index >= TokenID(len(pool.items)) { return "", errors.New("index out of range") } pool.RLock() item := pool.items[int(index)] pool.RUnlock() compressed := pool.buffer.Bytes()[item.begin:item.end] decompressed, error := sma...
[ "func", "(", "pool", "*", "stringPool", ")", "ReadAt", "(", "index", "TokenID", ")", "(", "string", ",", "error", ")", "{", "if", "index", "<", "TokenID", "(", "0", ")", "||", "index", ">=", "TokenID", "(", "len", "(", "pool", ".", "items", ")", ...
// ReadAt converts token ID back to string.
[ "ReadAt", "converts", "token", "ID", "back", "to", "string", "." ]
80eaf16ac4ebcf4343074241ac31fc9e99824503
https://github.com/Lazin/go-ngram/blob/80eaf16ac4ebcf4343074241ac31fc9e99824503/spool.go#L43-L56
137,361
vmware/goipmi
asf.go
response
func (m *asfMessage) response(data interface{}) error { return binary.Read(bytes.NewBuffer(m.Data), binary.BigEndian, data) }
go
func (m *asfMessage) response(data interface{}) error { return binary.Read(bytes.NewBuffer(m.Data), binary.BigEndian, data) }
[ "func", "(", "m", "*", "asfMessage", ")", "response", "(", "data", "interface", "{", "}", ")", "error", "{", "return", "binary", ".", "Read", "(", "bytes", ".", "NewBuffer", "(", "m", ".", "Data", ")", ",", "binary", ".", "BigEndian", ",", "data", ...
// Response specific to the request ASF command
[ "Response", "specific", "to", "the", "request", "ASF", "command" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/asf.go#L102-L104
137,362
vmware/goipmi
lan.go
authMD5
func (l *lan) authMD5(data []uint8) []uint8 { h := md5.New() binaryWrite(h, l.authcode) binaryWrite(h, l.SessionID) binaryWrite(h, data) binaryWrite(h, l.Sequence) binaryWrite(h, l.authcode) return h.Sum(nil) }
go
func (l *lan) authMD5(data []uint8) []uint8 { h := md5.New() binaryWrite(h, l.authcode) binaryWrite(h, l.SessionID) binaryWrite(h, data) binaryWrite(h, l.Sequence) binaryWrite(h, l.authcode) return h.Sum(nil) }
[ "func", "(", "l", "*", "lan", ")", "authMD5", "(", "data", "[", "]", "uint8", ")", "[", "]", "uint8", "{", "h", ":=", "md5", ".", "New", "(", ")", "\n\n", "binaryWrite", "(", "h", ",", "l", ".", "authcode", ")", "\n", "binaryWrite", "(", "h", ...
// per section 22.17.1
[ "per", "section", "22", ".", "17", ".", "1" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/lan.go#L203-L213
137,363
vmware/goipmi
message.go
Request
func (m *Message) Request(data interface{}) Response { err := messageDataFromBytes(m.Data, data) if err != nil { if e, ok := err.(CompletionCode); ok { return e } return ErrUnspecified } return nil }
go
func (m *Message) Request(data interface{}) Response { err := messageDataFromBytes(m.Data, data) if err != nil { if e, ok := err.(CompletionCode); ok { return e } return ErrUnspecified } return nil }
[ "func", "(", "m", "*", "Message", ")", "Request", "(", "data", "interface", "{", "}", ")", "Response", "{", "err", ":=", "messageDataFromBytes", "(", "m", ".", "Data", ",", "data", ")", "\n", "if", "err", "!=", "nil", "{", "if", "e", ",", "ok", "...
// Request specific to the request IPMI command // Unmarshal errors are returned as a Response such that they can be // propagated to the client.
[ "Request", "specific", "to", "the", "request", "IPMI", "command", "Unmarshal", "errors", "are", "returned", "as", "a", "Response", "such", "that", "they", "can", "be", "propagated", "to", "the", "client", "." ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/message.go#L81-L90
137,364
vmware/goipmi
message.go
Response
func (m *Message) Response(data Response) error { if m.CompletionCode() != CommandCompleted { return m.CompletionCode() } return messageDataFromBytes(m.Data, data) }
go
func (m *Message) Response(data Response) error { if m.CompletionCode() != CommandCompleted { return m.CompletionCode() } return messageDataFromBytes(m.Data, data) }
[ "func", "(", "m", "*", "Message", ")", "Response", "(", "data", "Response", ")", "error", "{", "if", "m", ".", "CompletionCode", "(", ")", "!=", "CommandCompleted", "{", "return", "m", ".", "CompletionCode", "(", ")", "\n", "}", "\n", "return", "messag...
// Response specific to the request IPMI command
[ "Response", "specific", "to", "the", "request", "IPMI", "command" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/message.go#L93-L98
137,365
vmware/goipmi
client.go
NewClient
func NewClient(c *Connection) (*Client, error) { t, err := newTransport(c) if err != nil { return nil, err } return &Client{ Connection: c, transport: t, }, nil }
go
func NewClient(c *Connection) (*Client, error) { t, err := newTransport(c) if err != nil { return nil, err } return &Client{ Connection: c, transport: t, }, nil }
[ "func", "NewClient", "(", "c", "*", "Connection", ")", "(", "*", "Client", ",", "error", ")", "{", "t", ",", "err", ":=", "newTransport", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", ...
// NewClient creates a new Client with the given Connection properties
[ "NewClient", "creates", "a", "new", "Client", "with", "the", "given", "Connection", "properties" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/client.go#L26-L35
137,366
vmware/goipmi
client.go
Send
func (c *Client) Send(req *Request, res Response) error { // TODO: handle retry, timeouts, etc. return c.send(req, res) }
go
func (c *Client) Send(req *Request, res Response) error { // TODO: handle retry, timeouts, etc. return c.send(req, res) }
[ "func", "(", "c", "*", "Client", ")", "Send", "(", "req", "*", "Request", ",", "res", "Response", ")", "error", "{", "// TODO: handle retry, timeouts, etc.", "return", "c", ".", "send", "(", "req", ",", "res", ")", "\n", "}" ]
// Send a Request and unmarshal to given Response type
[ "Send", "a", "Request", "and", "unmarshal", "to", "given", "Response", "type" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/client.go#L49-L52
137,367
vmware/goipmi
client.go
DeviceID
func (c *Client) DeviceID() (*DeviceIDResponse, error) { req := &Request{ NetworkFunctionApp, CommandGetDeviceID, &DeviceIDRequest{}, } res := &DeviceIDResponse{} return res, c.Send(req, res) }
go
func (c *Client) DeviceID() (*DeviceIDResponse, error) { req := &Request{ NetworkFunctionApp, CommandGetDeviceID, &DeviceIDRequest{}, } res := &DeviceIDResponse{} return res, c.Send(req, res) }
[ "func", "(", "c", "*", "Client", ")", "DeviceID", "(", ")", "(", "*", "DeviceIDResponse", ",", "error", ")", "{", "req", ":=", "&", "Request", "{", "NetworkFunctionApp", ",", "CommandGetDeviceID", ",", "&", "DeviceIDRequest", "{", "}", ",", "}", "\n", ...
// DeviceID get the Device ID of the BMC
[ "DeviceID", "get", "the", "Device", "ID", "of", "the", "BMC" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/client.go#L55-L63
137,368
vmware/goipmi
client.go
SetBootDevice
func (c *Client) SetBootDevice(dev BootDevice) error { useProgress := true // set set-in-progress flag err := c.setBootParam(BootParamSetInProgress, 0x01) if err != nil { useProgress = false } err = c.setBootParam(BootParamInfoAck, 0x01, 0x01) if err != nil { if useProgress { // set-in-progress = set-com...
go
func (c *Client) SetBootDevice(dev BootDevice) error { useProgress := true // set set-in-progress flag err := c.setBootParam(BootParamSetInProgress, 0x01) if err != nil { useProgress = false } err = c.setBootParam(BootParamInfoAck, 0x01, 0x01) if err != nil { if useProgress { // set-in-progress = set-com...
[ "func", "(", "c", "*", "Client", ")", "SetBootDevice", "(", "dev", "BootDevice", ")", "error", "{", "useProgress", ":=", "true", "\n", "// set set-in-progress flag", "err", ":=", "c", ".", "setBootParam", "(", "BootParamSetInProgress", ",", "0x01", ")", "\n", ...
// SetBootDevice is a wrapper around SetSystemBootOptionsRequest to configure the BootDevice // per section 28.12 - table 28
[ "SetBootDevice", "is", "a", "wrapper", "around", "SetSystemBootOptionsRequest", "to", "configure", "the", "BootDevice", "per", "section", "28", ".", "12", "-", "table", "28" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/client.go#L79-L110
137,369
vmware/goipmi
client.go
Control
func (c *Client) Control(ctl ChassisControl) error { r := &Request{ NetworkFunctionChassis, CommandChassisControl, &ChassisControlRequest{ctl}, } return c.Send(r, &ChassisControlResponse{}) }
go
func (c *Client) Control(ctl ChassisControl) error { r := &Request{ NetworkFunctionChassis, CommandChassisControl, &ChassisControlRequest{ctl}, } return c.Send(r, &ChassisControlResponse{}) }
[ "func", "(", "c", "*", "Client", ")", "Control", "(", "ctl", "ChassisControl", ")", "error", "{", "r", ":=", "&", "Request", "{", "NetworkFunctionChassis", ",", "CommandChassisControl", ",", "&", "ChassisControlRequest", "{", "ctl", "}", ",", "}", "\n", "r...
// Control sends a chassis power control command
[ "Control", "sends", "a", "chassis", "power", "control", "command" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/client.go#L113-L120
137,370
vmware/goipmi
completion_code.go
Error
func (c CompletionCode) Error() string { if s, ok := completionCodes[c]; ok { return s } return fmt.Sprintf("Completion Code: %X", uint8(c)) }
go
func (c CompletionCode) Error() string { if s, ok := completionCodes[c]; ok { return s } return fmt.Sprintf("Completion Code: %X", uint8(c)) }
[ "func", "(", "c", "CompletionCode", ")", "Error", "(", ")", "string", "{", "if", "s", ",", "ok", ":=", "completionCodes", "[", "c", "]", ";", "ok", "{", "return", "s", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "uint8...
// Error for CompletionCode
[ "Error", "for", "CompletionCode" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/completion_code.go#L85-L90
137,371
vmware/goipmi
simulator.go
NewSimulator
func NewSimulator(addr net.UDPAddr) *Simulator { s := &Simulator{ addr: addr, ids: map[uint32]string{}, handlers: map[NetworkFunction]map[Command]Handler{}, } // Built-in handlers for session management s.handlers[NetworkFunctionApp] = map[Command]Handler{ CommandGetDeviceID: s.device...
go
func NewSimulator(addr net.UDPAddr) *Simulator { s := &Simulator{ addr: addr, ids: map[uint32]string{}, handlers: map[NetworkFunction]map[Command]Handler{}, } // Built-in handlers for session management s.handlers[NetworkFunctionApp] = map[Command]Handler{ CommandGetDeviceID: s.device...
[ "func", "NewSimulator", "(", "addr", "net", ".", "UDPAddr", ")", "*", "Simulator", "{", "s", ":=", "&", "Simulator", "{", "addr", ":", "addr", ",", "ids", ":", "map", "[", "uint32", "]", "string", "{", "}", ",", "handlers", ":", "map", "[", "Networ...
// NewSimulator constructs a Simulator with the given addr
[ "NewSimulator", "constructs", "a", "Simulator", "with", "the", "given", "addr" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L44-L71
137,372
vmware/goipmi
simulator.go
SetHandler
func (s *Simulator) SetHandler(netfn NetworkFunction, command Command, handler Handler) { s.handlers[netfn][command] = handler }
go
func (s *Simulator) SetHandler(netfn NetworkFunction, command Command, handler Handler) { s.handlers[netfn][command] = handler }
[ "func", "(", "s", "*", "Simulator", ")", "SetHandler", "(", "netfn", "NetworkFunction", ",", "command", "Command", ",", "handler", "Handler", ")", "{", "s", ".", "handlers", "[", "netfn", "]", "[", "command", "]", "=", "handler", "\n", "}" ]
// SetHandler sets the command handler for the given netfn and command
[ "SetHandler", "sets", "the", "command", "handler", "for", "the", "given", "netfn", "and", "command" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L74-L76
137,373
vmware/goipmi
simulator.go
NewConnection
func (s *Simulator) NewConnection() *Connection { addr := s.LocalAddr() return &Connection{ Hostname: addr.IP.String(), Port: addr.Port, Interface: "lan", } }
go
func (s *Simulator) NewConnection() *Connection { addr := s.LocalAddr() return &Connection{ Hostname: addr.IP.String(), Port: addr.Port, Interface: "lan", } }
[ "func", "(", "s", "*", "Simulator", ")", "NewConnection", "(", ")", "*", "Connection", "{", "addr", ":=", "s", ".", "LocalAddr", "(", ")", "\n", "return", "&", "Connection", "{", "Hostname", ":", "addr", ".", "IP", ".", "String", "(", ")", ",", "Po...
// NewConnection to this Simulator instance
[ "NewConnection", "to", "this", "Simulator", "instance" ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L79-L86
137,374
vmware/goipmi
simulator.go
LocalAddr
func (s *Simulator) LocalAddr() *net.UDPAddr { if s.conn != nil { return s.conn.LocalAddr().(*net.UDPAddr) } return nil }
go
func (s *Simulator) LocalAddr() *net.UDPAddr { if s.conn != nil { return s.conn.LocalAddr().(*net.UDPAddr) } return nil }
[ "func", "(", "s", "*", "Simulator", ")", "LocalAddr", "(", ")", "*", "net", ".", "UDPAddr", "{", "if", "s", ".", "conn", "!=", "nil", "{", "return", "s", ".", "conn", ".", "LocalAddr", "(", ")", ".", "(", "*", "net", ".", "UDPAddr", ")", "\n", ...
// LocalAddr returns the address the server is bound to.
[ "LocalAddr", "returns", "the", "address", "the", "server", "is", "bound", "to", "." ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L89-L94
137,375
vmware/goipmi
simulator.go
Run
func (s *Simulator) Run() error { var err error s.conn, err = net.ListenUDP("udp4", &s.addr) if err != nil { return err } s.wg.Add(1) go func() { _ = s.serve() s.wg.Done() }() return nil }
go
func (s *Simulator) Run() error { var err error s.conn, err = net.ListenUDP("udp4", &s.addr) if err != nil { return err } s.wg.Add(1) go func() { _ = s.serve() s.wg.Done() }() return nil }
[ "func", "(", "s", "*", "Simulator", ")", "Run", "(", ")", "error", "{", "var", "err", "error", "\n", "s", ".", "conn", ",", "err", "=", "net", ".", "ListenUDP", "(", "\"", "\"", ",", "&", "s", ".", "addr", ")", "\n", "if", "err", "!=", "nil",...
// Run the Simulator.
[ "Run", "the", "Simulator", "." ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L97-L112
137,376
vmware/goipmi
simulator.go
Stop
func (s *Simulator) Stop() { _ = s.conn.Close() s.wg.Wait() }
go
func (s *Simulator) Stop() { _ = s.conn.Close() s.wg.Wait() }
[ "func", "(", "s", "*", "Simulator", ")", "Stop", "(", ")", "{", "_", "=", "s", ".", "conn", ".", "Close", "(", ")", "\n", "s", ".", "wg", ".", "Wait", "(", ")", "\n", "}" ]
// Stop the Simulator.
[ "Stop", "the", "Simulator", "." ]
2333cd82d7020d1701c082e98870cb64a97988a2
https://github.com/vmware/goipmi/blob/2333cd82d7020d1701c082e98870cb64a97988a2/simulator.go#L115-L118
137,377
gdamore/encoding
charmap.go
NewDecoder
func (c *Charmap) NewDecoder() *encoding.Decoder { c.Init() return &encoding.Decoder{Transformer: &cmapDecoder{runes: c.runes}} }
go
func (c *Charmap) NewDecoder() *encoding.Decoder { c.Init() return &encoding.Decoder{Transformer: &cmapDecoder{runes: c.runes}} }
[ "func", "(", "c", "*", "Charmap", ")", "NewDecoder", "(", ")", "*", "encoding", ".", "Decoder", "{", "c", ".", "Init", "(", ")", "\n", "return", "&", "encoding", ".", "Decoder", "{", "Transformer", ":", "&", "cmapDecoder", "{", "runes", ":", "c", "...
// NewDecoder returns a Decoder the converts from the 8-bit // character set to UTF-8. Unknown mappings, if any, are mapped // to '\uFFFD'.
[ "NewDecoder", "returns", "a", "Decoder", "the", "converts", "from", "the", "8", "-", "bit", "character", "set", "to", "UTF", "-", "8", ".", "Unknown", "mappings", "if", "any", "are", "mapped", "to", "\\", "uFFFD", "." ]
6289cdc94c00ac4aa177771c5fce7af2f96b626d
https://github.com/gdamore/encoding/blob/6289cdc94c00ac4aa177771c5fce7af2f96b626d/charmap.go#L129-L132
137,378
gdamore/encoding
charmap.go
NewEncoder
func (c *Charmap) NewEncoder() *encoding.Encoder { c.Init() return &encoding.Encoder{ Transformer: &cmapEncoder{ bytes: c.bytes, replace: c.ReplacementChar, }, } }
go
func (c *Charmap) NewEncoder() *encoding.Encoder { c.Init() return &encoding.Encoder{ Transformer: &cmapEncoder{ bytes: c.bytes, replace: c.ReplacementChar, }, } }
[ "func", "(", "c", "*", "Charmap", ")", "NewEncoder", "(", ")", "*", "encoding", ".", "Encoder", "{", "c", ".", "Init", "(", ")", "\n", "return", "&", "encoding", ".", "Encoder", "{", "Transformer", ":", "&", "cmapEncoder", "{", "bytes", ":", "c", "...
// NewEncoder returns a Transformer that converts from UTF8 to the // 8-bit character set. Unknown mappings are mapped to 0x1A.
[ "NewEncoder", "returns", "a", "Transformer", "that", "converts", "from", "UTF8", "to", "the", "8", "-", "bit", "character", "set", ".", "Unknown", "mappings", "are", "mapped", "to", "0x1A", "." ]
6289cdc94c00ac4aa177771c5fce7af2f96b626d
https://github.com/gdamore/encoding/blob/6289cdc94c00ac4aa177771c5fce7af2f96b626d/charmap.go#L136-L144
137,379
vaughan0/go-ini
ini.go
Load
func (f File) Load(in io.Reader) (err error) { bufin, ok := in.(*bufio.Reader) if !ok { bufin = bufio.NewReader(in) } return parseFile(bufin, f) }
go
func (f File) Load(in io.Reader) (err error) { bufin, ok := in.(*bufio.Reader) if !ok { bufin = bufio.NewReader(in) } return parseFile(bufin, f) }
[ "func", "(", "f", "File", ")", "Load", "(", "in", "io", ".", "Reader", ")", "(", "err", "error", ")", "{", "bufin", ",", "ok", ":=", "in", ".", "(", "*", "bufio", ".", "Reader", ")", "\n", "if", "!", "ok", "{", "bufin", "=", "bufio", ".", "...
// Loads INI data from a reader and stores the data in the File.
[ "Loads", "INI", "data", "from", "a", "reader", "and", "stores", "the", "data", "in", "the", "File", "." ]
a98ad7ee00ec53921f08832bc06ecf7fd600e6a1
https://github.com/vaughan0/go-ini/blob/a98ad7ee00ec53921f08832bc06ecf7fd600e6a1/ini.go#L53-L59
137,380
sogko/slumber
domain/routes.go
Append
func (r *Routes) Append(routes ...*Routes) Routes { res := Routes{} // copy current route for _, route := range *r { res = append(res, route) } for _, _routes := range routes { for _, route := range *_routes { res = append(res, route) } } return res }
go
func (r *Routes) Append(routes ...*Routes) Routes { res := Routes{} // copy current route for _, route := range *r { res = append(res, route) } for _, _routes := range routes { for _, route := range *_routes { res = append(res, route) } } return res }
[ "func", "(", "r", "*", "Routes", ")", "Append", "(", "routes", "...", "*", "Routes", ")", "Routes", "{", "res", ":=", "Routes", "{", "}", "\n", "// copy current route", "for", "_", ",", "route", ":=", "range", "*", "r", "{", "res", "=", "append", "...
// Append Returns a new slice of Routes
[ "Append", "Returns", "a", "new", "slice", "of", "Routes" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/domain/routes.go#L27-L39
137,381
sogko/slumber
server/server.go
NewServer
func NewServer(options *Config) *Server { // set up server and middlewares n := negroni.Classic() s := &Server{n, options.Context, nil, nil, 0} return s }
go
func NewServer(options *Config) *Server { // set up server and middlewares n := negroni.Classic() s := &Server{n, options.Context, nil, nil, 0} return s }
[ "func", "NewServer", "(", "options", "*", "Config", ")", "*", "Server", "{", "// set up server and middlewares", "n", ":=", "negroni", ".", "Classic", "(", ")", "\n\n", "s", ":=", "&", "Server", "{", "n", ",", "options", ".", "Context", ",", "nil", ",", ...
// NewServer Returns a new Server object
[ "NewServer", "Returns", "a", "new", "Server", "object" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/server/server.go#L36-L44
137,382
sogko/slumber
middlewares/renderer/renderer.go
New
func New(options *Options, defaultRenderType string) *Renderer { r := render.New(render.Options(*options)) return &Renderer{r, options, defaultRenderType} }
go
func New(options *Options, defaultRenderType string) *Renderer { r := render.New(render.Options(*options)) return &Renderer{r, options, defaultRenderType} }
[ "func", "New", "(", "options", "*", "Options", ",", "defaultRenderType", "string", ")", "*", "Renderer", "{", "r", ":=", "render", ".", "New", "(", "render", ".", "Options", "(", "*", "options", ")", ")", "\n", "return", "&", "Renderer", "{", "r", ",...
// New( Returns a new Renderer object
[ "New", "(", "Returns", "a", "new", "Renderer", "object" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/middlewares/renderer/renderer.go#L26-L29
137,383
sogko/slumber
middlewares/renderer/renderer.go
Handler
func (renderer *Renderer) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc, ctx domain.IContext) { SetRendererCtx(ctx, req, renderer) next(w, req) }
go
func (renderer *Renderer) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc, ctx domain.IContext) { SetRendererCtx(ctx, req, renderer) next(w, req) }
[ "func", "(", "renderer", "*", "Renderer", ")", "Handler", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "next", "http", ".", "HandlerFunc", ",", "ctx", "domain", ".", "IContext", ")", "{", "SetRendererCtx", "(", ...
// HandlerWithNext Returns a middleware HandlerFunc that saves the Render object into request context
[ "HandlerWithNext", "Returns", "a", "middleware", "HandlerFunc", "that", "saves", "the", "Render", "object", "into", "request", "context" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/middlewares/renderer/renderer.go#L32-L35
137,384
sogko/slumber
middlewares/mongodb/mongodb.go
Handler
func (session *MongoDBSession) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc, ctx domain.IContext) { s := session.Clone() defer s.Close() db := &MongoDB{ currentDb: s.DB(session.DatabaseName), } SetMongoDbCtx(ctx, req, db) next(w, req) }
go
func (session *MongoDBSession) Handler(w http.ResponseWriter, req *http.Request, next http.HandlerFunc, ctx domain.IContext) { s := session.Clone() defer s.Close() db := &MongoDB{ currentDb: s.DB(session.DatabaseName), } SetMongoDbCtx(ctx, req, db) next(w, req) }
[ "func", "(", "session", "*", "MongoDBSession", ")", "Handler", "(", "w", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "next", "http", ".", "HandlerFunc", ",", "ctx", "domain", ".", "IContext", ")", "{", "s", ":=", "sessi...
// Handler Returns a middleware HandlerFunc that creates and saves a database session into request context
[ "Handler", "Returns", "a", "middleware", "HandlerFunc", "that", "creates", "and", "saves", "a", "database", "session", "into", "request", "context" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/middlewares/mongodb/mongodb.go#L112-L120
137,385
sogko/slumber
server/router.go
NewRouter
func NewRouter(ctx domain.IContext, ac domain.IAccessController) *Router { router := mux.NewRouter().StrictSlash(true) return &Router{router, ac, ctx} }
go
func NewRouter(ctx domain.IContext, ac domain.IAccessController) *Router { router := mux.NewRouter().StrictSlash(true) return &Router{router, ac, ctx} }
[ "func", "NewRouter", "(", "ctx", "domain", ".", "IContext", ",", "ac", "domain", ".", "IAccessController", ")", "*", "Router", "{", "router", ":=", "mux", ".", "NewRouter", "(", ")", ".", "StrictSlash", "(", "true", ")", "\n\n", "return", "&", "Router", ...
// NewRouter Returns a new Router object
[ "NewRouter", "Returns", "a", "new", "Router", "object" ]
a85dc47e9331ec5d7e88b30612c053a1462bfc3f
https://github.com/sogko/slumber/blob/a85dc47e9331ec5d7e88b30612c053a1462bfc3f/server/router.go#L55-L59
137,386
go-playground/lars
context_17.go
WithContext
func (c *Ctx) WithContext(ctx context.Context) { c.request = c.request.WithContext(ctx) }
go
func (c *Ctx) WithContext(ctx context.Context) { c.request = c.request.WithContext(ctx) }
[ "func", "(", "c", "*", "Ctx", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "{", "c", ".", "request", "=", "c", ".", "request", ".", "WithContext", "(", "ctx", ")", "\n", "}" ]
// WithContext updates the underlying request's context with to ctx // The provided ctx must be non-nil.
[ "WithContext", "updates", "the", "underlying", "request", "s", "context", "with", "to", "ctx", "The", "provided", "ctx", "must", "be", "non", "-", "nil", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context_17.go#L110-L112
137,387
go-playground/lars
context_17.go
WithCancel
func (c *Ctx) WithCancel() context.CancelFunc { ctx, cf := context.WithCancel(c.request.Context()) c.request = c.request.WithContext(ctx) return cf }
go
func (c *Ctx) WithCancel() context.CancelFunc { ctx, cf := context.WithCancel(c.request.Context()) c.request = c.request.WithContext(ctx) return cf }
[ "func", "(", "c", "*", "Ctx", ")", "WithCancel", "(", ")", "context", ".", "CancelFunc", "{", "ctx", ",", "cf", ":=", "context", ".", "WithCancel", "(", "c", ".", "request", ".", "Context", "(", ")", ")", "\n", "c", ".", "request", "=", "c", ".",...
// WithCancel calls context.WithCancel and automatically // updates context on the containing lars.Ctx object.
[ "WithCancel", "calls", "context", ".", "WithCancel", "and", "automatically", "updates", "context", "on", "the", "containing", "lars", ".", "Ctx", "object", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context_17.go#L136-L140
137,388
go-playground/lars
context_17.go
WithDeadline
func (c *Ctx) WithDeadline(deadline time.Time) context.CancelFunc { ctx, cf := context.WithDeadline(c.request.Context(), deadline) c.request = c.request.WithContext(ctx) return cf }
go
func (c *Ctx) WithDeadline(deadline time.Time) context.CancelFunc { ctx, cf := context.WithDeadline(c.request.Context(), deadline) c.request = c.request.WithContext(ctx) return cf }
[ "func", "(", "c", "*", "Ctx", ")", "WithDeadline", "(", "deadline", "time", ".", "Time", ")", "context", ".", "CancelFunc", "{", "ctx", ",", "cf", ":=", "context", ".", "WithDeadline", "(", "c", ".", "request", ".", "Context", "(", ")", ",", "deadlin...
// WithDeadline calls context.WithDeadline and automatically // updates context on the containing lars.Ctx object.
[ "WithDeadline", "calls", "context", ".", "WithDeadline", "and", "automatically", "updates", "context", "on", "the", "containing", "lars", ".", "Ctx", "object", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context_17.go#L144-L148
137,389
go-playground/lars
context_17.go
WithTimeout
func (c *Ctx) WithTimeout(timeout time.Duration) context.CancelFunc { ctx, cf := context.WithTimeout(c.request.Context(), timeout) c.request = c.request.WithContext(ctx) // temporarily shallow copying to avoid problems with external libraries return cf }
go
func (c *Ctx) WithTimeout(timeout time.Duration) context.CancelFunc { ctx, cf := context.WithTimeout(c.request.Context(), timeout) c.request = c.request.WithContext(ctx) // temporarily shallow copying to avoid problems with external libraries return cf }
[ "func", "(", "c", "*", "Ctx", ")", "WithTimeout", "(", "timeout", "time", ".", "Duration", ")", "context", ".", "CancelFunc", "{", "ctx", ",", "cf", ":=", "context", ".", "WithTimeout", "(", "c", ".", "request", ".", "Context", "(", ")", ",", "timeou...
// WithTimeout calls context.WithTimeout and automatically // updates context on the containing lars.Ctx object.
[ "WithTimeout", "calls", "context", ".", "WithTimeout", "and", "automatically", "updates", "context", "on", "the", "containing", "lars", ".", "Ctx", "object", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context_17.go#L152-L156
137,390
go-playground/lars
context_16.go
RequestStart
func (c *Ctx) RequestStart(w http.ResponseWriter, r *http.Request) { c.request = r c.response.reset(w) c.params = c.params[0:0] c.queryParams = nil c.netContext = context.Background() // in go 1.7 will call r.Context(), netContext will go away and be replaced with the Request objects Context c.index = -1 c.handl...
go
func (c *Ctx) RequestStart(w http.ResponseWriter, r *http.Request) { c.request = r c.response.reset(w) c.params = c.params[0:0] c.queryParams = nil c.netContext = context.Background() // in go 1.7 will call r.Context(), netContext will go away and be replaced with the Request objects Context c.index = -1 c.handl...
[ "func", "(", "c", "*", "Ctx", ")", "RequestStart", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "c", ".", "request", "=", "r", "\n", "c", ".", "response", ".", "reset", "(", "w", ")", "\n", "c", ".",...
// RequestStart resets the Context to it's default request state
[ "RequestStart", "resets", "the", "Context", "to", "it", "s", "default", "request", "state" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/context_16.go#L72-L82
137,391
go-playground/lars
lars.go
New
func New() *LARS { l := &LARS{ routeGroup: routeGroup{ middleware: make(HandlersChain, 0), }, trees: make(map[string]*node), contextFunc: func(l *LARS) Context { return NewContext(l) }, mostParams: 0, http404: []HandlerFunc{default404Handler}, http405: ...
go
func New() *LARS { l := &LARS{ routeGroup: routeGroup{ middleware: make(HandlersChain, 0), }, trees: make(map[string]*node), contextFunc: func(l *LARS) Context { return NewContext(l) }, mostParams: 0, http404: []HandlerFunc{default404Handler}, http405: ...
[ "func", "New", "(", ")", "*", "LARS", "{", "l", ":=", "&", "LARS", "{", "routeGroup", ":", "routeGroup", "{", "middleware", ":", "make", "(", "HandlersChain", ",", "0", ")", ",", "}", ",", "trees", ":", "make", "(", "map", "[", "string", "]", "*"...
// New Creates and returns a new lars instance
[ "New", "Creates", "and", "returns", "a", "new", "lars", "instance" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/lars.go#L184-L213
137,392
go-playground/lars
lars.go
RegisterCustomHandler
func (l *LARS) RegisterCustomHandler(customType interface{}, fn CustomHandlerFunc) { if l.customHandlersFuncs == nil { l.customHandlersFuncs = make(customHandlers) } t := reflect.TypeOf(customType) if _, ok := l.customHandlersFuncs[t]; ok { panic(fmt.Sprint("Custom Type + CustomHandlerFunc already declared: ...
go
func (l *LARS) RegisterCustomHandler(customType interface{}, fn CustomHandlerFunc) { if l.customHandlersFuncs == nil { l.customHandlersFuncs = make(customHandlers) } t := reflect.TypeOf(customType) if _, ok := l.customHandlersFuncs[t]; ok { panic(fmt.Sprint("Custom Type + CustomHandlerFunc already declared: ...
[ "func", "(", "l", "*", "LARS", ")", "RegisterCustomHandler", "(", "customType", "interface", "{", "}", ",", "fn", "CustomHandlerFunc", ")", "{", "if", "l", ".", "customHandlersFuncs", "==", "nil", "{", "l", ".", "customHandlersFuncs", "=", "make", "(", "cu...
// RegisterCustomHandler registers a custom handler that gets wrapped by HandlerFunc
[ "RegisterCustomHandler", "registers", "a", "custom", "handler", "that", "gets", "wrapped", "by", "HandlerFunc" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/lars.go#L231-L244
137,393
go-playground/lars
lars.go
Serve
func (l *LARS) Serve() http.Handler { // reserved for any logic that needs to happen before serving starts. // i.e. although this router does not use priority to determine route order // could add sorting of tree nodes here.... l.notFound = make(HandlersChain, len(l.middleware)+len(l.http404)) copy(l.notFound, l...
go
func (l *LARS) Serve() http.Handler { // reserved for any logic that needs to happen before serving starts. // i.e. although this router does not use priority to determine route order // could add sorting of tree nodes here.... l.notFound = make(HandlersChain, len(l.middleware)+len(l.http404)) copy(l.notFound, l...
[ "func", "(", "l", "*", "LARS", ")", "Serve", "(", ")", "http", ".", "Handler", "{", "// reserved for any logic that needs to happen before serving starts.", "// i.e. although this router does not use priority to determine route order", "// could add sorting of tree nodes here....", "...
// Serve returns an http.Handler to be used.
[ "Serve", "returns", "an", "http", ".", "Handler", "to", "be", "used", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/lars.go#L286-L303
137,394
go-playground/lars
response.go
newResponse
func newResponse(w http.ResponseWriter, context Context) *Response { return &Response{ResponseWriter: w, context: context} }
go
func newResponse(w http.ResponseWriter, context Context) *Response { return &Response{ResponseWriter: w, context: context} }
[ "func", "newResponse", "(", "w", "http", ".", "ResponseWriter", ",", "context", "Context", ")", "*", "Response", "{", "return", "&", "Response", "{", "ResponseWriter", ":", "w", ",", "context", ":", "context", "}", "\n", "}" ]
// newResponse creates a new Response for testing purposes
[ "newResponse", "creates", "a", "new", "Response", "for", "testing", "purposes" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/response.go#L24-L26
137,395
go-playground/lars
response.go
WriteString
func (r *Response) WriteString(s string) (n int, err error) { n, err = io.WriteString(r.ResponseWriter, s) r.size += int64(n) return }
go
func (r *Response) WriteString(s string) (n int, err error) { n, err = io.WriteString(r.ResponseWriter, s) r.size += int64(n) return }
[ "func", "(", "r", "*", "Response", ")", "WriteString", "(", "s", "string", ")", "(", "n", "int", ",", "err", "error", ")", "{", "n", ",", "err", "=", "io", ".", "WriteString", "(", "r", ".", "ResponseWriter", ",", "s", ")", "\n", "r", ".", "siz...
// WriteString write string to ResponseWriter
[ "WriteString", "write", "string", "to", "ResponseWriter" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/response.go#L76-L80
137,396
go-playground/lars
group.go
Any
func (g *routeGroup) Any(path string, h ...Handler) { g.Connect(path, h...) g.Delete(path, h...) g.Get(path, h...) g.Head(path, h...) g.Options(path, h...) g.Patch(path, h...) g.Post(path, h...) g.Put(path, h...) g.Trace(path, h...) }
go
func (g *routeGroup) Any(path string, h ...Handler) { g.Connect(path, h...) g.Delete(path, h...) g.Get(path, h...) g.Head(path, h...) g.Options(path, h...) g.Patch(path, h...) g.Post(path, h...) g.Put(path, h...) g.Trace(path, h...) }
[ "func", "(", "g", "*", "routeGroup", ")", "Any", "(", "path", "string", ",", "h", "...", "Handler", ")", "{", "g", ".", "Connect", "(", "path", ",", "h", "...", ")", "\n", "g", ".", "Delete", "(", "path", ",", "h", "...", ")", "\n", "g", ".",...
// Any adds a route & handler to the router for all HTTP methods.
[ "Any", "adds", "a", "route", "&", "handler", "to", "the", "router", "for", "all", "HTTP", "methods", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/group.go#L143-L153
137,397
go-playground/lars
group.go
WebSocket
func (g *routeGroup) WebSocket(upgrader websocket.Upgrader, path string, h Handler) { handler := g.lars.wrapHandler(h) g.Get(path, func(c Context) { ctx := c.BaseContext() var err error ctx.websocket, err = upgrader.Upgrade(ctx.response, ctx.request, nil) if err != nil { return } defer ctx.websocke...
go
func (g *routeGroup) WebSocket(upgrader websocket.Upgrader, path string, h Handler) { handler := g.lars.wrapHandler(h) g.Get(path, func(c Context) { ctx := c.BaseContext() var err error ctx.websocket, err = upgrader.Upgrade(ctx.response, ctx.request, nil) if err != nil { return } defer ctx.websocke...
[ "func", "(", "g", "*", "routeGroup", ")", "WebSocket", "(", "upgrader", "websocket", ".", "Upgrader", ",", "path", "string", ",", "h", "Handler", ")", "{", "handler", ":=", "g", ".", "lars", ".", "wrapHandler", "(", "h", ")", "\n", "g", ".", "Get", ...
// WebSocket adds a websocket route
[ "WebSocket", "adds", "a", "websocket", "route" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/group.go#L163-L179
137,398
go-playground/lars
group.go
Group
func (g *routeGroup) Group(prefix string) IRouteGroup { rg := &routeGroup{ prefix: g.prefix + prefix, lars: g.lars, middleware: make(HandlersChain, len(g.middleware)), } copy(rg.middleware, g.middleware) return rg }
go
func (g *routeGroup) Group(prefix string) IRouteGroup { rg := &routeGroup{ prefix: g.prefix + prefix, lars: g.lars, middleware: make(HandlersChain, len(g.middleware)), } copy(rg.middleware, g.middleware) return rg }
[ "func", "(", "g", "*", "routeGroup", ")", "Group", "(", "prefix", "string", ")", "IRouteGroup", "{", "rg", ":=", "&", "routeGroup", "{", "prefix", ":", "g", ".", "prefix", "+", "prefix", ",", "lars", ":", "g", ".", "lars", ",", "middleware", ":", "...
// Group creates a new sub router with specified prefix and retains existing middleware.
[ "Group", "creates", "a", "new", "sub", "router", "with", "specified", "prefix", "and", "retains", "existing", "middleware", "." ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/group.go#L203-L211
137,399
go-playground/lars
util.go
wrapHandler
func (l *LARS) wrapHandler(h Handler) HandlerFunc { switch h := h.(type) { case HandlerFunc: return h case func(Context): return h case http.Handler, http.HandlerFunc: return func(c Context) { ctx := c.BaseContext() if h.(http.Handler).ServeHTTP(ctx.response, ctx.request); ctx.response.status != ht...
go
func (l *LARS) wrapHandler(h Handler) HandlerFunc { switch h := h.(type) { case HandlerFunc: return h case func(Context): return h case http.Handler, http.HandlerFunc: return func(c Context) { ctx := c.BaseContext() if h.(http.Handler).ServeHTTP(ctx.response, ctx.request); ctx.response.status != ht...
[ "func", "(", "l", "*", "LARS", ")", "wrapHandler", "(", "h", "Handler", ")", "HandlerFunc", "{", "switch", "h", ":=", "h", ".", "(", "type", ")", "{", "case", "HandlerFunc", ":", "return", "h", "\n\n", "case", "func", "(", "Context", ")", ":", "ret...
// wrapHandler wraps Handler type
[ "wrapHandler", "wraps", "Handler", "type" ]
4dc376e72ef7f96a295a328f06e83e2b9ab85422
https://github.com/go-playground/lars/blob/4dc376e72ef7f96a295a328f06e83e2b9ab85422/util.go#L41-L105