id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
140,200
control-center/serviced
coordinator/client/zookeeper/leader.go
ReleaseLead
func (l *Leader) ReleaseLead() error { if l.lockPath == "" { return ErrNotLocked } if err := l.c.Delete(l.lockPath, -1); err != nil { return xlateError(err) } l.lockPath = "" return nil }
go
func (l *Leader) ReleaseLead() error { if l.lockPath == "" { return ErrNotLocked } if err := l.c.Delete(l.lockPath, -1); err != nil { return xlateError(err) } l.lockPath = "" return nil }
[ "func", "(", "l", "*", "Leader", ")", "ReleaseLead", "(", ")", "error", "{", "if", "l", ".", "lockPath", "==", "\"", "\"", "{", "return", "ErrNotLocked", "\n", "}", "\n", "if", "err", ":=", "l", ".", "c", ".", "Delete", "(", "l", ".", "lockPath",...
// ReleaseLead release the current leader role. It will return ErrNotLocked if // the current object is not locked.
[ "ReleaseLead", "release", "the", "current", "leader", "role", ".", "It", "will", "return", "ErrNotLocked", "if", "the", "current", "object", "is", "not", "locked", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/leader.go#L144-L153
140,201
control-center/serviced
coordinator/client/zookeeper/leader.go
getLowestSequence
func (l *Leader) getLowestSequence() (string, uint64, error) { children, _, err := l.c.Children(l.path) if err != nil { return "", 0, xlateError(err) } var lowestSeq uint64 = math.MaxUint64 firstChild := "" for _, p := range children { s, err := parseSeq(p) if err != nil { return "", 0, xlateError(err) ...
go
func (l *Leader) getLowestSequence() (string, uint64, error) { children, _, err := l.c.Children(l.path) if err != nil { return "", 0, xlateError(err) } var lowestSeq uint64 = math.MaxUint64 firstChild := "" for _, p := range children { s, err := parseSeq(p) if err != nil { return "", 0, xlateError(err) ...
[ "func", "(", "l", "*", "Leader", ")", "getLowestSequence", "(", ")", "(", "string", ",", "uint64", ",", "error", ")", "{", "children", ",", "_", ",", "err", ":=", "l", ".", "c", ".", "Children", "(", "l", ".", "path", ")", "\n", "if", "err", "!...
// getLowestSequence returns the node in the path of the lowest sequence
[ "getLowestSequence", "returns", "the", "node", "in", "the", "path", "of", "the", "lowest", "sequence" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/leader.go#L161-L182
140,202
control-center/serviced
coordinator/client/zookeeper/leader.go
ensurePath
func (l *Leader) ensurePath(p string) error { dp := path.Dir(p) exists, _, err := l.c.Exists(dp) if err != nil && err != zklib.ErrNoNode { return xlateError(err) } if !exists { if err := l.ensurePath(dp); err != nil { return err } if _, err := l.c.Create(dp, []byte{}, 0, zklib.WorldACL(zklib.PermAll)); ...
go
func (l *Leader) ensurePath(p string) error { dp := path.Dir(p) exists, _, err := l.c.Exists(dp) if err != nil && err != zklib.ErrNoNode { return xlateError(err) } if !exists { if err := l.ensurePath(dp); err != nil { return err } if _, err := l.c.Create(dp, []byte{}, 0, zklib.WorldACL(zklib.PermAll)); ...
[ "func", "(", "l", "*", "Leader", ")", "ensurePath", "(", "p", "string", ")", "error", "{", "dp", ":=", "path", ".", "Dir", "(", "p", ")", "\n", "exists", ",", "_", ",", "err", ":=", "l", ".", "c", ".", "Exists", "(", "dp", ")", "\n", "if", ...
// ensurePath makes sure the dirpath leading to the node is available
[ "ensurePath", "makes", "sure", "the", "dirpath", "leading", "to", "the", "node", "is", "available" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/leader.go#L185-L200
140,203
control-center/serviced
coordinator/client/zookeeper/leader.go
GetLowestSequence
func GetLowestSequence(ch []string) (string, error) { var ( lowestSequence uint64 = math.MaxUint64 leader = "" ) for _, p := range ch { s, err := parseSeq(p) if err != nil { return "", err } if s < lowestSequence { lowestSequence, leader = s, p } } return leader, nil }
go
func GetLowestSequence(ch []string) (string, error) { var ( lowestSequence uint64 = math.MaxUint64 leader = "" ) for _, p := range ch { s, err := parseSeq(p) if err != nil { return "", err } if s < lowestSequence { lowestSequence, leader = s, p } } return leader, nil }
[ "func", "GetLowestSequence", "(", "ch", "[", "]", "string", ")", "(", "string", ",", "error", ")", "{", "var", "(", "lowestSequence", "uint64", "=", "math", ".", "MaxUint64", "\n", "leader", "=", "\"", "\"", "\n", ")", "\n\n", "for", "_", ",", "p", ...
// GetLowestSequence returns the lowest sequenced value ephemeral node from the // list.
[ "GetLowestSequence", "returns", "the", "lowest", "sequenced", "value", "ephemeral", "node", "from", "the", "list", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/coordinator/client/zookeeper/leader.go#L209-L225
140,204
control-center/serviced
node/utils.go
GetInterfaceIPAddress
func GetInterfaceIPAddress(_interface string) (string, error) { output, err := exec.Command("/sbin/ip", "-4", "-o", "addr").Output() if err != nil { return "", err } for _, line := range strings.Split(string(output), "\n") { fields := strings.Fields(line) if len(fields) < 4 { continue } if strings.Ha...
go
func GetInterfaceIPAddress(_interface string) (string, error) { output, err := exec.Command("/sbin/ip", "-4", "-o", "addr").Output() if err != nil { return "", err } for _, line := range strings.Split(string(output), "\n") { fields := strings.Fields(line) if len(fields) < 4 { continue } if strings.Ha...
[ "func", "GetInterfaceIPAddress", "(", "_interface", "string", ")", "(", "string", ",", "error", ")", "{", "output", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ".", "Output", "(...
// GetInterfaceIPAddress attempts to find the IP address based on interface name
[ "GetInterfaceIPAddress", "attempts", "to", "find", "the", "IP", "address", "based", "on", "interface", "name" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/utils.go#L52-L70
140,205
control-center/serviced
node/utils.go
ExecPath
func ExecPath() (string, string, error) { path, err := getExecPath() if err != nil { return "", "", err } return filepath.Dir(path), filepath.Base(path), nil }
go
func ExecPath() (string, string, error) { path, err := getExecPath() if err != nil { return "", "", err } return filepath.Dir(path), filepath.Base(path), nil }
[ "func", "ExecPath", "(", ")", "(", "string", ",", "string", ",", "error", ")", "{", "path", ",", "err", ":=", "getExecPath", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "ret...
// ExecPath returns the path to the currently running executable.
[ "ExecPath", "returns", "the", "path", "to", "the", "currently", "running", "executable", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/utils.go#L91-L97
140,206
control-center/serviced
node/utils.go
GetDockerVersion
func GetDockerVersion() ([]int, error) { dc, err := docker.NewClient() if err != nil { return nil, err } env, err := dc.Version() if err != nil { return nil, err } versionString := env.Get("Version") versionSplit := strings.Split(versionString, ".") version := make([]int, len(versionSplit)) for i, v := ra...
go
func GetDockerVersion() ([]int, error) { dc, err := docker.NewClient() if err != nil { return nil, err } env, err := dc.Version() if err != nil { return nil, err } versionString := env.Get("Version") versionSplit := strings.Split(versionString, ".") version := make([]int, len(versionSplit)) for i, v := ra...
[ "func", "GetDockerVersion", "(", ")", "(", "[", "]", "int", ",", "error", ")", "{", "dc", ",", "err", ":=", "docker", ".", "NewClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "env", ",", "er...
// GetDockerVersion returns docker version number.
[ "GetDockerVersion", "returns", "docker", "version", "number", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/utils.go#L100-L120
140,207
control-center/serviced
node/utils.go
CreateDirectory
func CreateDirectory(path, username string, perm os.FileMode) error { user, err := user.Lookup(username) if err == nil { err = os.MkdirAll(path, perm) if err == nil || err == os.ErrExist { uid, _ := strconv.Atoi(user.Uid) gid, _ := strconv.Atoi(user.Gid) err = os.Chown(path, uid, gid) } } return err ...
go
func CreateDirectory(path, username string, perm os.FileMode) error { user, err := user.Lookup(username) if err == nil { err = os.MkdirAll(path, perm) if err == nil || err == os.ErrExist { uid, _ := strconv.Atoi(user.Uid) gid, _ := strconv.Atoi(user.Gid) err = os.Chown(path, uid, gid) } } return err ...
[ "func", "CreateDirectory", "(", "path", ",", "username", "string", ",", "perm", "os", ".", "FileMode", ")", "error", "{", "user", ",", "err", ":=", "user", ".", "Lookup", "(", "username", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "os", ...
// CreateDirectory creates a directory using the given username as the owner and the // given perm as the directory permission.
[ "CreateDirectory", "creates", "a", "directory", "using", "the", "given", "username", "as", "the", "owner", "and", "the", "given", "perm", "as", "the", "directory", "permission", "." ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/utils.go#L124-L135
140,208
control-center/serviced
node/utils.go
AddToEtcHosts
func AddToEtcHosts(host, ip string) error { // First make sure /etc/hosts is writeable command := []string{ "/bin/bash", "-c", fmt.Sprintf(` if [ -n "$(mount | grep /etc/hosts)" ]; then \ cat /etc/hosts > /tmp/etchosts; \ umount /etc/hosts; \ mv /tmp/etchosts /etc/hosts; \ fi; \ echo "%s %s" >> /etc/hosts`, ip, ...
go
func AddToEtcHosts(host, ip string) error { // First make sure /etc/hosts is writeable command := []string{ "/bin/bash", "-c", fmt.Sprintf(` if [ -n "$(mount | grep /etc/hosts)" ]; then \ cat /etc/hosts > /tmp/etchosts; \ umount /etc/hosts; \ mv /tmp/etchosts /etc/hosts; \ fi; \ echo "%s %s" >> /etc/hosts`, ip, ...
[ "func", "AddToEtcHosts", "(", "host", ",", "ip", "string", ")", "error", "{", "// First make sure /etc/hosts is writeable", "command", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "`\nif [ -n \"$(mount | grep /etc/...
// In the container
[ "In", "the", "container" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/node/utils.go#L345-L356
140,209
control-center/serviced
rpc/master/hosts_client.go
GetHost
func (c *Client) GetHost(hostID string) (*host.Host, error) { response := host.New() if err := c.call("GetHost", hostID, response); err != nil { return nil, err } return response, nil }
go
func (c *Client) GetHost(hostID string) (*host.Host, error) { response := host.New() if err := c.call("GetHost", hostID, response); err != nil { return nil, err } return response, nil }
[ "func", "(", "c", "*", "Client", ")", "GetHost", "(", "hostID", "string", ")", "(", "*", "host", ".", "Host", ",", "error", ")", "{", "response", ":=", "host", ".", "New", "(", ")", "\n", "if", "err", ":=", "c", ".", "call", "(", "\"", "\"", ...
//GetHost gets the host for the given hostID or nil
[ "GetHost", "gets", "the", "host", "for", "the", "given", "hostID", "or", "nil" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L24-L30
140,210
control-center/serviced
rpc/master/hosts_client.go
GetHosts
func (c *Client) GetHosts() ([]host.Host, error) { response := make([]host.Host, 0) if err := c.call("GetHosts", empty, &response); err != nil { return []host.Host{}, err } return response, nil }
go
func (c *Client) GetHosts() ([]host.Host, error) { response := make([]host.Host, 0) if err := c.call("GetHosts", empty, &response); err != nil { return []host.Host{}, err } return response, nil }
[ "func", "(", "c", "*", "Client", ")", "GetHosts", "(", ")", "(", "[", "]", "host", ".", "Host", ",", "error", ")", "{", "response", ":=", "make", "(", "[", "]", "host", ".", "Host", ",", "0", ")", "\n", "if", "err", ":=", "c", ".", "call", ...
//GetHosts returns all hosts or empty array
[ "GetHosts", "returns", "all", "hosts", "or", "empty", "array" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L33-L39
140,211
control-center/serviced
rpc/master/hosts_client.go
GetActiveHostIDs
func (c *Client) GetActiveHostIDs() ([]string, error) { response := []string{} if err := c.call("GetActiveHostIDs", empty, &response); err != nil { return []string{}, err } return response, nil }
go
func (c *Client) GetActiveHostIDs() ([]string, error) { response := []string{} if err := c.call("GetActiveHostIDs", empty, &response); err != nil { return []string{}, err } return response, nil }
[ "func", "(", "c", "*", "Client", ")", "GetActiveHostIDs", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "response", ":=", "[", "]", "string", "{", "}", "\n", "if", "err", ":=", "c", ".", "call", "(", "\"", "\"", ",", "empty", ",", ...
//GetActiveHosts returns all active host ids or empty array
[ "GetActiveHosts", "returns", "all", "active", "host", "ids", "or", "empty", "array" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L42-L48
140,212
control-center/serviced
rpc/master/hosts_client.go
AddHost
func (c *Client) AddHost(host host.Host) ([]byte, error) { response := []byte{} if err := c.call("AddHost", host, &response); err != nil { return []byte{}, err } return response, nil }
go
func (c *Client) AddHost(host host.Host) ([]byte, error) { response := []byte{} if err := c.call("AddHost", host, &response); err != nil { return []byte{}, err } return response, nil }
[ "func", "(", "c", "*", "Client", ")", "AddHost", "(", "host", "host", ".", "Host", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "response", ":=", "[", "]", "byte", "{", "}", "\n", "if", "err", ":=", "c", ".", "call", "(", "\"", "\"", ...
//AddHost adds a Host
[ "AddHost", "adds", "a", "Host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L51-L57
140,213
control-center/serviced
rpc/master/hosts_client.go
UpdateHost
func (c *Client) UpdateHost(host host.Host) error { return c.call("UpdateHost", host, nil) }
go
func (c *Client) UpdateHost(host host.Host) error { return c.call("UpdateHost", host, nil) }
[ "func", "(", "c", "*", "Client", ")", "UpdateHost", "(", "host", "host", ".", "Host", ")", "error", "{", "return", "c", ".", "call", "(", "\"", "\"", ",", "host", ",", "nil", ")", "\n", "}" ]
//UpdateHost updates a host
[ "UpdateHost", "updates", "a", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L69-L71
140,214
control-center/serviced
rpc/master/hosts_client.go
RemoveHost
func (c *Client) RemoveHost(hostID string) error { return c.call("RemoveHost", hostID, nil) }
go
func (c *Client) RemoveHost(hostID string) error { return c.call("RemoveHost", hostID, nil) }
[ "func", "(", "c", "*", "Client", ")", "RemoveHost", "(", "hostID", "string", ")", "error", "{", "return", "c", ".", "call", "(", "\"", "\"", ",", "hostID", ",", "nil", ")", "\n", "}" ]
//RemoveHost removes a host
[ "RemoveHost", "removes", "a", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L74-L76
140,215
control-center/serviced
rpc/master/hosts_client.go
FindHostsInPool
func (c *Client) FindHostsInPool(poolID string) ([]host.Host, error) { response := make([]host.Host, 0) if err := c.call("FindHostsInPool", poolID, &response); err != nil { return []host.Host{}, err } return response, nil }
go
func (c *Client) FindHostsInPool(poolID string) ([]host.Host, error) { response := make([]host.Host, 0) if err := c.call("FindHostsInPool", poolID, &response); err != nil { return []host.Host{}, err } return response, nil }
[ "func", "(", "c", "*", "Client", ")", "FindHostsInPool", "(", "poolID", "string", ")", "(", "[", "]", "host", ".", "Host", ",", "error", ")", "{", "response", ":=", "make", "(", "[", "]", "host", ".", "Host", ",", "0", ")", "\n", "if", "err", "...
//FindHostsInPool returns all hosts in a pool
[ "FindHostsInPool", "returns", "all", "hosts", "in", "a", "pool" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L79-L85
140,216
control-center/serviced
rpc/master/hosts_client.go
AuthenticateHost
func (c *Client) AuthenticateHost(hostID string) (string, int64, error) { req := HostAuthenticationRequest{ HostID: hostID, Timestamp: time.Now().UTC().Unix(), } sig, err := auth.SignAsDelegate(req.toMessage()) if err != nil { return "", 0, err } req.Signature = sig var response HostAuthenticationRespon...
go
func (c *Client) AuthenticateHost(hostID string) (string, int64, error) { req := HostAuthenticationRequest{ HostID: hostID, Timestamp: time.Now().UTC().Unix(), } sig, err := auth.SignAsDelegate(req.toMessage()) if err != nil { return "", 0, err } req.Signature = sig var response HostAuthenticationRespon...
[ "func", "(", "c", "*", "Client", ")", "AuthenticateHost", "(", "hostID", "string", ")", "(", "string", ",", "int64", ",", "error", ")", "{", "req", ":=", "HostAuthenticationRequest", "{", "HostID", ":", "hostID", ",", "Timestamp", ":", "time", ".", "Now"...
// AuthenticateHost authenticates a host
[ "AuthenticateHost", "authenticates", "a", "host" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/rpc/master/hosts_client.go#L88-L103
140,217
control-center/serviced
utils/tls.go
GetDefaultCiphers
func GetDefaultCiphers(connectionType string) []string { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.defaultCiphers }
go
func GetDefaultCiphers(connectionType string) []string { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.defaultCiphers }
[ "func", "GetDefaultCiphers", "(", "connectionType", "string", ")", "[", "]", "string", "{", "configInfo", ",", "ok", ":=", "configMap", "[", "connectionType", "]", "\n", "if", "!", "ok", "{", "glog", ".", "Fatalf", "(", "\"", "\"", ",", "connectionType", ...
// GetDefaultCiphers returns the default tls ciphers
[ "GetDefaultCiphers", "returns", "the", "default", "tls", "ciphers" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L134-L140
140,218
control-center/serviced
utils/tls.go
SetCiphers
func SetCiphers(connectionType string, cipherNames []string) error { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } newCiphers := make([]uint16, 0, len(cipherNames)) for _, cipherName := range cipherNames { upperCipher := strings.ToUpper(st...
go
func SetCiphers(connectionType string, cipherNames []string) error { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } newCiphers := make([]uint16, 0, len(cipherNames)) for _, cipherName := range cipherNames { upperCipher := strings.ToUpper(st...
[ "func", "SetCiphers", "(", "connectionType", "string", ",", "cipherNames", "[", "]", "string", ")", "error", "{", "configInfo", ",", "ok", ":=", "configMap", "[", "connectionType", "]", "\n", "if", "!", "ok", "{", "glog", ".", "Fatalf", "(", "\"", "\"", ...
// SetCiphers that can be used
[ "SetCiphers", "that", "can", "be", "used" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L143-L163
140,219
control-center/serviced
utils/tls.go
SetMinTLS
func SetMinTLS(connectionType string, version string) error { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } tlsVersion, err := tlsVersionStringToUint(version) if err != nil { return fmt.Errorf("Invalid TLS version %s", version) } config...
go
func SetMinTLS(connectionType string, version string) error { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } tlsVersion, err := tlsVersionStringToUint(version) if err != nil { return fmt.Errorf("Invalid TLS version %s", version) } config...
[ "func", "SetMinTLS", "(", "connectionType", "string", ",", "version", "string", ")", "error", "{", "configInfo", ",", "ok", ":=", "configMap", "[", "connectionType", "]", "\n", "if", "!", "ok", "{", "glog", ".", "Fatalf", "(", "\"", "\"", ",", "connectio...
// SetMinTLS the min tls that can be used
[ "SetMinTLS", "the", "min", "tls", "that", "can", "be", "used" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L166-L179
140,220
control-center/serviced
utils/tls.go
MinTLS
func MinTLS(connectionType string) uint16 { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.minTLSVersion }
go
func MinTLS(connectionType string) uint16 { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.minTLSVersion }
[ "func", "MinTLS", "(", "connectionType", "string", ")", "uint16", "{", "configInfo", ",", "ok", ":=", "configMap", "[", "connectionType", "]", "\n", "if", "!", "ok", "{", "glog", ".", "Fatalf", "(", "\"", "\"", ",", "connectionType", ")", "\n", "}", "\...
// MinTLS the min tls version that can be used for a given connection type
[ "MinTLS", "the", "min", "tls", "version", "that", "can", "be", "used", "for", "a", "given", "connection", "type" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L196-L202
140,221
control-center/serviced
utils/tls.go
CipherSuites
func CipherSuites(connectionType string) []uint16 { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.cipherSuite }
go
func CipherSuites(connectionType string) []uint16 { configInfo, ok := configMap[connectionType] if !ok { glog.Fatalf("connectionType %s is undefined", connectionType) } return configInfo.cipherSuite }
[ "func", "CipherSuites", "(", "connectionType", "string", ")", "[", "]", "uint16", "{", "configInfo", ",", "ok", ":=", "configMap", "[", "connectionType", "]", "\n", "if", "!", "ok", "{", "glog", ".", "Fatalf", "(", "\"", "\"", ",", "connectionType", ")",...
// CipherSuites the ciphers that can be sued
[ "CipherSuites", "the", "ciphers", "that", "can", "be", "sued" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L205-L211
140,222
control-center/serviced
utils/tls.go
GetCipherName
func GetCipherName(cipher uint16) string { for key, value := range cipherLookup { if cipher == value { return key } } return "unsupported" }
go
func GetCipherName(cipher uint16) string { for key, value := range cipherLookup { if cipher == value { return key } } return "unsupported" }
[ "func", "GetCipherName", "(", "cipher", "uint16", ")", "string", "{", "for", "key", ",", "value", ":=", "range", "cipherLookup", "{", "if", "cipher", "==", "value", "{", "return", "key", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
// Get the name of the cipher
[ "Get", "the", "name", "of", "the", "cipher" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/utils/tls.go#L222-L229
140,223
control-center/serviced
facade/lock.go
getTenantLock
func getTenantLock(tenantID string) (mutex *sync.RWMutex) { tlock.Lock() mutex, ok := tlock.tenants[tenantID] if !ok { tlock.tenants[tenantID] = &sync.RWMutex{} mutex = tlock.tenants[tenantID] } tlock.Unlock() return }
go
func getTenantLock(tenantID string) (mutex *sync.RWMutex) { tlock.Lock() mutex, ok := tlock.tenants[tenantID] if !ok { tlock.tenants[tenantID] = &sync.RWMutex{} mutex = tlock.tenants[tenantID] } tlock.Unlock() return }
[ "func", "getTenantLock", "(", "tenantID", "string", ")", "(", "mutex", "*", "sync", ".", "RWMutex", ")", "{", "tlock", ".", "Lock", "(", ")", "\n", "mutex", ",", "ok", ":=", "tlock", ".", "tenants", "[", "tenantID", "]", "\n", "if", "!", "ok", "{",...
// getTenantLock returns the locker for a given tenant
[ "getTenantLock", "returns", "the", "locker", "for", "a", "given", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/lock.go#L36-L45
140,224
control-center/serviced
facade/lock.go
lockTenant
func (f *Facade) lockTenant(ctx datastore.Context, tenantID string) (err error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.lockTenant")) mutex := getTenantLock(tenantID) mutex.Lock() defer func() { if err != nil { mutex.Unlock() } }() // Wait for current processing by the service state manage...
go
func (f *Facade) lockTenant(ctx datastore.Context, tenantID string) (err error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.lockTenant")) mutex := getTenantLock(tenantID) mutex.Lock() defer func() { if err != nil { mutex.Unlock() } }() // Wait for current processing by the service state manage...
[ "func", "(", "f", "*", "Facade", ")", "lockTenant", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", "string", ")", "(", "err", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")",...
// lockTenant sets the write lock for a given tenant and locks all services for // that tenant
[ "lockTenant", "sets", "the", "write", "lock", "for", "a", "given", "tenant", "and", "locks", "all", "services", "for", "that", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/lock.go#L49-L74
140,225
control-center/serviced
facade/lock.go
unlockTenant
func (f *Facade) unlockTenant(ctx datastore.Context, tenantID string) (err error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.unlockTenant")) mutex := getTenantLock(tenantID) var svcs []service.ServiceDetails if svcs, err = f.GetServiceDetailsByTenantID(ctx, tenantID); err != nil { glog.Errorf("Could n...
go
func (f *Facade) unlockTenant(ctx datastore.Context, tenantID string) (err error) { defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.unlockTenant")) mutex := getTenantLock(tenantID) var svcs []service.ServiceDetails if svcs, err = f.GetServiceDetailsByTenantID(ctx, tenantID); err != nil { glog.Errorf("Could n...
[ "func", "(", "f", "*", "Facade", ")", "unlockTenant", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", "string", ")", "(", "err", "error", ")", "{", "defer", "ctx", ".", "Metrics", "(", ")", ".", "Stop", "(", "ctx", ".", "Metrics", "(", ")...
// unlockTenant unsets the write lock for a given tenant and unlocks all // services for that tenant
[ "unlockTenant", "unsets", "the", "write", "lock", "for", "a", "given", "tenant", "and", "unlocks", "all", "services", "for", "that", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/lock.go#L78-L92
140,226
control-center/serviced
facade/lock.go
retryUnlockTenant
func (f *Facade) retryUnlockTenant(ctx datastore.Context, tenantID string, cancel <-chan time.Time, interval time.Duration) error { for { if err := f.unlockTenant(ctx, tenantID); err == nil { return nil } glog.Warningf("Could not unlock, retrying in %s", interval) select { case <-time.After(interval): c...
go
func (f *Facade) retryUnlockTenant(ctx datastore.Context, tenantID string, cancel <-chan time.Time, interval time.Duration) error { for { if err := f.unlockTenant(ctx, tenantID); err == nil { return nil } glog.Warningf("Could not unlock, retrying in %s", interval) select { case <-time.After(interval): c...
[ "func", "(", "f", "*", "Facade", ")", "retryUnlockTenant", "(", "ctx", "datastore", ".", "Context", ",", "tenantID", "string", ",", "cancel", "<-", "chan", "time", ".", "Time", ",", "interval", "time", ".", "Duration", ")", "error", "{", "for", "{", "i...
// retryUnlockTenant is a persistent unlock for a given tenant
[ "retryUnlockTenant", "is", "a", "persistent", "unlock", "for", "a", "given", "tenant" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/facade/lock.go#L95-L107
140,227
control-center/serviced
cli/cmd/debug.go
initDebug
func (c *ServicedCli) initDebug() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "debug", Usage: "manage debugging", Description: "", Subcommands: []cli.Command{ { Name: "enable-metrics", Usage: "Enable debug metrics", Description: "serviced debug enabl...
go
func (c *ServicedCli) initDebug() { c.app.Commands = append(c.app.Commands, cli.Command{ Name: "debug", Usage: "manage debugging", Description: "", Subcommands: []cli.Command{ { Name: "enable-metrics", Usage: "Enable debug metrics", Description: "serviced debug enabl...
[ "func", "(", "c", "*", "ServicedCli", ")", "initDebug", "(", ")", "{", "c", ".", "app", ".", "Commands", "=", "append", "(", "c", ".", "app", ".", "Commands", ",", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "\...
// Initializer for serviced debug
[ "Initializer", "for", "serviced", "debug" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/debug.go#L22-L41
140,228
control-center/serviced
cli/cmd/debug.go
cmdEnableDebugMetrics
func (c *ServicedCli) cmdEnableDebugMetrics(ctx *cli.Context) error { message, err := c.driver.DebugEnableMetrics() if err != nil { return fmt.Errorf("could not enable debug metrics: %s", err) } return fmt.Errorf(message) }
go
func (c *ServicedCli) cmdEnableDebugMetrics(ctx *cli.Context) error { message, err := c.driver.DebugEnableMetrics() if err != nil { return fmt.Errorf("could not enable debug metrics: %s", err) } return fmt.Errorf(message) }
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdEnableDebugMetrics", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "message", ",", "err", ":=", "c", ".", "driver", ".", "DebugEnableMetrics", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// serviced debug enable-metrics
[ "serviced", "debug", "enable", "-", "metrics" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/debug.go#L44-L50
140,229
control-center/serviced
cli/cmd/debug.go
cmdDisableDebugMetrics
func (c *ServicedCli) cmdDisableDebugMetrics(ctx *cli.Context) error { message, err := c.driver.DebugDisableMetrics() if err != nil { return fmt.Errorf("could not disable debug metrics: %s", err) } return fmt.Errorf(message) }
go
func (c *ServicedCli) cmdDisableDebugMetrics(ctx *cli.Context) error { message, err := c.driver.DebugDisableMetrics() if err != nil { return fmt.Errorf("could not disable debug metrics: %s", err) } return fmt.Errorf(message) }
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdDisableDebugMetrics", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "message", ",", "err", ":=", "c", ".", "driver", ".", "DebugDisableMetrics", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// serviced debug disable-metrics
[ "serviced", "debug", "disable", "-", "metrics" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/debug.go#L53-L59
140,230
control-center/serviced
cli/cmd/backup.go
initBackup
func (c *ServicedCli) initBackup() { c.app.Commands = append( c.app.Commands, cli.Command{ Name: "backup", Usage: "Dump all templates and services to a tgz file", Description: "serviced backup DIRPATH", Action: c.cmdBackup, Flags: []cli.Flag{ cli.StringSliceFlag{ Name: "e...
go
func (c *ServicedCli) initBackup() { c.app.Commands = append( c.app.Commands, cli.Command{ Name: "backup", Usage: "Dump all templates and services to a tgz file", Description: "serviced backup DIRPATH", Action: c.cmdBackup, Flags: []cli.Flag{ cli.StringSliceFlag{ Name: "e...
[ "func", "(", "c", "*", "ServicedCli", ")", "initBackup", "(", ")", "{", "c", ".", "app", ".", "Commands", "=", "append", "(", "c", ".", "app", ".", "Commands", ",", "cli", ".", "Command", "{", "Name", ":", "\"", "\"", ",", "Usage", ":", "\"", "...
// Initializer for serviced backup and serviced restore
[ "Initializer", "for", "serviced", "backup", "and", "serviced", "restore" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/backup.go#L24-L55
140,231
control-center/serviced
cli/cmd/backup.go
cmdBackup
func (c *ServicedCli) cmdBackup(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "backup") c.exit(1) return } if ctx.Bool("check") { fmt.Printf("Checking for space...\n") if backupSpace, err := c.driver.GetBackupEstimate(args[0], ctx....
go
func (c *ServicedCli) cmdBackup(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "backup") c.exit(1) return } if ctx.Bool("check") { fmt.Printf("Checking for space...\n") if backupSpace, err := c.driver.GetBackupEstimate(args[0], ctx....
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdBackup", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "\\n", ...
// serviced backup DIRPATH
[ "serviced", "backup", "DIRPATH" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/backup.go#L58-L95
140,232
control-center/serviced
cli/cmd/backup.go
cmdRestore
func (c *ServicedCli) cmdRestore(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "restore") return } err := c.driver.Restore(args[0]) if err != nil { fmt.Fprintln(os.Stderr, err) } }
go
func (c *ServicedCli) cmdRestore(ctx *cli.Context) { args := ctx.Args() if len(args) < 1 { fmt.Printf("Incorrect Usage.\n\n") cli.ShowCommandHelp(ctx, "restore") return } err := c.driver.Restore(args[0]) if err != nil { fmt.Fprintln(os.Stderr, err) } }
[ "func", "(", "c", "*", "ServicedCli", ")", "cmdRestore", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "len", "(", "args", ")", "<", "1", "{", "fmt", ".", "Printf", "(", "\"", "\\n", ...
// serviced restore FILEPATH
[ "serviced", "restore", "FILEPATH" ]
7028f598e6a224b4d421e09cb9b582ad7d000304
https://github.com/control-center/serviced/blob/7028f598e6a224b4d421e09cb9b582ad7d000304/cli/cmd/backup.go#L98-L110
140,233
Azure/go-ntlmssp
authenticate_message.go
ProcessChallenge
func ProcessChallenge(challengeMessageData []byte, user, password string) ([]byte, error) { if user == "" && password == "" { return nil, errors.New("Anonymous authentication not supported") } var cm challengeMessage if err := cm.UnmarshalBinary(challengeMessageData); err != nil { return nil, err } if cm.Ne...
go
func ProcessChallenge(challengeMessageData []byte, user, password string) ([]byte, error) { if user == "" && password == "" { return nil, errors.New("Anonymous authentication not supported") } var cm challengeMessage if err := cm.UnmarshalBinary(challengeMessageData); err != nil { return nil, err } if cm.Ne...
[ "func", "ProcessChallenge", "(", "challengeMessageData", "[", "]", "byte", ",", "user", ",", "password", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "user", "==", "\"", "\"", "&&", "password", "==", "\"", "\"", "{", "return", ...
//ProcessChallenge crafts an AUTHENTICATE message in response to the CHALLENGE message //that was received from the server
[ "ProcessChallenge", "crafts", "an", "AUTHENTICATE", "message", "in", "response", "to", "the", "CHALLENGE", "message", "that", "was", "received", "from", "the", "server" ]
4a21cbd618b459155f8b8ee7f4491cd54f5efa77
https://github.com/Azure/go-ntlmssp/blob/4a21cbd618b459155f8b8ee7f4491cd54f5efa77/authenticate_message.go#L83-L128
140,234
Azure/go-ntlmssp
negotiate_message.go
NewNegotiateMessage
func NewNegotiateMessage(domainName, workstationName string) ([]byte, error) { payloadOffset := expMsgBodyLen flags := defaultFlags if domainName != "" { flags |= negotiateFlagNTLMSSPNEGOTIATEOEMDOMAINSUPPLIED } if workstationName != "" { flags |= negotiateFlagNTLMSSPNEGOTIATEOEMWORKSTATIONSUPPLIED } msg ...
go
func NewNegotiateMessage(domainName, workstationName string) ([]byte, error) { payloadOffset := expMsgBodyLen flags := defaultFlags if domainName != "" { flags |= negotiateFlagNTLMSSPNEGOTIATEOEMDOMAINSUPPLIED } if workstationName != "" { flags |= negotiateFlagNTLMSSPNEGOTIATEOEMWORKSTATIONSUPPLIED } msg ...
[ "func", "NewNegotiateMessage", "(", "domainName", ",", "workstationName", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "payloadOffset", ":=", "expMsgBodyLen", "\n", "flags", ":=", "defaultFlags", "\n\n", "if", "domainName", "!=", "\"", "\"", ...
//NewNegotiateMessage creates a new NEGOTIATE message with the //flags that this package supports.
[ "NewNegotiateMessage", "creates", "a", "new", "NEGOTIATE", "message", "with", "the", "flags", "that", "this", "package", "supports", "." ]
4a21cbd618b459155f8b8ee7f4491cd54f5efa77
https://github.com/Azure/go-ntlmssp/blob/4a21cbd618b459155f8b8ee7f4491cd54f5efa77/negotiate_message.go#L30-L64
140,235
octokit/go-octokit
octokit/error.go
Error
func (e *ErrorObject) Error() string { err := fmt.Sprintf("%v error", e.Code) if e.Field != "" { err = fmt.Sprintf("%v caused by %v field", err, e.Field) } err = fmt.Sprintf("%v on %v resource", err, e.Resource) if e.Message != "" { err = fmt.Sprintf("%v: %v", err, e.Message) } return err }
go
func (e *ErrorObject) Error() string { err := fmt.Sprintf("%v error", e.Code) if e.Field != "" { err = fmt.Sprintf("%v caused by %v field", err, e.Field) } err = fmt.Sprintf("%v on %v resource", err, e.Resource) if e.Message != "" { err = fmt.Sprintf("%v: %v", err, e.Message) } return err }
[ "func", "(", "e", "*", "ErrorObject", ")", "Error", "(", ")", "string", "{", "err", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Code", ")", "\n", "if", "e", ".", "Field", "!=", "\"", "\"", "{", "err", "=", "fmt", ".", "Sprin...
// Error produces a human readable string representation of a given ErrorObject
[ "Error", "produces", "a", "human", "readable", "string", "representation", "of", "a", "given", "ErrorObject" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/error.go#L45-L56
140,236
octokit/go-octokit
octokit/error.go
Error
func (e *ResponseError) Error() string { return fmt.Sprintf("%v %v: %d - %s", e.Response.Request.Method, e.Response.Request.URL, e.Response.StatusCode, e.errorMessage()) }
go
func (e *ResponseError) Error() string { return fmt.Sprintf("%v %v: %d - %s", e.Response.Request.Method, e.Response.Request.URL, e.Response.StatusCode, e.errorMessage()) }
[ "func", "(", "e", "*", "ResponseError", ")", "Error", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "Response", ".", "Request", ".", "Method", ",", "e", ".", "Response", ".", "Request", ".", "URL", ",", ...
// Error produces a human readable string representation of a given ResponseError
[ "Error", "produces", "a", "human", "readable", "string", "representation", "of", "a", "given", "ResponseError" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/error.go#L69-L73
140,237
octokit/go-octokit
octokit/error.go
NewResponseError
func NewResponseError(resp *sawyer.Response) (err *ResponseError) { err = &ResponseError{} e := resp.Decode(&err) if e != nil { err.Message = fmt.Sprintf("Problems parsing error message: %s", e) } err.Response = resp.Response err.Type = getResponseErrorType(err) return }
go
func NewResponseError(resp *sawyer.Response) (err *ResponseError) { err = &ResponseError{} e := resp.Decode(&err) if e != nil { err.Message = fmt.Sprintf("Problems parsing error message: %s", e) } err.Response = resp.Response err.Type = getResponseErrorType(err) return }
[ "func", "NewResponseError", "(", "resp", "*", "sawyer", ".", "Response", ")", "(", "err", "*", "ResponseError", ")", "{", "err", "=", "&", "ResponseError", "{", "}", "\n\n", "e", ":=", "resp", ".", "Decode", "(", "&", "err", ")", "\n", "if", "e", "...
// NewResponseError creates a ResponseError from a given sawyer response that had // been produced along with an error.
[ "NewResponseError", "creates", "a", "ResponseError", "from", "a", "given", "sawyer", "response", "that", "had", "been", "produced", "along", "with", "an", "error", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/error.go#L105-L116
140,238
octokit/go-octokit
octokit/teams.go
One
func (t *TeamsService) One(uri *Hyperlink, uriParams M) ( team Team, result *Result) { url, err := ExpandWithDefault(uri, &TeamURL, uriParams) if err != nil { return Team{}, &Result{Err: err} } result = t.client.get(url, &team) return }
go
func (t *TeamsService) One(uri *Hyperlink, uriParams M) ( team Team, result *Result) { url, err := ExpandWithDefault(uri, &TeamURL, uriParams) if err != nil { return Team{}, &Result{Err: err} } result = t.client.get(url, &team) return }
[ "func", "(", "t", "*", "TeamsService", ")", "One", "(", "uri", "*", "Hyperlink", ",", "uriParams", "M", ")", "(", "team", "Team", ",", "result", "*", "Result", ")", "{", "url", ",", "err", ":=", "ExpandWithDefault", "(", "uri", ",", "&", "TeamURL", ...
// One returns a single Team for a given URL.
[ "One", "returns", "a", "single", "Team", "for", "a", "given", "URL", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/teams.go#L40-L48
140,239
octokit/go-octokit
octokit/teams.go
All
func (t *TeamsService) All(uri *Hyperlink, uriParams M) ( teams []Team, result *Result) { url, err := ExpandWithDefault(uri, &OrganizationTeamsURL, uriParams) if err != nil { return []Team(nil), &Result{Err: err} } result = t.client.get(url, &teams) return }
go
func (t *TeamsService) All(uri *Hyperlink, uriParams M) ( teams []Team, result *Result) { url, err := ExpandWithDefault(uri, &OrganizationTeamsURL, uriParams) if err != nil { return []Team(nil), &Result{Err: err} } result = t.client.get(url, &teams) return }
[ "func", "(", "t", "*", "TeamsService", ")", "All", "(", "uri", "*", "Hyperlink", ",", "uriParams", "M", ")", "(", "teams", "[", "]", "Team", ",", "result", "*", "Result", ")", "{", "url", ",", "err", ":=", "ExpandWithDefault", "(", "uri", ",", "&",...
// All returns a slice of Teams for a given URL.
[ "All", "returns", "a", "slice", "of", "Teams", "for", "a", "given", "URL", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/teams.go#L51-L59
140,240
octokit/go-octokit
octokit/hyperlink.go
Expand
func (l Hyperlink) Expand(m M) (u *url.URL, err error) { sawyerHyperlink := hypermedia.Hyperlink(string(l)) u, err = sawyerHyperlink.Expand(hypermedia.M(m)) return }
go
func (l Hyperlink) Expand(m M) (u *url.URL, err error) { sawyerHyperlink := hypermedia.Hyperlink(string(l)) u, err = sawyerHyperlink.Expand(hypermedia.M(m)) return }
[ "func", "(", "l", "Hyperlink", ")", "Expand", "(", "m", "M", ")", "(", "u", "*", "url", ".", "URL", ",", "err", "error", ")", "{", "sawyerHyperlink", ":=", "hypermedia", ".", "Hyperlink", "(", "string", "(", "l", ")", ")", "\n", "u", ",", "err", ...
// Expand utilizes the sawyer expand method to convert a URI template into a full // URL
[ "Expand", "utilizes", "the", "sawyer", "expand", "method", "to", "convert", "a", "URI", "template", "into", "a", "full", "URL" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/hyperlink.go#L19-L23
140,241
octokit/go-octokit
octokit/hyperlink.go
ExpandWithDefault
func ExpandWithDefault(link *Hyperlink, defaultLink *Hyperlink, params M) (u *url.URL, err error) { if link == nil { link = defaultLink } return link.Expand(params) }
go
func ExpandWithDefault(link *Hyperlink, defaultLink *Hyperlink, params M) (u *url.URL, err error) { if link == nil { link = defaultLink } return link.Expand(params) }
[ "func", "ExpandWithDefault", "(", "link", "*", "Hyperlink", ",", "defaultLink", "*", "Hyperlink", ",", "params", "M", ")", "(", "u", "*", "url", ".", "URL", ",", "err", "error", ")", "{", "if", "link", "==", "nil", "{", "link", "=", "defaultLink", "\...
// Expands a link with possible, otherwise it expands the default link
[ "Expands", "a", "link", "with", "possible", "otherwise", "it", "expands", "the", "default", "link" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/hyperlink.go#L26-L32
140,242
octokit/go-octokit
octokit/result.go
Error
func (r *Result) Error() string { if r.Err != nil { return r.Err.Error() } return "" }
go
func (r *Result) Error() string { if r.Err != nil { return r.Err.Error() } return "" }
[ "func", "(", "r", "*", "Result", ")", "Error", "(", ")", "string", "{", "if", "r", ".", "Err", "!=", "nil", "{", "return", "r", ".", "Err", ".", "Error", "(", ")", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
// Error returns the string representation of the error if it exists; the // empty string is returned otherwise
[ "Error", "returns", "the", "string", "representation", "of", "the", "error", "if", "it", "exists", ";", "the", "empty", "string", "is", "returned", "otherwise" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/result.go#L42-L48
140,243
octokit/go-octokit
octokit/auth_method.go
String
func (b BasicAuth) String() string { return fmt.Sprintf("Basic %s", hashAuth(b.Login, b.Password)) }
go
func (b BasicAuth) String() string { return fmt.Sprintf("Basic %s", hashAuth(b.Login, b.Password)) }
[ "func", "(", "b", "BasicAuth", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "hashAuth", "(", "b", ".", "Login", ",", "b", ".", "Password", ")", ")", "\n", "}" ]
// String hashes the login and password to produce the string to be passed for // authentication purposes.
[ "String", "hashes", "the", "login", "and", "password", "to", "produce", "the", "string", "to", "be", "passed", "for", "authentication", "purposes", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/auth_method.go#L31-L33
140,244
octokit/go-octokit
octokit/auth_method.go
String
func (n NetrcAuth) String() string { netrcPath := n.NetrcPath if netrcPath == "" { netrcPath = filepath.Join(os.Getenv("HOME"), ".netrc") } apiURL, _ := url.Parse(gitHubAPIURL) credentials, err := netrc.FindMachine(netrcPath, apiURL.Host) if err != nil { panic(fmt.Errorf("netrc error (%s): %v", apiURL.Host, e...
go
func (n NetrcAuth) String() string { netrcPath := n.NetrcPath if netrcPath == "" { netrcPath = filepath.Join(os.Getenv("HOME"), ".netrc") } apiURL, _ := url.Parse(gitHubAPIURL) credentials, err := netrc.FindMachine(netrcPath, apiURL.Host) if err != nil { panic(fmt.Errorf("netrc error (%s): %v", apiURL.Host, e...
[ "func", "(", "n", "NetrcAuth", ")", "String", "(", ")", "string", "{", "netrcPath", ":=", "n", ".", "NetrcPath", "\n", "if", "netrcPath", "==", "\"", "\"", "{", "netrcPath", "=", "filepath", ".", "Join", "(", "os", ".", "Getenv", "(", "\"", "\"", "...
// String accesses the credentials from the .netrc file and hashes the associated // login and password to submit as a form of basic authentication.
[ "String", "accesses", "the", "credentials", "from", "the", ".", "netrc", "file", "and", "hashes", "the", "associated", "login", "and", "password", "to", "submit", "as", "a", "form", "of", "basic", "authentication", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/auth_method.go#L43-L54
140,245
octokit/go-octokit
octokit/auth_method.go
hashAuth
func hashAuth(u, p string) string { var a = fmt.Sprintf("%s:%s", u, p) return base64.StdEncoding.EncodeToString([]byte(a)) }
go
func hashAuth(u, p string) string { var a = fmt.Sprintf("%s:%s", u, p) return base64.StdEncoding.EncodeToString([]byte(a)) }
[ "func", "hashAuth", "(", "u", ",", "p", "string", ")", "string", "{", "var", "a", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "u", ",", "p", ")", "\n", "return", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "[", "]", "byte", "(...
// hashAuth is a helper function for producing a base64 encoding of a username and // password pair
[ "hashAuth", "is", "a", "helper", "function", "for", "producing", "a", "base64", "encoding", "of", "a", "username", "and", "password", "pair" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/auth_method.go#L58-L61
140,246
octokit/go-octokit
octokit/response.go
NewResponse
func NewResponse(sawyerResp *sawyer.Response) (resp *Response, err error) { if sawyerResp.IsError() { err = sawyerResp.ResponseError return } if sawyerResp.IsApiError() { err = NewResponseError(sawyerResp) return } resp = &Response{Response: sawyerResp.Response, MediaType: sawyerResp.MediaType, MediaHead...
go
func NewResponse(sawyerResp *sawyer.Response) (resp *Response, err error) { if sawyerResp.IsError() { err = sawyerResp.ResponseError return } if sawyerResp.IsApiError() { err = NewResponseError(sawyerResp) return } resp = &Response{Response: sawyerResp.Response, MediaType: sawyerResp.MediaType, MediaHead...
[ "func", "NewResponse", "(", "sawyerResp", "*", "sawyer", ".", "Response", ")", "(", "resp", "*", "Response", ",", "err", "error", ")", "{", "if", "sawyerResp", ".", "IsError", "(", ")", "{", "err", "=", "sawyerResp", ".", "ResponseError", "\n", "return",...
// NewResponse unwraps a sawyer Response, producing an error if there // was one associated in the sawyer response and otherwise creating a // new Response from the underlying HttpResponse, MediaType and // MediaHeader
[ "NewResponse", "unwraps", "a", "sawyer", "Response", "producing", "an", "error", "if", "there", "was", "one", "associated", "in", "the", "sawyer", "response", "and", "otherwise", "creating", "a", "new", "Response", "from", "the", "underlying", "HttpResponse", "M...
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/response.go#L23-L37
140,247
octokit/go-octokit
octokit/root.go
Rel
func (c *Client) Rel(name string, m map[string]interface{}) (*url.URL, error) { if c.rootRels == nil || len(c.rootRels) == 0 { u, _ := url.Parse("/") root, res := c.Root(u).One() if res.HasError() { return nil, res } c.rootRels = root.Rels() } return c.rootRels.Rel(name, m) }
go
func (c *Client) Rel(name string, m map[string]interface{}) (*url.URL, error) { if c.rootRels == nil || len(c.rootRels) == 0 { u, _ := url.Parse("/") root, res := c.Root(u).One() if res.HasError() { return nil, res } c.rootRels = root.Rels() } return c.rootRels.Rel(name, m) }
[ "func", "(", "c", "*", "Client", ")", "Rel", "(", "name", "string", ",", "m", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "if", "c", ".", "rootRels", "==", "nil", "||", "len", "(...
// Rel fetches and expands the given name in the the Hyperlink map m
[ "Rel", "fetches", "and", "expands", "the", "given", "name", "in", "the", "the", "Hyperlink", "map", "m" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/root.go#L16-L27
140,248
octokit/go-octokit
octokit/root.go
Rels
func (r *Root) Rels() hypermedia.Relations { if r.rels == nil || len(r.rels) == 0 { r.rels = hypermedia.HyperFieldDecoder(r) for key, hyperlink := range r.HALResource.Rels() { r.rels[key] = hyperlink } } return r.rels }
go
func (r *Root) Rels() hypermedia.Relations { if r.rels == nil || len(r.rels) == 0 { r.rels = hypermedia.HyperFieldDecoder(r) for key, hyperlink := range r.HALResource.Rels() { r.rels[key] = hyperlink } } return r.rels }
[ "func", "(", "r", "*", "Root", ")", "Rels", "(", ")", "hypermedia", ".", "Relations", "{", "if", "r", ".", "rels", "==", "nil", "||", "len", "(", "r", ".", "rels", ")", "==", "0", "{", "r", ".", "rels", "=", "hypermedia", ".", "HyperFieldDecoder"...
// Rels gets the link relations from the HALResource's Links field.
[ "Rels", "gets", "the", "link", "relations", "from", "the", "HALResource", "s", "Links", "field", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/root.go#L96-L104
140,249
octokit/go-octokit
octokit/uploads.go
Uploads
func (c *Client) Uploads(url *url.URL) (uploads *UploadsService) { uploads = &UploadsService{client: c, URL: url} return }
go
func (c *Client) Uploads(url *url.URL) (uploads *UploadsService) { uploads = &UploadsService{client: c, URL: url} return }
[ "func", "(", "c", "*", "Client", ")", "Uploads", "(", "url", "*", "url", ".", "URL", ")", "(", "uploads", "*", "UploadsService", ")", "{", "uploads", "=", "&", "UploadsService", "{", "client", ":", "c", ",", "URL", ":", "url", "}", "\n", "return", ...
// Uploads creates an UploadsService with a base url
[ "Uploads", "creates", "an", "UploadsService", "with", "a", "base", "url" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/uploads.go#L9-L12
140,250
octokit/go-octokit
octokit/uploads.go
UploadAsset
func (u *UploadsService) UploadAsset(asset io.ReadCloser, contentType string, contentLength int64) (result *Result) { return u.client.upload(u.URL, asset, contentType, contentLength) }
go
func (u *UploadsService) UploadAsset(asset io.ReadCloser, contentType string, contentLength int64) (result *Result) { return u.client.upload(u.URL, asset, contentType, contentLength) }
[ "func", "(", "u", "*", "UploadsService", ")", "UploadAsset", "(", "asset", "io", ".", "ReadCloser", ",", "contentType", "string", ",", "contentLength", "int64", ")", "(", "result", "*", "Result", ")", "{", "return", "u", ".", "client", ".", "upload", "("...
// UploadAsset uploads a particular asset of some content type and length to the service
[ "UploadAsset", "uploads", "a", "particular", "asset", "of", "some", "content", "type", "and", "length", "to", "the", "service" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/uploads.go#L21-L23
140,251
octokit/go-octokit
script/auditor.go
listSourceFiles
func listSourceFiles(dirname string) []string { var result []string files, err := ioutil.ReadDir(dirname) if err != nil { panic(err) } for _, f := range files { if strings.HasSuffix(f.Name(), ".go") && !strings.HasSuffix(f.Name(), "_test.go") { result = append(result, path.Join(dirname, f.Name())) } }...
go
func listSourceFiles(dirname string) []string { var result []string files, err := ioutil.ReadDir(dirname) if err != nil { panic(err) } for _, f := range files { if strings.HasSuffix(f.Name(), ".go") && !strings.HasSuffix(f.Name(), "_test.go") { result = append(result, path.Join(dirname, f.Name())) } }...
[ "func", "listSourceFiles", "(", "dirname", "string", ")", "[", "]", "string", "{", "var", "result", "[", "]", "string", "\n", "files", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "dirname", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(",...
// List all non-test Go source files
[ "List", "all", "non", "-", "test", "Go", "source", "files" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/script/auditor.go#L30-L43
140,252
octokit/go-octokit
script/auditor.go
extractURLsFromSourceFile
func extractURLsFromSourceFile(filename string) (results []string) { file, err := os.Open(filename) if err != nil { panic(err) } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { text := scanner.Text() res := URLDeclarationMatcher.FindStringSubmatch(text) if len(res) > 1 { resul...
go
func extractURLsFromSourceFile(filename string) (results []string) { file, err := os.Open(filename) if err != nil { panic(err) } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { text := scanner.Text() res := URLDeclarationMatcher.FindStringSubmatch(text) if len(res) > 1 { resul...
[ "func", "extractURLsFromSourceFile", "(", "filename", "string", ")", "(", "results", "[", "]", "string", ")", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n",...
// List all documentation URLs from the specified source file
[ "List", "all", "documentation", "URLs", "from", "the", "specified", "source", "file" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/script/auditor.go#L46-L61
140,253
octokit/go-octokit
octokit/request.go
Head
func (r *Request) Head(output interface{}) (*Response, error) { return r.createResponse(r.Request.Head(), output) }
go
func (r *Request) Head(output interface{}) (*Response, error) { return r.createResponse(r.Request.Head(), output) }
[ "func", "(", "r", "*", "Request", ")", "Head", "(", "output", "interface", "{", "}", ")", "(", "*", "Response", ",", "error", ")", "{", "return", "r", ".", "createResponse", "(", "r", ".", "Request", ".", "Head", "(", ")", ",", "output", ")", "\n...
// Head sends a HEAD request through the given client and returns the response // and any associated errors
[ "Head", "sends", "a", "HEAD", "request", "through", "the", "given", "client", "and", "returns", "the", "response", "and", "any", "associated", "errors" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/request.go#L28-L30
140,254
octokit/go-octokit
octokit/request.go
Get
func (r *Request) Get(output interface{}) (*Response, error) { if output == nil { return NewResponse(r.Request.Get()) } return r.createResponse(r.Request.Get(), output) }
go
func (r *Request) Get(output interface{}) (*Response, error) { if output == nil { return NewResponse(r.Request.Get()) } return r.createResponse(r.Request.Get(), output) }
[ "func", "(", "r", "*", "Request", ")", "Get", "(", "output", "interface", "{", "}", ")", "(", "*", "Response", ",", "error", ")", "{", "if", "output", "==", "nil", "{", "return", "NewResponse", "(", "r", ".", "Request", ".", "Get", "(", ")", ")",...
// Get sends a GET request through the given client and returns the response // and any associated errors
[ "Get", "sends", "a", "GET", "request", "through", "the", "given", "client", "and", "returns", "the", "response", "and", "any", "associated", "errors" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/request.go#L34-L39
140,255
octokit/go-octokit
octokit/request.go
Post
func (r *Request) Post(input interface{}, output interface{}) (*Response, error) { r.setBody(input) return r.createResponse(r.Request.Post(), output) }
go
func (r *Request) Post(input interface{}, output interface{}) (*Response, error) { r.setBody(input) return r.createResponse(r.Request.Post(), output) }
[ "func", "(", "r", "*", "Request", ")", "Post", "(", "input", "interface", "{", "}", ",", "output", "interface", "{", "}", ")", "(", "*", "Response", ",", "error", ")", "{", "r", ".", "setBody", "(", "input", ")", "\n", "return", "r", ".", "create...
// Post sends a POST request through the given client and returns the response // and any associated errors
[ "Post", "sends", "a", "POST", "request", "through", "the", "given", "client", "and", "returns", "the", "response", "and", "any", "associated", "errors" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/request.go#L43-L46
140,256
octokit/go-octokit
octokit/request.go
Options
func (r *Request) Options(output interface{}) (*Response, error) { return r.createResponse(r.Request.Options(), output) }
go
func (r *Request) Options(output interface{}) (*Response, error) { return r.createResponse(r.Request.Options(), output) }
[ "func", "(", "r", "*", "Request", ")", "Options", "(", "output", "interface", "{", "}", ")", "(", "*", "Response", ",", "error", ")", "{", "return", "r", ".", "createResponse", "(", "r", ".", "Request", ".", "Options", "(", ")", ",", "output", ")",...
// Options sends an OPTIONS request through the given client and returns the response // and any associated errors
[ "Options", "sends", "an", "OPTIONS", "request", "through", "the", "given", "client", "and", "returns", "the", "response", "and", "any", "associated", "errors" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/request.go#L71-L73
140,257
octokit/go-octokit
octokit/client.go
NewClientWith
func NewClientWith(baseURL string, userAgent string, authMethod AuthMethod, httpClient *http.Client) *Client { client, _ := sawyer.NewFromString(baseURL, httpClient) return &Client{Client: client, UserAgent: userAgent, AuthMethod: authMethod} }
go
func NewClientWith(baseURL string, userAgent string, authMethod AuthMethod, httpClient *http.Client) *Client { client, _ := sawyer.NewFromString(baseURL, httpClient) return &Client{Client: client, UserAgent: userAgent, AuthMethod: authMethod} }
[ "func", "NewClientWith", "(", "baseURL", "string", ",", "userAgent", "string", ",", "authMethod", "AuthMethod", ",", "httpClient", "*", "http", ".", "Client", ")", "*", "Client", "{", "client", ",", "_", ":=", "sawyer", ".", "NewFromString", "(", "baseURL", ...
// NewClientWith creates a new Client with a particular base URL which all requests will // be appended onto - often the GitHub URL - the user agent being represented, the // authentication method, and a pointer to a httpClient if a particular client is being // wrapped. If httpClient is nil a default httpClient will b...
[ "NewClientWith", "creates", "a", "new", "Client", "with", "a", "particular", "base", "URL", "which", "all", "requests", "will", "be", "appended", "onto", "-", "often", "the", "GitHub", "URL", "-", "the", "user", "agent", "being", "represented", "the", "authe...
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/client.go#L22-L25
140,258
octokit/go-octokit
octokit/client.go
NewRequest
func (c *Client) NewRequest(urlStr string) (req *Request, err error) { req, err = newRequest(c, urlStr) if err != nil { return } c.applyRequestHeaders(req) return }
go
func (c *Client) NewRequest(urlStr string) (req *Request, err error) { req, err = newRequest(c, urlStr) if err != nil { return } c.applyRequestHeaders(req) return }
[ "func", "(", "c", "*", "Client", ")", "NewRequest", "(", "urlStr", "string", ")", "(", "req", "*", "Request", ",", "err", "error", ")", "{", "req", ",", "err", "=", "newRequest", "(", "c", ",", "urlStr", ")", "\n", "if", "err", "!=", "nil", "{", ...
// NewRequest produces a simple request for the given url and applies the proper headers // currently associated with the client to that request.
[ "NewRequest", "produces", "a", "simple", "request", "for", "the", "given", "url", "and", "applies", "the", "proper", "headers", "currently", "associated", "with", "the", "client", "to", "that", "request", "." ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/client.go#L40-L49
140,259
octokit/go-octokit
octokit/client.go
getBody
func (c *Client) getBody(url *url.URL, mediaType string) (patch io.ReadCloser, result *Result) { result = sendRequest(c, url, func(req *Request) (*Response, error) { req.Header.Set("Accept", mediaType) return req.Get(nil) }) if result.Response != nil { patch = result.Response.Body } return }
go
func (c *Client) getBody(url *url.URL, mediaType string) (patch io.ReadCloser, result *Result) { result = sendRequest(c, url, func(req *Request) (*Response, error) { req.Header.Set("Accept", mediaType) return req.Get(nil) }) if result.Response != nil { patch = result.Response.Body } return }
[ "func", "(", "c", "*", "Client", ")", "getBody", "(", "url", "*", "url", ".", "URL", ",", "mediaType", "string", ")", "(", "patch", "io", ".", "ReadCloser", ",", "result", "*", "Result", ")", "{", "result", "=", "sendRequest", "(", "c", ",", "url",...
// a GET request with specific media type set
[ "a", "GET", "request", "with", "specific", "media", "type", "set" ]
812e91dfbd64051c1ec72c48feda0278727e8a4e
https://github.com/octokit/go-octokit/blob/812e91dfbd64051c1ec72c48feda0278727e8a4e/octokit/client.go#L52-L63
140,260
gosexy/redis
redis.go
Connect
func (c *Client) Connect(host string, port uint) (err error) { return c.dial(`tcp`, fmt.Sprintf(`%s:%d`, host, port)) }
go
func (c *Client) Connect(host string, port uint) (err error) { return c.dial(`tcp`, fmt.Sprintf(`%s:%d`, host, port)) }
[ "func", "(", "c", "*", "Client", ")", "Connect", "(", "host", "string", ",", "port", "uint", ")", "(", "err", "error", ")", "{", "return", "c", ".", "dial", "(", "`tcp`", ",", "fmt", ".", "Sprintf", "(", "`%s:%d`", ",", "host", ",", "port", ")", ...
// Connects the client to the given host and port.
[ "Connects", "the", "client", "to", "the", "given", "host", "and", "port", "." ]
19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096
https://github.com/gosexy/redis/blob/19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096/redis.go#L71-L73
140,261
gosexy/redis
redis.go
ConnectWithTimeout
func (c *Client) ConnectWithTimeout(host string, port uint, timeout time.Duration) error { return c.dialTimeout(`tcp`, fmt.Sprintf(`%s:%d`, host, port), timeout) }
go
func (c *Client) ConnectWithTimeout(host string, port uint, timeout time.Duration) error { return c.dialTimeout(`tcp`, fmt.Sprintf(`%s:%d`, host, port), timeout) }
[ "func", "(", "c", "*", "Client", ")", "ConnectWithTimeout", "(", "host", "string", ",", "port", "uint", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "return", "c", ".", "dialTimeout", "(", "`tcp`", ",", "fmt", ".", "Sprintf", "(", "`%s:%...
// ConnectWithTimeout attempts to connect to a redis-server, giving up after // the specified time.
[ "ConnectWithTimeout", "attempts", "to", "connect", "to", "a", "redis", "-", "server", "giving", "up", "after", "the", "specified", "time", "." ]
19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096
https://github.com/gosexy/redis/blob/19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096/redis.go#L77-L79
140,262
gosexy/redis
redis.go
ConnectUnixWithTimeout
func (c *Client) ConnectUnixWithTimeout(path string, timeout time.Duration) error { return c.dialTimeout(`unix`, path, timeout) }
go
func (c *Client) ConnectUnixWithTimeout(path string, timeout time.Duration) error { return c.dialTimeout(`unix`, path, timeout) }
[ "func", "(", "c", "*", "Client", ")", "ConnectUnixWithTimeout", "(", "path", "string", ",", "timeout", "time", ".", "Duration", ")", "error", "{", "return", "c", ".", "dialTimeout", "(", "`unix`", ",", "path", ",", "timeout", ")", "\n", "}" ]
// ConnectUnixWithTimeout attempts to create a connection with an UNIX socket, // giving up after the specified time.
[ "ConnectUnixWithTimeout", "attempts", "to", "create", "a", "connection", "with", "an", "UNIX", "socket", "giving", "up", "after", "the", "specified", "time", "." ]
19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096
https://github.com/gosexy/redis/blob/19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096/redis.go#L99-L101
140,263
gosexy/redis
redis.go
Command
func (c *Client) Command(dest interface{}, values ...interface{}) error { if c == nil { return ErrNotInitialized } bvalues := make([][]byte, len(values)) // Converting all input values into []byte. for i := range values { bvalues[i] = to.Bytes(values[i]) } // Sending command to redis-server. return c.comman...
go
func (c *Client) Command(dest interface{}, values ...interface{}) error { if c == nil { return ErrNotInitialized } bvalues := make([][]byte, len(values)) // Converting all input values into []byte. for i := range values { bvalues[i] = to.Bytes(values[i]) } // Sending command to redis-server. return c.comman...
[ "func", "(", "c", "*", "Client", ")", "Command", "(", "dest", "interface", "{", "}", ",", "values", "...", "interface", "{", "}", ")", "error", "{", "if", "c", "==", "nil", "{", "return", "ErrNotInitialized", "\n", "}", "\n", "bvalues", ":=", "make",...
// Command builds a command specified by the `values` interface and stores the // result into the variable pointed by `dest`.
[ "Command", "builds", "a", "command", "specified", "by", "the", "values", "interface", "and", "stores", "the", "result", "into", "the", "variable", "pointed", "by", "dest", "." ]
19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096
https://github.com/gosexy/redis/blob/19c427d2a3bc8b8cdbb2cbb8f313ed141cb78096/redis.go#L145-L156
140,264
stoewer/go-strcase
snake.go
lowerDelimiterCase
func lowerDelimiterCase(s string, delimiter rune) string { s = strings.TrimSpace(s) buffer := make([]rune, 0, len(s)+3) var prev rune var curr rune for _, next := range s { if isDelimiter(curr) { if !isDelimiter(prev) { buffer = append(buffer, delimiter) } } else if isUpper(curr) { if isLower(pre...
go
func lowerDelimiterCase(s string, delimiter rune) string { s = strings.TrimSpace(s) buffer := make([]rune, 0, len(s)+3) var prev rune var curr rune for _, next := range s { if isDelimiter(curr) { if !isDelimiter(prev) { buffer = append(buffer, delimiter) } } else if isUpper(curr) { if isLower(pre...
[ "func", "lowerDelimiterCase", "(", "s", "string", ",", "delimiter", "rune", ")", "string", "{", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "buffer", ":=", "make", "(", "[", "]", "rune", ",", "0", ",", "len", "(", "s", ")", "+", "...
// lowerDelimiterCase converts a string into snake_case or kebab-case depending on // the delimiter passed in as second argument.
[ "lowerDelimiterCase", "converts", "a", "string", "into", "snake_case", "or", "kebab", "-", "case", "depending", "on", "the", "delimiter", "passed", "in", "as", "second", "argument", "." ]
9f4628dc69009a239427f342caccb0047c7aea01
https://github.com/stoewer/go-strcase/blob/9f4628dc69009a239427f342caccb0047c7aea01/snake.go#L17-L48
140,265
hashicorp/go-uuid
uuid.go
GenerateRandomBytes
func GenerateRandomBytes(size int) ([]byte, error) { buf := make([]byte, size) if _, err := rand.Read(buf); err != nil { return nil, fmt.Errorf("failed to read random bytes: %v", err) } return buf, nil }
go
func GenerateRandomBytes(size int) ([]byte, error) { buf := make([]byte, size) if _, err := rand.Read(buf); err != nil { return nil, fmt.Errorf("failed to read random bytes: %v", err) } return buf, nil }
[ "func", "GenerateRandomBytes", "(", "size", "int", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "size", ")", "\n", "if", "_", ",", "err", ":=", "rand", ".", "Read", "(", "buf", ")", ";", ...
// GenerateRandomBytes is used to generate random bytes of given size.
[ "GenerateRandomBytes", "is", "used", "to", "generate", "random", "bytes", "of", "given", "size", "." ]
4f571afc59f3043a65f8fe6bf46d887b10a01d43
https://github.com/hashicorp/go-uuid/blob/4f571afc59f3043a65f8fe6bf46d887b10a01d43/uuid.go#L10-L16
140,266
phf/go-queue
queue/queue.go
Init
func (q *Queue) Init() *Queue { q.rep = make([]interface{}, 1) q.front, q.back, q.length = 0, 0, 0 return q }
go
func (q *Queue) Init() *Queue { q.rep = make([]interface{}, 1) q.front, q.back, q.length = 0, 0, 0 return q }
[ "func", "(", "q", "*", "Queue", ")", "Init", "(", ")", "*", "Queue", "{", "q", ".", "rep", "=", "make", "(", "[", "]", "interface", "{", "}", ",", "1", ")", "\n", "q", ".", "front", ",", "q", ".", "back", ",", "q", ".", "length", "=", "0"...
// Init initializes or clears queue q.
[ "Init", "initializes", "or", "clears", "queue", "q", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L34-L38
140,267
phf/go-queue
queue/queue.go
sparse
func (q *Queue) sparse() bool { return 1 < q.length && q.length < len(q.rep)/4 }
go
func (q *Queue) sparse() bool { return 1 < q.length && q.length < len(q.rep)/4 }
[ "func", "(", "q", "*", "Queue", ")", "sparse", "(", ")", "bool", "{", "return", "1", "<", "q", ".", "length", "&&", "q", ".", "length", "<", "len", "(", "q", ".", "rep", ")", "/", "4", "\n", "}" ]
// sparse returns true if the queue q has excess capacity.
[ "sparse", "returns", "true", "if", "the", "queue", "q", "has", "excess", "capacity", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L68-L70
140,268
phf/go-queue
queue/queue.go
resize
func (q *Queue) resize(size int) { adjusted := make([]interface{}, size) if q.front < q.back { // rep not "wrapped" around, one copy suffices copy(adjusted, q.rep[q.front:q.back]) } else { // rep is "wrapped" around, need two copies n := copy(adjusted, q.rep[q.front:]) copy(adjusted[n:], q.rep[:q.back]) }...
go
func (q *Queue) resize(size int) { adjusted := make([]interface{}, size) if q.front < q.back { // rep not "wrapped" around, one copy suffices copy(adjusted, q.rep[q.front:q.back]) } else { // rep is "wrapped" around, need two copies n := copy(adjusted, q.rep[q.front:]) copy(adjusted[n:], q.rep[:q.back]) }...
[ "func", "(", "q", "*", "Queue", ")", "resize", "(", "size", "int", ")", "{", "adjusted", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "size", ")", "\n", "if", "q", ".", "front", "<", "q", ".", "back", "{", "// rep not \"wrapped\" around...
// resize adjusts the size of queue q's underlying slice.
[ "resize", "adjusts", "the", "size", "of", "queue", "q", "s", "underlying", "slice", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L73-L86
140,269
phf/go-queue
queue/queue.go
lazyGrow
func (q *Queue) lazyGrow() { if q.full() { q.resize(len(q.rep) * 2) } }
go
func (q *Queue) lazyGrow() { if q.full() { q.resize(len(q.rep) * 2) } }
[ "func", "(", "q", "*", "Queue", ")", "lazyGrow", "(", ")", "{", "if", "q", ".", "full", "(", ")", "{", "q", ".", "resize", "(", "len", "(", "q", ".", "rep", ")", "*", "2", ")", "\n", "}", "\n", "}" ]
// lazyGrow grows the underlying slice if necessary.
[ "lazyGrow", "grows", "the", "underlying", "slice", "if", "necessary", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L89-L93
140,270
phf/go-queue
queue/queue.go
lazyShrink
func (q *Queue) lazyShrink() { if q.sparse() { q.resize(len(q.rep) / 2) } }
go
func (q *Queue) lazyShrink() { if q.sparse() { q.resize(len(q.rep) / 2) } }
[ "func", "(", "q", "*", "Queue", ")", "lazyShrink", "(", ")", "{", "if", "q", ".", "sparse", "(", ")", "{", "q", ".", "resize", "(", "len", "(", "q", ".", "rep", ")", "/", "2", ")", "\n", "}", "\n", "}" ]
// lazyShrink shrinks the underlying slice if advisable.
[ "lazyShrink", "shrinks", "the", "underlying", "slice", "if", "advisable", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L96-L100
140,271
phf/go-queue
queue/queue.go
String
func (q *Queue) String() string { var result bytes.Buffer result.WriteByte('[') j := q.front for i := 0; i < q.length; i++ { result.WriteString(fmt.Sprintf("%v", q.rep[j])) if i < q.length-1 { result.WriteByte(' ') } j = q.inc(j) } result.WriteByte(']') return result.String() }
go
func (q *Queue) String() string { var result bytes.Buffer result.WriteByte('[') j := q.front for i := 0; i < q.length; i++ { result.WriteString(fmt.Sprintf("%v", q.rep[j])) if i < q.length-1 { result.WriteByte(' ') } j = q.inc(j) } result.WriteByte(']') return result.String() }
[ "func", "(", "q", "*", "Queue", ")", "String", "(", ")", "string", "{", "var", "result", "bytes", ".", "Buffer", "\n", "result", ".", "WriteByte", "(", "'['", ")", "\n", "j", ":=", "q", ".", "front", "\n", "for", "i", ":=", "0", ";", "i", "<", ...
// String returns a string representation of queue q formatted // from front to back.
[ "String", "returns", "a", "string", "representation", "of", "queue", "q", "formatted", "from", "front", "to", "back", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L104-L117
140,272
phf/go-queue
queue/queue.go
inc
func (q *Queue) inc(i int) int { return (i + 1) & (len(q.rep) - 1) // requires l = 2^n }
go
func (q *Queue) inc(i int) int { return (i + 1) & (len(q.rep) - 1) // requires l = 2^n }
[ "func", "(", "q", "*", "Queue", ")", "inc", "(", "i", "int", ")", "int", "{", "return", "(", "i", "+", "1", ")", "&", "(", "len", "(", "q", ".", "rep", ")", "-", "1", ")", "// requires l = 2^n", "\n", "}" ]
// inc returns the next integer position wrapping around queue q.
[ "inc", "returns", "the", "next", "integer", "position", "wrapping", "around", "queue", "q", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L120-L122
140,273
phf/go-queue
queue/queue.go
dec
func (q *Queue) dec(i int) int { return (i - 1) & (len(q.rep) - 1) // requires l = 2^n }
go
func (q *Queue) dec(i int) int { return (i - 1) & (len(q.rep) - 1) // requires l = 2^n }
[ "func", "(", "q", "*", "Queue", ")", "dec", "(", "i", "int", ")", "int", "{", "return", "(", "i", "-", "1", ")", "&", "(", "len", "(", "q", ".", "rep", ")", "-", "1", ")", "// requires l = 2^n", "\n", "}" ]
// dec returns the previous integer position wrapping around queue q.
[ "dec", "returns", "the", "previous", "integer", "position", "wrapping", "around", "queue", "q", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L125-L127
140,274
phf/go-queue
queue/queue.go
PushFront
func (q *Queue) PushFront(v interface{}) { q.lazyInit() q.lazyGrow() q.front = q.dec(q.front) q.rep[q.front] = v q.length++ }
go
func (q *Queue) PushFront(v interface{}) { q.lazyInit() q.lazyGrow() q.front = q.dec(q.front) q.rep[q.front] = v q.length++ }
[ "func", "(", "q", "*", "Queue", ")", "PushFront", "(", "v", "interface", "{", "}", ")", "{", "q", ".", "lazyInit", "(", ")", "\n", "q", ".", "lazyGrow", "(", ")", "\n", "q", ".", "front", "=", "q", ".", "dec", "(", "q", ".", "front", ")", "...
// PushFront inserts a new value v at the front of queue q.
[ "PushFront", "inserts", "a", "new", "value", "v", "at", "the", "front", "of", "queue", "q", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L142-L148
140,275
phf/go-queue
queue/queue.go
PushBack
func (q *Queue) PushBack(v interface{}) { q.lazyInit() q.lazyGrow() q.rep[q.back] = v q.back = q.inc(q.back) q.length++ }
go
func (q *Queue) PushBack(v interface{}) { q.lazyInit() q.lazyGrow() q.rep[q.back] = v q.back = q.inc(q.back) q.length++ }
[ "func", "(", "q", "*", "Queue", ")", "PushBack", "(", "v", "interface", "{", "}", ")", "{", "q", ".", "lazyInit", "(", ")", "\n", "q", ".", "lazyGrow", "(", ")", "\n", "q", ".", "rep", "[", "q", ".", "back", "]", "=", "v", "\n", "q", ".", ...
// PushBack inserts a new value v at the back of queue q.
[ "PushBack", "inserts", "a", "new", "value", "v", "at", "the", "back", "of", "queue", "q", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L151-L157
140,276
phf/go-queue
queue/queue.go
PopFront
func (q *Queue) PopFront() interface{} { if q.empty() { return nil } v := q.rep[q.front] q.rep[q.front] = nil // unused slots must be nil q.front = q.inc(q.front) q.length-- q.lazyShrink() return v }
go
func (q *Queue) PopFront() interface{} { if q.empty() { return nil } v := q.rep[q.front] q.rep[q.front] = nil // unused slots must be nil q.front = q.inc(q.front) q.length-- q.lazyShrink() return v }
[ "func", "(", "q", "*", "Queue", ")", "PopFront", "(", ")", "interface", "{", "}", "{", "if", "q", ".", "empty", "(", ")", "{", "return", "nil", "\n", "}", "\n", "v", ":=", "q", ".", "rep", "[", "q", ".", "front", "]", "\n", "q", ".", "rep",...
// PopFront removes and returns the first element of queue q or nil.
[ "PopFront", "removes", "and", "returns", "the", "first", "element", "of", "queue", "q", "or", "nil", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L160-L170
140,277
phf/go-queue
queue/queue.go
PopBack
func (q *Queue) PopBack() interface{} { if q.empty() { return nil } q.back = q.dec(q.back) v := q.rep[q.back] q.rep[q.back] = nil // unused slots must be nil q.length-- q.lazyShrink() return v }
go
func (q *Queue) PopBack() interface{} { if q.empty() { return nil } q.back = q.dec(q.back) v := q.rep[q.back] q.rep[q.back] = nil // unused slots must be nil q.length-- q.lazyShrink() return v }
[ "func", "(", "q", "*", "Queue", ")", "PopBack", "(", ")", "interface", "{", "}", "{", "if", "q", ".", "empty", "(", ")", "{", "return", "nil", "\n", "}", "\n", "q", ".", "back", "=", "q", ".", "dec", "(", "q", ".", "back", ")", "\n", "v", ...
// PopBack removes and returns the last element of queue q or nil.
[ "PopBack", "removes", "and", "returns", "the", "last", "element", "of", "queue", "q", "or", "nil", "." ]
9abe38d0371deb4049011737cbd30e4ba80c673b
https://github.com/phf/go-queue/blob/9abe38d0371deb4049011737cbd30e4ba80c673b/queue/queue.go#L173-L183
140,278
kisielk/sqlstruct
sqlstruct.go
getFieldInfo
func getFieldInfo(typ reflect.Type) fieldInfo { finfoLock.RLock() finfo, ok := finfos[typ] finfoLock.RUnlock() if ok { return finfo } finfo = make(fieldInfo) n := typ.NumField() for i := 0; i < n; i++ { f := typ.Field(i) tag := f.Tag.Get(TagName) // Skip unexported fields or fields marked with "-" ...
go
func getFieldInfo(typ reflect.Type) fieldInfo { finfoLock.RLock() finfo, ok := finfos[typ] finfoLock.RUnlock() if ok { return finfo } finfo = make(fieldInfo) n := typ.NumField() for i := 0; i < n; i++ { f := typ.Field(i) tag := f.Tag.Get(TagName) // Skip unexported fields or fields marked with "-" ...
[ "func", "getFieldInfo", "(", "typ", "reflect", ".", "Type", ")", "fieldInfo", "{", "finfoLock", ".", "RLock", "(", ")", "\n", "finfo", ",", "ok", ":=", "finfos", "[", "typ", "]", "\n", "finfoLock", ".", "RUnlock", "(", ")", "\n", "if", "ok", "{", "...
// getFieldInfo creates a fieldInfo for the provided type. Fields that are not tagged // with the "sql" tag and unexported fields are not included.
[ "getFieldInfo", "creates", "a", "fieldInfo", "for", "the", "provided", "type", ".", "Fields", "that", "are", "not", "tagged", "with", "the", "sql", "tag", "and", "unexported", "fields", "are", "not", "included", "." ]
648daed35d49dac24a4bff253b190a80da3ab6a5
https://github.com/kisielk/sqlstruct/blob/648daed35d49dac24a4bff253b190a80da3ab6a5/sqlstruct.go#L128-L170
140,279
kisielk/sqlstruct
sqlstruct.go
ScanAliased
func ScanAliased(dest interface{}, rows Rows, alias string) error { return doScan(dest, rows, alias) }
go
func ScanAliased(dest interface{}, rows Rows, alias string) error { return doScan(dest, rows, alias) }
[ "func", "ScanAliased", "(", "dest", "interface", "{", "}", ",", "rows", "Rows", ",", "alias", "string", ")", "error", "{", "return", "doScan", "(", "dest", ",", "rows", ",", "alias", ")", "\n", "}" ]
// ScanAliased works like scan, except that it expects the results in the query to be // prefixed by the given alias. // // For example, if scanning to a field named "name" with an alias of "user" it will // expect to find the result in a column named "user_name". // // See ColumnAliased for a convenient way to generat...
[ "ScanAliased", "works", "like", "scan", "except", "that", "it", "expects", "the", "results", "in", "the", "query", "to", "be", "prefixed", "by", "the", "given", "alias", ".", "For", "example", "if", "scanning", "to", "a", "field", "named", "name", "with", ...
648daed35d49dac24a4bff253b190a80da3ab6a5
https://github.com/kisielk/sqlstruct/blob/648daed35d49dac24a4bff253b190a80da3ab6a5/sqlstruct.go#L187-L189
140,280
kisielk/sqlstruct
sqlstruct.go
ToSnakeCase
func ToSnakeCase(src string) string { thisUpper := false prevUpper := false buf := bytes.NewBufferString("") for i, v := range src { if v >= 'A' && v <= 'Z' { thisUpper = true } else { thisUpper = false } if i > 0 && thisUpper && !prevUpper { buf.WriteRune('_') } prevUpper = thisUpper buf.Wr...
go
func ToSnakeCase(src string) string { thisUpper := false prevUpper := false buf := bytes.NewBufferString("") for i, v := range src { if v >= 'A' && v <= 'Z' { thisUpper = true } else { thisUpper = false } if i > 0 && thisUpper && !prevUpper { buf.WriteRune('_') } prevUpper = thisUpper buf.Wr...
[ "func", "ToSnakeCase", "(", "src", "string", ")", "string", "{", "thisUpper", ":=", "false", "\n", "prevUpper", ":=", "false", "\n\n", "buf", ":=", "bytes", ".", "NewBufferString", "(", "\"", "\"", ")", "\n", "for", "i", ",", "v", ":=", "range", "src",...
// ToSnakeCase converts a string to snake case, words separated with underscores. // It's intended to be used with NameMapper to map struct field names to snake case database fields.
[ "ToSnakeCase", "converts", "a", "string", "to", "snake", "case", "words", "separated", "with", "underscores", ".", "It", "s", "intended", "to", "be", "used", "with", "NameMapper", "to", "map", "struct", "field", "names", "to", "snake", "case", "database", "f...
648daed35d49dac24a4bff253b190a80da3ab6a5
https://github.com/kisielk/sqlstruct/blob/648daed35d49dac24a4bff253b190a80da3ab6a5/sqlstruct.go#L263-L281
140,281
bmatsuo/lmdb-go
lmdbscan/scanner.go
New
func New(txn *lmdb.Txn, dbi lmdb.DBI) *Scanner { s := &Scanner{ dbi: dbi, op: lmdb.Next, } s.cur, s.err = txn.OpenCursor(dbi) return s }
go
func New(txn *lmdb.Txn, dbi lmdb.DBI) *Scanner { s := &Scanner{ dbi: dbi, op: lmdb.Next, } s.cur, s.err = txn.OpenCursor(dbi) return s }
[ "func", "New", "(", "txn", "*", "lmdb", ".", "Txn", ",", "dbi", "lmdb", ".", "DBI", ")", "*", "Scanner", "{", "s", ":=", "&", "Scanner", "{", "dbi", ":", "dbi", ",", "op", ":", "lmdb", ".", "Next", ",", "}", "\n\n", "s", ".", "cur", ",", "s...
// New allocates and intializes a Scanner for dbi within txn. When the Scanner // returned by New is no longer needed its Close method must be called.
[ "New", "allocates", "and", "intializes", "a", "Scanner", "for", "dbi", "within", "txn", ".", "When", "the", "Scanner", "returned", "by", "New", "is", "no", "longer", "needed", "its", "Close", "method", "must", "be", "called", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdbscan/scanner.go#L30-L38
140,282
bmatsuo/lmdb-go
lmdbscan/scanner.go
Scan
func (s *Scanner) Scan() bool { if !s.checkOpen() { return false } if s.set { s.set = false } else { s.key, s.val, s.err = s.cur.Get(nil, nil, s.op) } return s.err == nil }
go
func (s *Scanner) Scan() bool { if !s.checkOpen() { return false } if s.set { s.set = false } else { s.key, s.val, s.err = s.cur.Get(nil, nil, s.op) } return s.err == nil }
[ "func", "(", "s", "*", "Scanner", ")", "Scan", "(", ")", "bool", "{", "if", "!", "s", ".", "checkOpen", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "s", ".", "set", "{", "s", ".", "set", "=", "false", "\n", "}", "else", "{", "s...
// Scan gets successive key-value pairs using the underlying cursor. Scan // returns false when key-value pairs are exhausted or another error is // encountered.
[ "Scan", "gets", "successive", "key", "-", "value", "pairs", "using", "the", "underlying", "cursor", ".", "Scan", "returns", "false", "when", "key", "-", "value", "pairs", "are", "exhausted", "or", "another", "error", "is", "encountered", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdbscan/scanner.go#L93-L103
140,283
bmatsuo/lmdb-go
lmdbscan/scanner.go
Close
func (s *Scanner) Close() { if s.cur != nil { s.cur.Close() s.cur = nil } }
go
func (s *Scanner) Close() { if s.cur != nil { s.cur.Close() s.cur = nil } }
[ "func", "(", "s", "*", "Scanner", ")", "Close", "(", ")", "{", "if", "s", ".", "cur", "!=", "nil", "{", "s", ".", "cur", ".", "Close", "(", ")", "\n", "s", ".", "cur", "=", "nil", "\n", "}", "\n", "}" ]
// Close closes the cursor underlying s and clears its ows internal structures. // Close does not attempt to terminate the enclosing transaction. // // Scan must not be called after Close.
[ "Close", "closes", "the", "cursor", "underlying", "s", "and", "clears", "its", "ows", "internal", "structures", ".", "Close", "does", "not", "attempt", "to", "terminate", "the", "enclosing", "transaction", ".", "Scan", "must", "not", "be", "called", "after", ...
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdbscan/scanner.go#L128-L133
140,284
bmatsuo/lmdb-go
lmdb/cursor.go
Renew
func (c *Cursor) Renew(txn *Txn) error { ret := C.mdb_cursor_renew(txn._txn, c._c) err := operrno("mdb_cursor_renew", ret) if err != nil { return err } c.txn = txn return nil }
go
func (c *Cursor) Renew(txn *Txn) error { ret := C.mdb_cursor_renew(txn._txn, c._c) err := operrno("mdb_cursor_renew", ret) if err != nil { return err } c.txn = txn return nil }
[ "func", "(", "c", "*", "Cursor", ")", "Renew", "(", "txn", "*", "Txn", ")", "error", "{", "ret", ":=", "C", ".", "mdb_cursor_renew", "(", "txn", ".", "_txn", ",", "c", ".", "_c", ")", "\n", "err", ":=", "operrno", "(", "\"", "\"", ",", "ret", ...
// Renew associates readonly cursor with txn. // // See mdb_cursor_renew.
[ "Renew", "associates", "readonly", "cursor", "with", "txn", ".", "See", "mdb_cursor_renew", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/cursor.go#L78-L86
140,285
bmatsuo/lmdb-go
lmdb/cursor.go
DBI
func (c *Cursor) DBI() DBI { // dbiInvalid is an invalid DBI (the max value for the type). it shouldn't // be possible to create a database handle with value dbiInvalid because // the process address space would be exhausted. it is also impractical to // have many open databases in an environment. const dbiInval...
go
func (c *Cursor) DBI() DBI { // dbiInvalid is an invalid DBI (the max value for the type). it shouldn't // be possible to create a database handle with value dbiInvalid because // the process address space would be exhausted. it is also impractical to // have many open databases in an environment. const dbiInval...
[ "func", "(", "c", "*", "Cursor", ")", "DBI", "(", ")", "DBI", "{", "// dbiInvalid is an invalid DBI (the max value for the type). it shouldn't", "// be possible to create a database handle with value dbiInvalid because", "// the process address space would be exhausted. it is also imprac...
// DBI returns the cursor's database handle. If c has been closed than an // invalid DBI is returned.
[ "DBI", "returns", "the", "cursor", "s", "database", "handle", ".", "If", "c", "has", "been", "closed", "than", "an", "invalid", "DBI", "is", "returned", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/cursor.go#L120-L132
140,286
bmatsuo/lmdb-go
lmdb/cursor.go
Put
func (c *Cursor) Put(key, val []byte, flags uint) error { if len(key) == 0 { return c.putNilKey(flags) } vn := len(val) if vn == 0 { val = []byte{0} } ret := C.lmdbgo_mdb_cursor_put2( c._c, (*C.char)(unsafe.Pointer(&key[0])), C.size_t(len(key)), (*C.char)(unsafe.Pointer(&val[0])), C.size_t(len(val)), ...
go
func (c *Cursor) Put(key, val []byte, flags uint) error { if len(key) == 0 { return c.putNilKey(flags) } vn := len(val) if vn == 0 { val = []byte{0} } ret := C.lmdbgo_mdb_cursor_put2( c._c, (*C.char)(unsafe.Pointer(&key[0])), C.size_t(len(key)), (*C.char)(unsafe.Pointer(&val[0])), C.size_t(len(val)), ...
[ "func", "(", "c", "*", "Cursor", ")", "Put", "(", "key", ",", "val", "[", "]", "byte", ",", "flags", "uint", ")", "error", "{", "if", "len", "(", "key", ")", "==", "0", "{", "return", "c", ".", "putNilKey", "(", "flags", ")", "\n", "}", "\n",...
// Put stores an item in the database. // // See mdb_cursor_put.
[ "Put", "stores", "an", "item", "in", "the", "database", ".", "See", "mdb_cursor_put", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/cursor.go#L232-L247
140,287
bmatsuo/lmdb-go
lmdb/cursor.go
Del
func (c *Cursor) Del(flags uint) error { ret := C.mdb_cursor_del(c._c, C.uint(flags)) return operrno("mdb_cursor_del", ret) }
go
func (c *Cursor) Del(flags uint) error { ret := C.mdb_cursor_del(c._c, C.uint(flags)) return operrno("mdb_cursor_del", ret) }
[ "func", "(", "c", "*", "Cursor", ")", "Del", "(", "flags", "uint", ")", "error", "{", "ret", ":=", "C", ".", "mdb_cursor_del", "(", "c", ".", "_c", ",", "C", ".", "uint", "(", "flags", ")", ")", "\n", "return", "operrno", "(", "\"", "\"", ",", ...
// Del deletes the item referred to by the cursor from the database. // // See mdb_cursor_del.
[ "Del", "deletes", "the", "item", "referred", "to", "by", "the", "cursor", "from", "the", "database", ".", "See", "mdb_cursor_del", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/cursor.go#L300-L303
140,288
bmatsuo/lmdb-go
lmdb/cursor.go
Count
func (c *Cursor) Count() (uint64, error) { var _size C.size_t ret := C.mdb_cursor_count(c._c, &_size) if ret != success { return 0, operrno("mdb_cursor_count", ret) } return uint64(_size), nil }
go
func (c *Cursor) Count() (uint64, error) { var _size C.size_t ret := C.mdb_cursor_count(c._c, &_size) if ret != success { return 0, operrno("mdb_cursor_count", ret) } return uint64(_size), nil }
[ "func", "(", "c", "*", "Cursor", ")", "Count", "(", ")", "(", "uint64", ",", "error", ")", "{", "var", "_size", "C", ".", "size_t", "\n", "ret", ":=", "C", ".", "mdb_cursor_count", "(", "c", ".", "_c", ",", "&", "_size", ")", "\n", "if", "ret",...
// Count returns the number of duplicates for the current key. // // See mdb_cursor_count.
[ "Count", "returns", "the", "number", "of", "duplicates", "for", "the", "current", "key", ".", "See", "mdb_cursor_count", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/cursor.go#L308-L315
140,289
bmatsuo/lmdb-go
lmdb/msgfunc.go
lmdbgoMDBMsgFuncBridge
func lmdbgoMDBMsgFuncBridge(cmsg C.lmdbgo_ConstCString, _ctx C.size_t) C.int { ctx := msgctx(_ctx).get() msg := C.GoString(cmsg.p) err := ctx.fn(msg) if err != nil { ctx.err = err return -1 } return 0 }
go
func lmdbgoMDBMsgFuncBridge(cmsg C.lmdbgo_ConstCString, _ctx C.size_t) C.int { ctx := msgctx(_ctx).get() msg := C.GoString(cmsg.p) err := ctx.fn(msg) if err != nil { ctx.err = err return -1 } return 0 }
[ "func", "lmdbgoMDBMsgFuncBridge", "(", "cmsg", "C", ".", "lmdbgo_ConstCString", ",", "_ctx", "C", ".", "size_t", ")", "C", ".", "int", "{", "ctx", ":=", "msgctx", "(", "_ctx", ")", ".", "get", "(", ")", "\n", "msg", ":=", "C", ".", "GoString", "(", ...
// lmdbgoMDBMsgFuncBridge provides a static C function for handling MDB_msgfunc // callbacks. It performs string conversion and dynamic dispatch to a msgfunc // provided to Env.ReaderList. Any error returned by the msgfunc is cached and // -1 is returned to terminate the iteration. //export lmdbgoMDBMsgFuncBridge
[ "lmdbgoMDBMsgFuncBridge", "provides", "a", "static", "C", "function", "for", "handling", "MDB_msgfunc", "callbacks", ".", "It", "performs", "string", "conversion", "and", "dynamic", "dispatch", "to", "a", "msgfunc", "provided", "to", "Env", ".", "ReaderList", ".",...
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/msgfunc.go#L18-L27
140,290
bmatsuo/lmdb-go
lmdb/env.go
NewEnv
func NewEnv() (*Env, error) { env := new(Env) ret := C.mdb_env_create(&env._env) if ret != success { return nil, operrno("mdb_env_create", ret) } env.ckey = (*C.MDB_val)(C.malloc(C.size_t(unsafe.Sizeof(C.MDB_val{})))) env.cval = (*C.MDB_val)(C.malloc(C.size_t(unsafe.Sizeof(C.MDB_val{})))) runtime.SetFinalizer...
go
func NewEnv() (*Env, error) { env := new(Env) ret := C.mdb_env_create(&env._env) if ret != success { return nil, operrno("mdb_env_create", ret) } env.ckey = (*C.MDB_val)(C.malloc(C.size_t(unsafe.Sizeof(C.MDB_val{})))) env.cval = (*C.MDB_val)(C.malloc(C.size_t(unsafe.Sizeof(C.MDB_val{})))) runtime.SetFinalizer...
[ "func", "NewEnv", "(", ")", "(", "*", "Env", ",", "error", ")", "{", "env", ":=", "new", "(", "Env", ")", "\n", "ret", ":=", "C", ".", "mdb_env_create", "(", "&", "env", ".", "_env", ")", "\n", "if", "ret", "!=", "success", "{", "return", "nil"...
// NewEnv allocates and initializes a new Env. // // See mdb_env_create.
[ "NewEnv", "allocates", "and", "initializes", "a", "new", "Env", ".", "See", "mdb_env_create", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L78-L89
140,291
bmatsuo/lmdb-go
lmdb/env.go
ReaderList
func (env *Env) ReaderList(fn func(string) error) error { ctx, done := newMsgFunc(fn) defer done() if fn == nil { ctx = 0 } ret := C.lmdbgo_mdb_reader_list(env._env, C.size_t(ctx)) if ret >= 0 { return nil } if ret < 0 && ctx != 0 { err := ctx.get().err if err != nil { return err } } return oper...
go
func (env *Env) ReaderList(fn func(string) error) error { ctx, done := newMsgFunc(fn) defer done() if fn == nil { ctx = 0 } ret := C.lmdbgo_mdb_reader_list(env._env, C.size_t(ctx)) if ret >= 0 { return nil } if ret < 0 && ctx != 0 { err := ctx.get().err if err != nil { return err } } return oper...
[ "func", "(", "env", "*", "Env", ")", "ReaderList", "(", "fn", "func", "(", "string", ")", "error", ")", "error", "{", "ctx", ",", "done", ":=", "newMsgFunc", "(", "fn", ")", "\n", "defer", "done", "(", ")", "\n", "if", "fn", "==", "nil", "{", "...
// ReaderList dumps the contents of the reader lock table as text. Readers // start on the second line as space-delimited fields described by the first // line. // // See mdb_reader_list.
[ "ReaderList", "dumps", "the", "contents", "of", "the", "reader", "lock", "table", "as", "text", ".", "Readers", "start", "on", "the", "second", "line", "as", "space", "-", "delimited", "fields", "described", "by", "the", "first", "line", ".", "See", "mdb_r...
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L135-L153
140,292
bmatsuo/lmdb-go
lmdb/env.go
Close
func (env *Env) Close() error { if env.close() { runtime.SetFinalizer(env, nil) return nil } return errors.New("environment is already closed") }
go
func (env *Env) Close() error { if env.close() { runtime.SetFinalizer(env, nil) return nil } return errors.New("environment is already closed") }
[ "func", "(", "env", "*", "Env", ")", "Close", "(", ")", "error", "{", "if", "env", ".", "close", "(", ")", "{", "runtime", ".", "SetFinalizer", "(", "env", ",", "nil", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "errors", ".", "New", ...
// Close shuts down the environment, releases the memory map, and clears the // finalizer on env. // // See mdb_env_close.
[ "Close", "shuts", "down", "the", "environment", "releases", "the", "memory", "map", "and", "clears", "the", "finalizer", "on", "env", ".", "See", "mdb_env_close", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L186-L192
140,293
bmatsuo/lmdb-go
lmdb/env.go
CopyFD
func (env *Env) CopyFD(fd uintptr) error { ret := C.mdb_env_copyfd(env._env, C.mdb_filehandle_t(fd)) return operrno("mdb_env_copyfd", ret) }
go
func (env *Env) CopyFD(fd uintptr) error { ret := C.mdb_env_copyfd(env._env, C.mdb_filehandle_t(fd)) return operrno("mdb_env_copyfd", ret) }
[ "func", "(", "env", "*", "Env", ")", "CopyFD", "(", "fd", "uintptr", ")", "error", "{", "ret", ":=", "C", ".", "mdb_env_copyfd", "(", "env", ".", "_env", ",", "C", ".", "mdb_filehandle_t", "(", "fd", ")", ")", "\n", "return", "operrno", "(", "\"", ...
// CopyFD copies env to the the file descriptor fd. // // See mdb_env_copyfd.
[ "CopyFD", "copies", "env", "to", "the", "the", "file", "descriptor", "fd", ".", "See", "mdb_env_copyfd", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L197-L200
140,294
bmatsuo/lmdb-go
lmdb/env.go
CopyFDFlag
func (env *Env) CopyFDFlag(fd uintptr, flags uint) error { ret := C.mdb_env_copyfd2(env._env, C.mdb_filehandle_t(fd), C.uint(flags)) return operrno("mdb_env_copyfd2", ret) }
go
func (env *Env) CopyFDFlag(fd uintptr, flags uint) error { ret := C.mdb_env_copyfd2(env._env, C.mdb_filehandle_t(fd), C.uint(flags)) return operrno("mdb_env_copyfd2", ret) }
[ "func", "(", "env", "*", "Env", ")", "CopyFDFlag", "(", "fd", "uintptr", ",", "flags", "uint", ")", "error", "{", "ret", ":=", "C", ".", "mdb_env_copyfd2", "(", "env", ".", "_env", ",", "C", ".", "mdb_filehandle_t", "(", "fd", ")", ",", "C", ".", ...
// CopyFDFlag copies env to the file descriptor fd, with options. // // See mdb_env_copyfd2.
[ "CopyFDFlag", "copies", "env", "to", "the", "file", "descriptor", "fd", "with", "options", ".", "See", "mdb_env_copyfd2", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L205-L208
140,295
bmatsuo/lmdb-go
lmdb/env.go
Copy
func (env *Env) Copy(path string) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ret := C.mdb_env_copy(env._env, cpath) return operrno("mdb_env_copy", ret) }
go
func (env *Env) Copy(path string) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ret := C.mdb_env_copy(env._env, cpath) return operrno("mdb_env_copy", ret) }
[ "func", "(", "env", "*", "Env", ")", "Copy", "(", "path", "string", ")", "error", "{", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", ")", ")", "\n", "ret", ":...
// Copy copies the data in env to an environment at path. // // See mdb_env_copy.
[ "Copy", "copies", "the", "data", "in", "env", "to", "an", "environment", "at", "path", ".", "See", "mdb_env_copy", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L213-L218
140,296
bmatsuo/lmdb-go
lmdb/env.go
CopyFlag
func (env *Env) CopyFlag(path string, flags uint) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ret := C.mdb_env_copy2(env._env, cpath, C.uint(flags)) return operrno("mdb_env_copy2", ret) }
go
func (env *Env) CopyFlag(path string, flags uint) error { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) ret := C.mdb_env_copy2(env._env, cpath, C.uint(flags)) return operrno("mdb_env_copy2", ret) }
[ "func", "(", "env", "*", "Env", ")", "CopyFlag", "(", "path", "string", ",", "flags", "uint", ")", "error", "{", "cpath", ":=", "C", ".", "CString", "(", "path", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cpath", "...
// CopyFlag copies the data in env to an environment at path created with flags. // // See mdb_env_copy2.
[ "CopyFlag", "copies", "the", "data", "in", "env", "to", "an", "environment", "at", "path", "created", "with", "flags", ".", "See", "mdb_env_copy2", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L223-L228
140,297
bmatsuo/lmdb-go
lmdb/env.go
Info
func (env *Env) Info() (*EnvInfo, error) { var _info C.MDB_envinfo ret := C.mdb_env_info(env._env, &_info) if ret != success { return nil, operrno("mdb_env_info", ret) } info := EnvInfo{ MapSize: int64(_info.me_mapsize), LastPNO: int64(_info.me_last_pgno), LastTxnID: int64(_info.me_last_txnid), Ma...
go
func (env *Env) Info() (*EnvInfo, error) { var _info C.MDB_envinfo ret := C.mdb_env_info(env._env, &_info) if ret != success { return nil, operrno("mdb_env_info", ret) } info := EnvInfo{ MapSize: int64(_info.me_mapsize), LastPNO: int64(_info.me_last_pgno), LastTxnID: int64(_info.me_last_txnid), Ma...
[ "func", "(", "env", "*", "Env", ")", "Info", "(", ")", "(", "*", "EnvInfo", ",", "error", ")", "{", "var", "_info", "C", ".", "MDB_envinfo", "\n", "ret", ":=", "C", ".", "mdb_env_info", "(", "env", ".", "_env", ",", "&", "_info", ")", "\n", "if...
// Info returns information about the environment. // // See mdb_env_info.
[ "Info", "returns", "information", "about", "the", "environment", ".", "See", "mdb_env_info", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L274-L288
140,298
bmatsuo/lmdb-go
lmdb/env.go
Sync
func (env *Env) Sync(force bool) error { ret := C.mdb_env_sync(env._env, cbool(force)) return operrno("mdb_env_sync", ret) }
go
func (env *Env) Sync(force bool) error { ret := C.mdb_env_sync(env._env, cbool(force)) return operrno("mdb_env_sync", ret) }
[ "func", "(", "env", "*", "Env", ")", "Sync", "(", "force", "bool", ")", "error", "{", "ret", ":=", "C", ".", "mdb_env_sync", "(", "env", ".", "_env", ",", "cbool", "(", "force", ")", ")", "\n", "return", "operrno", "(", "\"", "\"", ",", "ret", ...
// Sync flushes buffers to disk. If force is true a synchronous flush occurs // and ignores any NoSync or MapAsync flag on the environment. // // See mdb_env_sync.
[ "Sync", "flushes", "buffers", "to", "disk", ".", "If", "force", "is", "true", "a", "synchronous", "flush", "occurs", "and", "ignores", "any", "NoSync", "or", "MapAsync", "flag", "on", "the", "environment", ".", "See", "mdb_env_sync", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L294-L297
140,299
bmatsuo/lmdb-go
lmdb/env.go
SetFlags
func (env *Env) SetFlags(flags uint) error { ret := C.mdb_env_set_flags(env._env, C.uint(flags), C.int(1)) return operrno("mdb_env_set_flags", ret) }
go
func (env *Env) SetFlags(flags uint) error { ret := C.mdb_env_set_flags(env._env, C.uint(flags), C.int(1)) return operrno("mdb_env_set_flags", ret) }
[ "func", "(", "env", "*", "Env", ")", "SetFlags", "(", "flags", "uint", ")", "error", "{", "ret", ":=", "C", ".", "mdb_env_set_flags", "(", "env", ".", "_env", ",", "C", ".", "uint", "(", "flags", ")", ",", "C", ".", "int", "(", "1", ")", ")", ...
// SetFlags sets flags in the environment. // // See mdb_env_set_flags.
[ "SetFlags", "sets", "flags", "in", "the", "environment", ".", "See", "mdb_env_set_flags", "." ]
a14b5a390eff52e52a20eceb3020038b3d291432
https://github.com/bmatsuo/lmdb-go/blob/a14b5a390eff52e52a20eceb3020038b3d291432/lmdb/env.go#L302-L305