repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
giantswarm/certctl
service/role/error.go
IsNoVaultHandlerDefined
func IsNoVaultHandlerDefined(err error) bool { cause := microerror.Cause(err) if cause != nil && strings.Contains(cause.Error(), "no handler for route") { return true } return false }
go
func IsNoVaultHandlerDefined(err error) bool { cause := microerror.Cause(err) if cause != nil && strings.Contains(cause.Error(), "no handler for route") { return true } return false }
[ "func", "IsNoVaultHandlerDefined", "(", "err", "error", ")", "bool", "{", "cause", ":=", "microerror", ".", "Cause", "(", "err", ")", "\n", "if", "cause", "!=", "nil", "&&", "strings", ".", "Contains", "(", "cause", ".", "Error", "(", ")", ",", "\"no h...
// IsNoVaultHandlerDefined asserts a dirty string matching against the error // message provided by err. This is necessary due to the poor error handling // design of the Vault library we are using.
[ "IsNoVaultHandlerDefined", "asserts", "a", "dirty", "string", "matching", "against", "the", "error", "message", "provided", "by", "err", ".", "This", "is", "necessary", "due", "to", "the", "poor", "error", "handling", "design", "of", "the", "Vault", "library", ...
2a6615f61499cd09a8d5ced9a5fade322d2de254
https://github.com/giantswarm/certctl/blob/2a6615f61499cd09a8d5ced9a5fade322d2de254/service/role/error.go#L21-L29
test
giantswarm/certctl
service/role/service.go
New
func New(config Config) (Service, error) { // Dependencies. if config.VaultClient == nil { return nil, microerror.Maskf(invalidConfigError, "Vault client must not be empty") } if config.PKIMountpoint == "" { return nil, microerror.Maskf(invalidConfigError, "PKIMountpoint must not be empty") } service := &se...
go
func New(config Config) (Service, error) { // Dependencies. if config.VaultClient == nil { return nil, microerror.Maskf(invalidConfigError, "Vault client must not be empty") } if config.PKIMountpoint == "" { return nil, microerror.Maskf(invalidConfigError, "PKIMountpoint must not be empty") } service := &se...
[ "func", "New", "(", "config", "Config", ")", "(", "Service", ",", "error", ")", "{", "if", "config", ".", "VaultClient", "==", "nil", "{", "return", "nil", ",", "microerror", ".", "Maskf", "(", "invalidConfigError", ",", "\"Vault client must not be empty\"", ...
// New takes a configuration and returns a configured service.
[ "New", "takes", "a", "configuration", "and", "returns", "a", "configured", "service", "." ]
2a6615f61499cd09a8d5ced9a5fade322d2de254
https://github.com/giantswarm/certctl/blob/2a6615f61499cd09a8d5ced9a5fade322d2de254/service/role/service.go#L27-L43
test
giantswarm/certctl
service/role/service.go
Create
func (s *service) Create(params CreateParams) error { logicalStore := s.vaultClient.Logical() data := map[string]interface{}{ "allowed_domains": params.AllowedDomains, "allow_subdomains": params.AllowSubdomains, "ttl": params.TTL, "allow_bare_domains": params.AllowBareDomains, "organiza...
go
func (s *service) Create(params CreateParams) error { logicalStore := s.vaultClient.Logical() data := map[string]interface{}{ "allowed_domains": params.AllowedDomains, "allow_subdomains": params.AllowSubdomains, "ttl": params.TTL, "allow_bare_domains": params.AllowBareDomains, "organiza...
[ "func", "(", "s", "*", "service", ")", "Create", "(", "params", "CreateParams", ")", "error", "{", "logicalStore", ":=", "s", ".", "vaultClient", ".", "Logical", "(", ")", "\n", "data", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"...
// Create creates a role if it doesn't exist yet. Creating roles is idempotent // in the vault api, so no need to check if it already exists.
[ "Create", "creates", "a", "role", "if", "it", "doesn", "t", "exist", "yet", ".", "Creating", "roles", "is", "idempotent", "in", "the", "vault", "api", "so", "no", "need", "to", "check", "if", "it", "already", "exists", "." ]
2a6615f61499cd09a8d5ced9a5fade322d2de254
https://github.com/giantswarm/certctl/blob/2a6615f61499cd09a8d5ced9a5fade322d2de254/service/role/service.go#L55-L71
test
fossapps/captain
captain.go
CreateJob
func CreateJob() Config { return Config{ LockProvider: nil, RuntimeProcessor: nil, ResultProcessor: nil, RuntimeProcessingFrequency: 200 * time.Millisecond, SummaryBuffer: 1, } }
go
func CreateJob() Config { return Config{ LockProvider: nil, RuntimeProcessor: nil, ResultProcessor: nil, RuntimeProcessingFrequency: 200 * time.Millisecond, SummaryBuffer: 1, } }
[ "func", "CreateJob", "(", ")", "Config", "{", "return", "Config", "{", "LockProvider", ":", "nil", ",", "RuntimeProcessor", ":", "nil", ",", "ResultProcessor", ":", "nil", ",", "RuntimeProcessingFrequency", ":", "200", "*", "time", ".", "Millisecond", ",", "...
// CreateJob creates a basic empty configuration with some defaults.
[ "CreateJob", "creates", "a", "basic", "empty", "configuration", "with", "some", "defaults", "." ]
0f30dc3a624d523638831aa2bcb08bc962234a95
https://github.com/fossapps/captain/blob/0f30dc3a624d523638831aa2bcb08bc962234a95/captain.go#L44-L52
test
fossapps/captain
captain.go
Run
func (config *Config) Run() { err := config.ensureLock() if err != nil { panic(err) } err = config.runWorker() if err != nil { panic(err) } }
go
func (config *Config) Run() { err := config.ensureLock() if err != nil { panic(err) } err = config.runWorker() if err != nil { panic(err) } }
[ "func", "(", "config", "*", "Config", ")", "Run", "(", ")", "{", "err", ":=", "config", ".", "ensureLock", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "err", "=", "config", ".", "runWorker", "(", ")...
// Run starts the job
[ "Run", "starts", "the", "job" ]
0f30dc3a624d523638831aa2bcb08bc962234a95
https://github.com/fossapps/captain/blob/0f30dc3a624d523638831aa2bcb08bc962234a95/captain.go#L80-L89
test
gokyle/fswatch
watcher.go
newWatcher
func newWatcher(dir_notify bool, initpaths ...string) (w *Watcher) { w = new(Watcher) w.auto_watch = dir_notify w.paths = make(map[string]*watchItem, 0) var paths []string for _, path := range initpaths { matches, err := filepath.Glob(path) if err != nil { continue } paths = append(paths, matches...) ...
go
func newWatcher(dir_notify bool, initpaths ...string) (w *Watcher) { w = new(Watcher) w.auto_watch = dir_notify w.paths = make(map[string]*watchItem, 0) var paths []string for _, path := range initpaths { matches, err := filepath.Glob(path) if err != nil { continue } paths = append(paths, matches...) ...
[ "func", "newWatcher", "(", "dir_notify", "bool", ",", "initpaths", "...", "string", ")", "(", "w", "*", "Watcher", ")", "{", "w", "=", "new", "(", "Watcher", ")", "\n", "w", ".", "auto_watch", "=", "dir_notify", "\n", "w", ".", "paths", "=", "make", ...
// newWatcher is the internal function for properly setting up a new watcher.
[ "newWatcher", "is", "the", "internal", "function", "for", "properly", "setting", "up", "a", "new", "watcher", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L19-L40
test
gokyle/fswatch
watcher.go
Start
func (w *Watcher) Start() <-chan *Notification { if w.notify_chan != nil { return w.notify_chan } if w.auto_watch { w.add_chan = make(chan *watchItem, NotificationBufLen) go w.watchItemListener() } w.notify_chan = make(chan *Notification, NotificationBufLen) go w.watch(w.notify_chan) return w.notify_chan }
go
func (w *Watcher) Start() <-chan *Notification { if w.notify_chan != nil { return w.notify_chan } if w.auto_watch { w.add_chan = make(chan *watchItem, NotificationBufLen) go w.watchItemListener() } w.notify_chan = make(chan *Notification, NotificationBufLen) go w.watch(w.notify_chan) return w.notify_chan }
[ "func", "(", "w", "*", "Watcher", ")", "Start", "(", ")", "<-", "chan", "*", "Notification", "{", "if", "w", ".", "notify_chan", "!=", "nil", "{", "return", "w", ".", "notify_chan", "\n", "}", "\n", "if", "w", ".", "auto_watch", "{", "w", ".", "a...
// Start begins watching the files, sending notifications when files change. // It returns a channel that notifications are sent on.
[ "Start", "begins", "watching", "the", "files", "sending", "notifications", "when", "files", "change", ".", "It", "returns", "a", "channel", "that", "notifications", "are", "sent", "on", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L59-L70
test
gokyle/fswatch
watcher.go
Stop
func (w *Watcher) Stop() { if w.notify_chan != nil { close(w.notify_chan) } if w.add_chan != nil { close(w.add_chan) } }
go
func (w *Watcher) Stop() { if w.notify_chan != nil { close(w.notify_chan) } if w.add_chan != nil { close(w.add_chan) } }
[ "func", "(", "w", "*", "Watcher", ")", "Stop", "(", ")", "{", "if", "w", ".", "notify_chan", "!=", "nil", "{", "close", "(", "w", ".", "notify_chan", ")", "\n", "}", "\n", "if", "w", ".", "add_chan", "!=", "nil", "{", "close", "(", "w", ".", ...
// Stop listening for changes to the files.
[ "Stop", "listening", "for", "changes", "to", "the", "files", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L73-L81
test
gokyle/fswatch
watcher.go
Active
func (w *Watcher) Active() bool { return w.paths != nil && len(w.paths) > 0 }
go
func (w *Watcher) Active() bool { return w.paths != nil && len(w.paths) > 0 }
[ "func", "(", "w", "*", "Watcher", ")", "Active", "(", ")", "bool", "{", "return", "w", ".", "paths", "!=", "nil", "&&", "len", "(", "w", ".", "paths", ")", ">", "0", "\n", "}" ]
// Returns true if the Watcher is actively looking for changes.
[ "Returns", "true", "if", "the", "Watcher", "is", "actively", "looking", "for", "changes", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L84-L86
test
gokyle/fswatch
watcher.go
Add
func (w *Watcher) Add(inpaths ...string) { var paths []string for _, path := range inpaths { matches, err := filepath.Glob(path) if err != nil { continue } paths = append(paths, matches...) } if w.auto_watch && w.notify_chan != nil { for _, path := range paths { wi := watchPath(path) w.addPaths(w...
go
func (w *Watcher) Add(inpaths ...string) { var paths []string for _, path := range inpaths { matches, err := filepath.Glob(path) if err != nil { continue } paths = append(paths, matches...) } if w.auto_watch && w.notify_chan != nil { for _, path := range paths { wi := watchPath(path) w.addPaths(w...
[ "func", "(", "w", "*", "Watcher", ")", "Add", "(", "inpaths", "...", "string", ")", "{", "var", "paths", "[", "]", "string", "\n", "for", "_", ",", "path", ":=", "range", "inpaths", "{", "matches", ",", "err", ":=", "filepath", ".", "Glob", "(", ...
// The Add method takes a variable number of string arguments and adds those // files to the watch list, returning the number of files added.
[ "The", "Add", "method", "takes", "a", "variable", "number", "of", "string", "arguments", "and", "adds", "those", "files", "to", "the", "watch", "list", "returning", "the", "number", "of", "files", "added", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L90-L111
test
gokyle/fswatch
watcher.go
watch
func (w *Watcher) watch(sndch chan<- *Notification) { defer func() { recover() }() for { <-time.After(WatchDelay) for _, wi := range w.paths { if wi.Update() && w.shouldNotify(wi) { sndch <- wi.Notification() } if wi.LastEvent == NOEXIST && w.auto_watch { delete(w.paths, wi.Path) } if ...
go
func (w *Watcher) watch(sndch chan<- *Notification) { defer func() { recover() }() for { <-time.After(WatchDelay) for _, wi := range w.paths { if wi.Update() && w.shouldNotify(wi) { sndch <- wi.Notification() } if wi.LastEvent == NOEXIST && w.auto_watch { delete(w.paths, wi.Path) } if ...
[ "func", "(", "w", "*", "Watcher", ")", "watch", "(", "sndch", "chan", "<-", "*", "Notification", ")", "{", "defer", "func", "(", ")", "{", "recover", "(", ")", "\n", "}", "(", ")", "\n", "for", "{", "<-", "time", ".", "After", "(", "WatchDelay", ...
// goroutine that cycles through the list of paths and checks for updates.
[ "goroutine", "that", "cycles", "through", "the", "list", "of", "paths", "and", "checks", "for", "updates", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L114-L134
test
gokyle/fswatch
watcher.go
Watching
func (w *Watcher) Watching() (paths []string) { paths = make([]string, 0) for path, _ := range w.paths { paths = append(paths, path) } return }
go
func (w *Watcher) Watching() (paths []string) { paths = make([]string, 0) for path, _ := range w.paths { paths = append(paths, path) } return }
[ "func", "(", "w", "*", "Watcher", ")", "Watching", "(", ")", "(", "paths", "[", "]", "string", ")", "{", "paths", "=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "path", ",", "_", ":=", "range", "w", ".", "paths", "{", "path...
// Watching returns a list of the files being watched.
[ "Watching", "returns", "a", "list", "of", "the", "files", "being", "watched", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L231-L237
test
gokyle/fswatch
watcher.go
State
func (w *Watcher) State() (state []Notification) { state = make([]Notification, 0) if w.paths == nil { return } for _, wi := range w.paths { state = append(state, *wi.Notification()) } return }
go
func (w *Watcher) State() (state []Notification) { state = make([]Notification, 0) if w.paths == nil { return } for _, wi := range w.paths { state = append(state, *wi.Notification()) } return }
[ "func", "(", "w", "*", "Watcher", ")", "State", "(", ")", "(", "state", "[", "]", "Notification", ")", "{", "state", "=", "make", "(", "[", "]", "Notification", ",", "0", ")", "\n", "if", "w", ".", "paths", "==", "nil", "{", "return", "\n", "}"...
// State returns a slice of Notifications representing the files being watched // and their last event.
[ "State", "returns", "a", "slice", "of", "Notifications", "representing", "the", "files", "being", "watched", "and", "their", "last", "event", "." ]
1dbdf8320a690537582afe0f45c947f501adeaad
https://github.com/gokyle/fswatch/blob/1dbdf8320a690537582afe0f45c947f501adeaad/watcher.go#L241-L250
test
bluekeyes/hatpear
hatpear.go
Store
func Store(r *http.Request, err error) { errptr, ok := r.Context().Value(errorKey).(*error) if !ok { panic("hatpear: request not configured to store errors") } // check err after checking context to fail fast if unconfigured if err != nil { *errptr = err } }
go
func Store(r *http.Request, err error) { errptr, ok := r.Context().Value(errorKey).(*error) if !ok { panic("hatpear: request not configured to store errors") } // check err after checking context to fail fast if unconfigured if err != nil { *errptr = err } }
[ "func", "Store", "(", "r", "*", "http", ".", "Request", ",", "err", "error", ")", "{", "errptr", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "errorKey", ")", ".", "(", "*", "error", ")", "\n", "if", "!", "ok", "{", "pan...
// Store stores an error into the request's context. It panics if the request // was not configured to store errors.
[ "Store", "stores", "an", "error", "into", "the", "request", "s", "context", ".", "It", "panics", "if", "the", "request", "was", "not", "configured", "to", "store", "errors", "." ]
ffb42d5bb417aa8e12b3b7ff73d028b915dafa10
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L26-L35
test
bluekeyes/hatpear
hatpear.go
Get
func Get(r *http.Request) error { errptr, ok := r.Context().Value(errorKey).(*error) if !ok { return nil } return *errptr }
go
func Get(r *http.Request) error { errptr, ok := r.Context().Value(errorKey).(*error) if !ok { return nil } return *errptr }
[ "func", "Get", "(", "r", "*", "http", ".", "Request", ")", "error", "{", "errptr", ",", "ok", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "errorKey", ")", ".", "(", "*", "error", ")", "\n", "if", "!", "ok", "{", "return", "nil", "...
// Get retrieves an error from the request's context. It returns nil if the // request was not configured to store errors.
[ "Get", "retrieves", "an", "error", "from", "the", "request", "s", "context", ".", "It", "returns", "nil", "if", "the", "request", "was", "not", "configured", "to", "store", "errors", "." ]
ffb42d5bb417aa8e12b3b7ff73d028b915dafa10
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L39-L45
test
bluekeyes/hatpear
hatpear.go
Catch
func Catch(h func(w http.ResponseWriter, r *http.Request, err error)) Middleware { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error ctx := context.WithValue(r.Context(), errorKey, &err) next.ServeHTTP(w, r.WithContext(ctx)) ...
go
func Catch(h func(w http.ResponseWriter, r *http.Request, err error)) Middleware { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error ctx := context.WithValue(r.Context(), errorKey, &err) next.ServeHTTP(w, r.WithContext(ctx)) ...
[ "func", "Catch", "(", "h", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "err", "error", ")", ")", "Middleware", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", ...
// Catch creates middleware that processes errors stored while serving a // request. Errors are passed to the callback, which should write them to the // response in an appropriate format. This is usually the outermost middleware // in a chain.
[ "Catch", "creates", "middleware", "that", "processes", "errors", "stored", "while", "serving", "a", "request", ".", "Errors", "are", "passed", "to", "the", "callback", "which", "should", "write", "them", "to", "the", "response", "in", "an", "appropriate", "for...
ffb42d5bb417aa8e12b3b7ff73d028b915dafa10
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L54-L66
test
bluekeyes/hatpear
hatpear.go
Try
func Try(h Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := h.ServeHTTP(w, r) Store(r, err) }) }
go
func Try(h Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := h.ServeHTTP(w, r) Store(r, err) }) }
[ "func", "Try", "(", "h", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "err", ":=", "h", ".", "ServeHTTP", "...
// Try converts a handler to a standard http.Handler, storing any error in the // request's context.
[ "Try", "converts", "a", "handler", "to", "a", "standard", "http", ".", "Handler", "storing", "any", "error", "in", "the", "request", "s", "context", "." ]
ffb42d5bb417aa8e12b3b7ff73d028b915dafa10
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L82-L87
test
bluekeyes/hatpear
hatpear.go
Recover
func Recover() Middleware { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer func() { if v := recover(); v != nil { Store(r, PanicError{ value: v, stack: stack(1), }) } }() next.ServeHTTP(w, r) }) } }
go
func Recover() Middleware { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer func() { if v := recover(); v != nil { Store(r, PanicError{ value: v, stack: stack(1), }) } }() next.ServeHTTP(w, r) }) } }
[ "func", "Recover", "(", ")", "Middleware", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ...
// Recover creates middleware that can recover from a panic in a handler, // storing a PanicError for future handling.
[ "Recover", "creates", "middleware", "that", "can", "recover", "from", "a", "panic", "in", "a", "handler", "storing", "a", "PanicError", "for", "future", "handling", "." ]
ffb42d5bb417aa8e12b3b7ff73d028b915dafa10
https://github.com/bluekeyes/hatpear/blob/ffb42d5bb417aa8e12b3b7ff73d028b915dafa10/hatpear.go#L96-L110
test
jpillora/velox
example/go/perf/client/client.go
main
func main() { req, _ := http.NewRequest("GET", "http://localhost:7070/sync", nil) req.Header.Set("Accept", "text/event-stream") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatalf("request: %s", err) } r := resp.Body i := 0 buff := make([]byte, 32*1024) for { n, err := r.Read(buff) if err...
go
func main() { req, _ := http.NewRequest("GET", "http://localhost:7070/sync", nil) req.Header.Set("Accept", "text/event-stream") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatalf("request: %s", err) } r := resp.Body i := 0 buff := make([]byte, 32*1024) for { n, err := r.Read(buff) if err...
[ "func", "main", "(", ")", "{", "req", ",", "_", ":=", "http", ".", "NewRequest", "(", "\"GET\"", ",", "\"http://localhost:7070/sync\"", ",", "nil", ")", "\n", "req", ".", "Header", ".", "Set", "(", "\"Accept\"", ",", "\"text/event-stream\"", ")", "\n", "...
//go client for performance testing
[ "go", "client", "for", "performance", "testing" ]
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/example/go/perf/client/client.go#L12-L34
test
jpillora/velox
go/sync.go
SyncHandler
func SyncHandler(gostruct interface{}) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if conn, err := Sync(gostruct, w, r); err != nil { log.Printf("[velox] sync handler error: %s", err) } else { conn.Wait() } }) }
go
func SyncHandler(gostruct interface{}) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if conn, err := Sync(gostruct, w, r); err != nil { log.Printf("[velox] sync handler error: %s", err) } else { conn.Wait() } }) }
[ "func", "SyncHandler", "(", "gostruct", "interface", "{", "}", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "conn", ...
//SyncHandler is a small wrapper around Sync which simply synchronises //all incoming connections. Use Sync if you wish to implement user authentication //or any other request-time checks.
[ "SyncHandler", "is", "a", "small", "wrapper", "around", "Sync", "which", "simply", "synchronises", "all", "incoming", "connections", ".", "Use", "Sync", "if", "you", "wish", "to", "implement", "user", "authentication", "or", "any", "other", "request", "-", "ti...
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/sync.go#L21-L29
test
jpillora/velox
go/conn.go
connect
func (c *conn) connect(w http.ResponseWriter, r *http.Request) error { //choose transport if r.Header.Get("Accept") == "text/event-stream" { c.transport = &eventSourceTransport{writeTimeout: c.state.WriteTimeout} } else if r.Header.Get("Upgrade") == "websocket" { c.transport = &websocketsTransport{writeTimeout: ...
go
func (c *conn) connect(w http.ResponseWriter, r *http.Request) error { //choose transport if r.Header.Get("Accept") == "text/event-stream" { c.transport = &eventSourceTransport{writeTimeout: c.state.WriteTimeout} } else if r.Header.Get("Upgrade") == "websocket" { c.transport = &websocketsTransport{writeTimeout: ...
[ "func", "(", "c", "*", "conn", ")", "connect", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "if", "r", ".", "Header", ".", "Get", "(", "\"Accept\"", ")", "==", "\"text/event-stream\"", "{", "c", ...
//connect using the provided transport //and block until connection is ready
[ "connect", "using", "the", "provided", "transport", "and", "block", "until", "connection", "is", "ready" ]
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/conn.go#L76-L123
test
jpillora/velox
go/conn.go
send
func (c *conn) send(upd *update) error { c.sendingMut.Lock() defer c.sendingMut.Unlock() //send (transports responsiblity to enforce timeouts) return c.transport.send(upd) }
go
func (c *conn) send(upd *update) error { c.sendingMut.Lock() defer c.sendingMut.Unlock() //send (transports responsiblity to enforce timeouts) return c.transport.send(upd) }
[ "func", "(", "c", "*", "conn", ")", "send", "(", "upd", "*", "update", ")", "error", "{", "c", ".", "sendingMut", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "sendingMut", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "transport", ".", ...
//send to connection, ensure only 1 concurrent sender
[ "send", "to", "connection", "ensure", "only", "1", "concurrent", "sender" ]
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/conn.go#L177-L182
test
jpillora/velox
go/state.go
NumConnections
func (s *State) NumConnections() int { s.connMut.Lock() n := len(s.conns) s.connMut.Unlock() return n }
go
func (s *State) NumConnections() int { s.connMut.Lock() n := len(s.conns) s.connMut.Unlock() return n }
[ "func", "(", "s", "*", "State", ")", "NumConnections", "(", ")", "int", "{", "s", ".", "connMut", ".", "Lock", "(", ")", "\n", "n", ":=", "len", "(", "s", ".", "conns", ")", "\n", "s", ".", "connMut", ".", "Unlock", "(", ")", "\n", "return", ...
//NumConnections currently active
[ "NumConnections", "currently", "active" ]
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/state.go#L135-L140
test
jpillora/velox
go/state.go
Push
func (s *State) Push() bool { //attempt to mark state as 'pushing' if atomic.CompareAndSwapUint32(&s.push.ing, 0, 1) { go s.gopush() return true } //if already pushing, mark queued atomic.StoreUint32(&s.push.queued, 1) return false }
go
func (s *State) Push() bool { //attempt to mark state as 'pushing' if atomic.CompareAndSwapUint32(&s.push.ing, 0, 1) { go s.gopush() return true } //if already pushing, mark queued atomic.StoreUint32(&s.push.queued, 1) return false }
[ "func", "(", "s", "*", "State", ")", "Push", "(", ")", "bool", "{", "if", "atomic", ".", "CompareAndSwapUint32", "(", "&", "s", ".", "push", ".", "ing", ",", "0", ",", "1", ")", "{", "go", "s", ".", "gopush", "(", ")", "\n", "return", "true", ...
//Push the changes from this object to all connected clients. //Push is thread-safe and is throttled so it can be called //with abandon. Returns false if a Push is already in progress.
[ "Push", "the", "changes", "from", "this", "object", "to", "all", "connected", "clients", ".", "Push", "is", "thread", "-", "safe", "and", "is", "throttled", "so", "it", "can", "be", "called", "with", "abandon", ".", "Returns", "false", "if", "a", "Push",...
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/state.go#L145-L154
test
jpillora/velox
go/state.go
gopush
func (s *State) gopush() { s.push.mut.Lock() t0 := time.Now() //queue cleanup defer func() { //measure time passed, ensure we wait at least Throttle time tdelta := time.Now().Sub(t0) if t := s.Throttle - tdelta; t > 0 { time.Sleep(t) } //push complete s.push.mut.Unlock() atomic.StoreUint32(&s.push....
go
func (s *State) gopush() { s.push.mut.Lock() t0 := time.Now() //queue cleanup defer func() { //measure time passed, ensure we wait at least Throttle time tdelta := time.Now().Sub(t0) if t := s.Throttle - tdelta; t > 0 { time.Sleep(t) } //push complete s.push.mut.Unlock() atomic.StoreUint32(&s.push....
[ "func", "(", "s", "*", "State", ")", "gopush", "(", ")", "{", "s", ".", "push", ".", "mut", ".", "Lock", "(", ")", "\n", "t0", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "func", "(", ")", "{", "tdelta", ":=", "time", ".", "Now", "("...
//non-blocking push
[ "non", "-", "blocking", "push" ]
42845d32322027cde41ba6b065a083ea4120238f
https://github.com/jpillora/velox/blob/42845d32322027cde41ba6b065a083ea4120238f/go/state.go#L157-L210
test
fujiwara/fluent-agent-hydra
hydra/out_forward.go
NewOutForward
func NewOutForward(configServers []*ConfigServer) (*OutForward, error) { loggers := make([]*fluent.Fluent, len(configServers)) for i, server := range configServers { logger, err := fluent.New(fluent.Config{Server: server.Address()}) if err != nil { log.Println("[warning]", err) } else { log.Println("[info...
go
func NewOutForward(configServers []*ConfigServer) (*OutForward, error) { loggers := make([]*fluent.Fluent, len(configServers)) for i, server := range configServers { logger, err := fluent.New(fluent.Config{Server: server.Address()}) if err != nil { log.Println("[warning]", err) } else { log.Println("[info...
[ "func", "NewOutForward", "(", "configServers", "[", "]", "*", "ConfigServer", ")", "(", "*", "OutForward", ",", "error", ")", "{", "loggers", ":=", "make", "(", "[", "]", "*", "fluent", ".", "Fluent", ",", "len", "(", "configServers", ")", ")", "\n", ...
// OutForward ... recieve FluentRecordSet from channel, and send it to passed loggers until success.
[ "OutForward", "...", "recieve", "FluentRecordSet", "from", "channel", "and", "send", "it", "to", "passed", "loggers", "until", "success", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/hydra/out_forward.go#L24-L40
test
fujiwara/fluent-agent-hydra
hydra/in_tail.go
Run
func (t *InTail) Run(c *Context) { c.InputProcess.Add(1) defer c.InputProcess.Done() t.messageCh = c.MessageCh t.monitorCh = c.MonitorCh c.StartProcess.Done() if t.eventCh == nil { err := t.TailStdin(c) if err != nil { if _, ok := err.(Signal); ok { log.Println("[info]", err) } else { log.Pri...
go
func (t *InTail) Run(c *Context) { c.InputProcess.Add(1) defer c.InputProcess.Done() t.messageCh = c.MessageCh t.monitorCh = c.MonitorCh c.StartProcess.Done() if t.eventCh == nil { err := t.TailStdin(c) if err != nil { if _, ok := err.(Signal); ok { log.Println("[info]", err) } else { log.Pri...
[ "func", "(", "t", "*", "InTail", ")", "Run", "(", "c", "*", "Context", ")", "{", "c", ".", "InputProcess", ".", "Add", "(", "1", ")", "\n", "defer", "c", ".", "InputProcess", ".", "Done", "(", ")", "\n", "t", ".", "messageCh", "=", "c", ".", ...
// InTail follow the tail of file and post BulkMessage to channel.
[ "InTail", "follow", "the", "tail", "of", "file", "and", "post", "BulkMessage", "to", "channel", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/hydra/in_tail.go#L148-L204
test
fujiwara/fluent-agent-hydra
fluent/fluent.go
New
func New(config Config) (f *Fluent, err error) { if config.Server == "" { config.Server = defaultServer } if config.Timeout == 0 { config.Timeout = defaultTimeout } if config.RetryWait == 0 { config.RetryWait = defaultRetryWait } if config.MaxRetry == 0 { config.MaxRetry = defaultMaxRetry } f = &Fluent...
go
func New(config Config) (f *Fluent, err error) { if config.Server == "" { config.Server = defaultServer } if config.Timeout == 0 { config.Timeout = defaultTimeout } if config.RetryWait == 0 { config.RetryWait = defaultRetryWait } if config.MaxRetry == 0 { config.MaxRetry = defaultMaxRetry } f = &Fluent...
[ "func", "New", "(", "config", "Config", ")", "(", "f", "*", "Fluent", ",", "err", "error", ")", "{", "if", "config", ".", "Server", "==", "\"\"", "{", "config", ".", "Server", "=", "defaultServer", "\n", "}", "\n", "if", "config", ".", "Timeout", "...
// New creates a new Logger.
[ "New", "creates", "a", "new", "Logger", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/fluent/fluent.go#L66-L86
test
fujiwara/fluent-agent-hydra
fluent/fluent.go
Close
func (f *Fluent) Close() (err error) { if f.conn != nil { f.mu.Lock() defer f.mu.Unlock() } else { return } if f.conn != nil { f.conn.Close() f.conn = nil } return }
go
func (f *Fluent) Close() (err error) { if f.conn != nil { f.mu.Lock() defer f.mu.Unlock() } else { return } if f.conn != nil { f.conn.Close() f.conn = nil } return }
[ "func", "(", "f", "*", "Fluent", ")", "Close", "(", ")", "(", "err", "error", ")", "{", "if", "f", ".", "conn", "!=", "nil", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "}", "e...
// Close closes the connection.
[ "Close", "closes", "the", "connection", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/fluent/fluent.go#L89-L101
test
fujiwara/fluent-agent-hydra
fluent/fluent.go
IsReconnecting
func (f *Fluent) IsReconnecting() bool { f.mu.Lock() defer f.mu.Unlock() return f.reconnecting }
go
func (f *Fluent) IsReconnecting() bool { f.mu.Lock() defer f.mu.Unlock() return f.reconnecting }
[ "func", "(", "f", "*", "Fluent", ")", "IsReconnecting", "(", ")", "bool", "{", "f", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "f", ".", "reconnecting", "\n", "}" ]
// IsReconnecting return true if a reconnecting process in progress.
[ "IsReconnecting", "return", "true", "if", "a", "reconnecting", "process", "in", "progress", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/fluent/fluent.go#L121-L125
test
fujiwara/fluent-agent-hydra
fluent/fluent.go
connect
func (f *Fluent) connect() (err error) { host, port, err := net.SplitHostPort(f.Server) if err != nil { return err } addrs, err := net.LookupHost(host) if err != nil || len(addrs) == 0 { return err } // for DNS round robin n := Rand.Intn(len(addrs)) addr := addrs[n] var format string if strings.Contains(...
go
func (f *Fluent) connect() (err error) { host, port, err := net.SplitHostPort(f.Server) if err != nil { return err } addrs, err := net.LookupHost(host) if err != nil || len(addrs) == 0 { return err } // for DNS round robin n := Rand.Intn(len(addrs)) addr := addrs[n] var format string if strings.Contains(...
[ "func", "(", "f", "*", "Fluent", ")", "connect", "(", ")", "(", "err", "error", ")", "{", "host", ",", "port", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "f", ".", "Server", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\...
// connect establishes a new connection using the specified transport.
[ "connect", "establishes", "a", "new", "connection", "using", "the", "specified", "transport", "." ]
f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f
https://github.com/fujiwara/fluent-agent-hydra/blob/f5c1c02a0b892cf5c08918ec2ff7bbca71cc7e4f/fluent/fluent.go#L132-L157
test
haklop/gnotifier
gnotifier.go
Notification
func Notification(title, message string) GNotifier { config := &Config{title, message, 5000, ""} n := &notifier{Config: config} return n }
go
func Notification(title, message string) GNotifier { config := &Config{title, message, 5000, ""} n := &notifier{Config: config} return n }
[ "func", "Notification", "(", "title", ",", "message", "string", ")", "GNotifier", "{", "config", ":=", "&", "Config", "{", "title", ",", "message", ",", "5000", ",", "\"\"", "}", "\n", "n", ":=", "&", "notifier", "{", "Config", ":", "config", "}", "\...
// Notification is the builder
[ "Notification", "is", "the", "builder" ]
0de36badf60155d5953373ed432982b20c62fb91
https://github.com/haklop/gnotifier/blob/0de36badf60155d5953373ed432982b20c62fb91/gnotifier.go#L48-L52
test
haklop/gnotifier
gnotifier.go
NullNotification
func NullNotification(title, message string) GNotifier { config := &Config{title, message, 5000, ""} n := &nullNotifier{Config: config} return n }
go
func NullNotification(title, message string) GNotifier { config := &Config{title, message, 5000, ""} n := &nullNotifier{Config: config} return n }
[ "func", "NullNotification", "(", "title", ",", "message", "string", ")", "GNotifier", "{", "config", ":=", "&", "Config", "{", "title", ",", "message", ",", "5000", ",", "\"\"", "}", "\n", "n", ":=", "&", "nullNotifier", "{", "Config", ":", "config", "...
// NullNotification is the builder for tests where no side effects are desired
[ "NullNotification", "is", "the", "builder", "for", "tests", "where", "no", "side", "effects", "are", "desired" ]
0de36badf60155d5953373ed432982b20c62fb91
https://github.com/haklop/gnotifier/blob/0de36badf60155d5953373ed432982b20c62fb91/gnotifier.go#L71-L75
test
mastahyeti/fakeca
identity.go
New
func New(opts ...Option) *Identity { c := &configuration{} for _, opt := range opts { option(opt)(c) } return c.generate() }
go
func New(opts ...Option) *Identity { c := &configuration{} for _, opt := range opts { option(opt)(c) } return c.generate() }
[ "func", "New", "(", "opts", "...", "Option", ")", "*", "Identity", "{", "c", ":=", "&", "configuration", "{", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "option", "(", "opt", ")", "(", "c", ")", "\n", "}", "\n", "return", "c...
// New creates a new CA.
[ "New", "creates", "a", "new", "CA", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/identity.go#L24-L32
test
mastahyeti/fakeca
identity.go
Issue
func (id *Identity) Issue(opts ...Option) *Identity { opts = append(opts, Issuer(id)) return New(opts...) }
go
func (id *Identity) Issue(opts ...Option) *Identity { opts = append(opts, Issuer(id)) return New(opts...) }
[ "func", "(", "id", "*", "Identity", ")", "Issue", "(", "opts", "...", "Option", ")", "*", "Identity", "{", "opts", "=", "append", "(", "opts", ",", "Issuer", "(", "id", ")", ")", "\n", "return", "New", "(", "opts", "...", ")", "\n", "}" ]
// Issue issues a new Identity with this one as its parent.
[ "Issue", "issues", "a", "new", "Identity", "with", "this", "one", "as", "its", "parent", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/identity.go#L35-L38
test
mastahyeti/fakeca
configuration.go
Subject
func Subject(value pkix.Name) Option { return func(c *configuration) { c.subject = &value } }
go
func Subject(value pkix.Name) Option { return func(c *configuration) { c.subject = &value } }
[ "func", "Subject", "(", "value", "pkix", ".", "Name", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "subject", "=", "&", "value", "\n", "}", "\n", "}" ]
// Subject is an Option that sets a identity's subject field.
[ "Subject", "is", "an", "Option", "that", "sets", "a", "identity", "s", "subject", "field", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L171-L175
test
mastahyeti/fakeca
configuration.go
PrivateKey
func PrivateKey(value crypto.Signer) Option { return func(c *configuration) { c.priv = &value } }
go
func PrivateKey(value crypto.Signer) Option { return func(c *configuration) { c.priv = &value } }
[ "func", "PrivateKey", "(", "value", "crypto", ".", "Signer", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "priv", "=", "&", "value", "\n", "}", "\n", "}" ]
// PrivateKey is an Option for setting the identity's private key.
[ "PrivateKey", "is", "an", "Option", "for", "setting", "the", "identity", "s", "private", "key", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L186-L190
test
mastahyeti/fakeca
configuration.go
NotBefore
func NotBefore(value time.Time) Option { return func(c *configuration) { c.notBefore = &value } }
go
func NotBefore(value time.Time) Option { return func(c *configuration) { c.notBefore = &value } }
[ "func", "NotBefore", "(", "value", "time", ".", "Time", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "notBefore", "=", "&", "value", "\n", "}", "\n", "}" ]
// NotBefore is an Option for setting the identity's certificate's NotBefore.
[ "NotBefore", "is", "an", "Option", "for", "setting", "the", "identity", "s", "certificate", "s", "NotBefore", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L200-L204
test
mastahyeti/fakeca
configuration.go
NotAfter
func NotAfter(value time.Time) Option { return func(c *configuration) { c.notAfter = &value } }
go
func NotAfter(value time.Time) Option { return func(c *configuration) { c.notAfter = &value } }
[ "func", "NotAfter", "(", "value", "time", ".", "Time", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "notAfter", "=", "&", "value", "\n", "}", "\n", "}" ]
// NotAfter is an Option for setting the identity's certificate's NotAfter.
[ "NotAfter", "is", "an", "Option", "for", "setting", "the", "identity", "s", "certificate", "s", "NotAfter", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L207-L211
test
mastahyeti/fakeca
configuration.go
IssuingCertificateURL
func IssuingCertificateURL(value ...string) Option { return func(c *configuration) { c.issuingCertificateURL = append(c.issuingCertificateURL, value...) } }
go
func IssuingCertificateURL(value ...string) Option { return func(c *configuration) { c.issuingCertificateURL = append(c.issuingCertificateURL, value...) } }
[ "func", "IssuingCertificateURL", "(", "value", "...", "string", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "issuingCertificateURL", "=", "append", "(", "c", ".", "issuingCertificateURL", ",", "value", "...", ")"...
// IssuingCertificateURL is an Option for setting the identity's certificate's // IssuingCertificateURL.
[ "IssuingCertificateURL", "is", "an", "Option", "for", "setting", "the", "identity", "s", "certificate", "s", "IssuingCertificateURL", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L215-L219
test
mastahyeti/fakeca
configuration.go
OCSPServer
func OCSPServer(value ...string) Option { return func(c *configuration) { c.ocspServer = append(c.ocspServer, value...) } }
go
func OCSPServer(value ...string) Option { return func(c *configuration) { c.ocspServer = append(c.ocspServer, value...) } }
[ "func", "OCSPServer", "(", "value", "...", "string", ")", "Option", "{", "return", "func", "(", "c", "*", "configuration", ")", "{", "c", ".", "ocspServer", "=", "append", "(", "c", ".", "ocspServer", ",", "value", "...", ")", "\n", "}", "\n", "}" ]
// OCSPServer is an Option for setting the identity's certificate's OCSPServer.
[ "OCSPServer", "is", "an", "Option", "for", "setting", "the", "identity", "s", "certificate", "s", "OCSPServer", "." ]
c1d84b1b473e99212130da7b311dd0605de5ed0a
https://github.com/mastahyeti/fakeca/blob/c1d84b1b473e99212130da7b311dd0605de5ed0a/configuration.go#L222-L226
test
mrd0ll4r/tbotapi
api.go
New
func New(apiKey string) (*TelegramBotAPI, error) { toReturn := TelegramBotAPI{ Updates: make(chan BotUpdate), baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)), closed: make(chan struct{}), c: newClient(fmt.Sprintf(apiBaseURI, apiKey)), updateC: newClient(fmt.Sprintf(apiBaseURI, apiKey)),...
go
func New(apiKey string) (*TelegramBotAPI, error) { toReturn := TelegramBotAPI{ Updates: make(chan BotUpdate), baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)), closed: make(chan struct{}), c: newClient(fmt.Sprintf(apiBaseURI, apiKey)), updateC: newClient(fmt.Sprintf(apiBaseURI, apiKey)),...
[ "func", "New", "(", "apiKey", "string", ")", "(", "*", "TelegramBotAPI", ",", "error", ")", "{", "toReturn", ":=", "TelegramBotAPI", "{", "Updates", ":", "make", "(", "chan", "BotUpdate", ")", ",", "baseURIs", ":", "createEndpoints", "(", "fmt", ".", "Sp...
// New creates a new API Client for a Telegram bot using the apiKey // provided. // It will call the GetMe method to retrieve the bots id, name and // username. // // This bot uses long polling to retrieve its updates. If a webhook was set // for the given apiKey, this will remove it.
[ "New", "creates", "a", "new", "API", "Client", "for", "a", "Telegram", "bot", "using", "the", "apiKey", "provided", ".", "It", "will", "call", "the", "GetMe", "method", "to", "retrieve", "the", "bots", "id", "name", "and", "username", ".", "This", "bot",...
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/api.go#L60-L85
test
mrd0ll4r/tbotapi
api.go
NewWithWebhook
func NewWithWebhook(apiKey, webhookURL, certificate string) (*TelegramBotAPI, http.HandlerFunc, error) { toReturn := TelegramBotAPI{ Updates: make(chan BotUpdate), baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)), closed: make(chan struct{}), c: newClient(fmt.Sprintf(apiBaseURI, apiKey)), ...
go
func NewWithWebhook(apiKey, webhookURL, certificate string) (*TelegramBotAPI, http.HandlerFunc, error) { toReturn := TelegramBotAPI{ Updates: make(chan BotUpdate), baseURIs: createEndpoints(fmt.Sprintf(apiBaseURI, apiKey)), closed: make(chan struct{}), c: newClient(fmt.Sprintf(apiBaseURI, apiKey)), ...
[ "func", "NewWithWebhook", "(", "apiKey", ",", "webhookURL", ",", "certificate", "string", ")", "(", "*", "TelegramBotAPI", ",", "http", ".", "HandlerFunc", ",", "error", ")", "{", "toReturn", ":=", "TelegramBotAPI", "{", "Updates", ":", "make", "(", "chan", ...
// NewWithWebhook creates a new API client for a Telegram bot using the apiKey // provided. It will call the GetMe method to retrieve the bots id, name and // username. // In addition to the API client, a http.HandlerFunc will be returned. This // handler func reacts to webhook requests and will put updates into the //...
[ "NewWithWebhook", "creates", "a", "new", "API", "client", "for", "a", "Telegram", "bot", "using", "the", "apiKey", "provided", ".", "It", "will", "call", "the", "GetMe", "method", "to", "retrieve", "the", "bots", "id", "name", "and", "username", ".", "In",...
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/api.go#L93-L137
test
mrd0ll4r/tbotapi
api.go
Close
func (api *TelegramBotAPI) Close() { select { case <-api.closed: return default: } close(api.closed) api.wg.Wait() }
go
func (api *TelegramBotAPI) Close() { select { case <-api.closed: return default: } close(api.closed) api.wg.Wait() }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "Close", "(", ")", "{", "select", "{", "case", "<-", "api", ".", "closed", ":", "return", "\n", "default", ":", "}", "\n", "close", "(", "api", ".", "closed", ")", "\n", "api", ".", "wg", ".", "Wait...
// Close shuts down this client. // Until Close returns, new updates and errors will be put into the // respective channels. // Note that, if no updates are received, this function may block for up to // one minute, which is the time interval // for long polling.
[ "Close", "shuts", "down", "this", "client", ".", "Until", "Close", "returns", "new", "updates", "and", "errors", "will", "be", "put", "into", "the", "respective", "channels", ".", "Note", "that", "if", "no", "updates", "are", "received", "this", "function", ...
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/api.go#L145-L153
test
mrd0ll4r/tbotapi
api.go
GetMe
func (api *TelegramBotAPI) GetMe() (*UserResponse, error) { resp := &UserResponse{} _, err := api.c.get(getMe, resp) if err != nil { return nil, err } err = check(&resp.baseResponse) if err != nil { return nil, err } return resp, nil }
go
func (api *TelegramBotAPI) GetMe() (*UserResponse, error) { resp := &UserResponse{} _, err := api.c.get(getMe, resp) if err != nil { return nil, err } err = check(&resp.baseResponse) if err != nil { return nil, err } return resp, nil }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "GetMe", "(", ")", "(", "*", "UserResponse", ",", "error", ")", "{", "resp", ":=", "&", "UserResponse", "{", "}", "\n", "_", ",", "err", ":=", "api", ".", "c", ".", "get", "(", "getMe", ",", "resp",...
// GetMe returns basic information about the bot in form of a UserResponse.
[ "GetMe", "returns", "basic", "information", "about", "the", "bot", "in", "form", "of", "a", "UserResponse", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/api.go#L265-L277
test
mrd0ll4r/tbotapi
examples/boilerplate/boilerplate.go
RunBot
func RunBot(apiKey string, bot BotFunc, name, description string) { closing := make(chan struct{}) fmt.Printf("%s: %s\n", name, description) fmt.Println("Starting...") api, err := tbotapi.New(apiKey) if err != nil { log.Fatal(err) } // Just to show its working. fmt.Printf("User ID: %d\n", api.ID) fmt.Prin...
go
func RunBot(apiKey string, bot BotFunc, name, description string) { closing := make(chan struct{}) fmt.Printf("%s: %s\n", name, description) fmt.Println("Starting...") api, err := tbotapi.New(apiKey) if err != nil { log.Fatal(err) } // Just to show its working. fmt.Printf("User ID: %d\n", api.ID) fmt.Prin...
[ "func", "RunBot", "(", "apiKey", "string", ",", "bot", "BotFunc", ",", "name", ",", "description", "string", ")", "{", "closing", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "fmt", ".", "Printf", "(", "\"%s: %s\\n\"", ",", "\\n", ",", "...
// RunBot runs a bot. // It will block until either something very bad happens or closing is closed.
[ "RunBot", "runs", "a", "bot", ".", "It", "will", "block", "until", "either", "something", "very", "bad", "happens", "or", "closing", "is", "closed", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/examples/boilerplate/boilerplate.go#L25-L83
test
mrd0ll4r/tbotapi
examples/boilerplate/boilerplate.go
RunBotOnWebhook
func RunBotOnWebhook(apiKey string, bot BotFunc, name, description, webhookHost string, webhookPort uint16, pubkey, privkey string) { closing := make(chan struct{}) fmt.Printf("%s: %s\n", name, description) fmt.Println("Starting...") u := url.URL{ Host: webhookHost + ":" + fmt.Sprint(webhookPort), Scheme: "h...
go
func RunBotOnWebhook(apiKey string, bot BotFunc, name, description, webhookHost string, webhookPort uint16, pubkey, privkey string) { closing := make(chan struct{}) fmt.Printf("%s: %s\n", name, description) fmt.Println("Starting...") u := url.URL{ Host: webhookHost + ":" + fmt.Sprint(webhookPort), Scheme: "h...
[ "func", "RunBotOnWebhook", "(", "apiKey", "string", ",", "bot", "BotFunc", ",", "name", ",", "description", ",", "webhookHost", "string", ",", "webhookPort", "uint16", ",", "pubkey", ",", "privkey", "string", ")", "{", "closing", ":=", "make", "(", "chan", ...
// RunBotOnWebhook runs the given BotFunc with a webhook.
[ "RunBotOnWebhook", "runs", "the", "given", "BotFunc", "with", "a", "webhook", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/examples/boilerplate/boilerplate.go#L86-L155
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingMessage
func (api *TelegramBotAPI) NewOutgoingMessage(recipient Recipient, text string) *OutgoingMessage { return &OutgoingMessage{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Text: text, ParseMode: ModeDefault, } }
go
func (api *TelegramBotAPI) NewOutgoingMessage(recipient Recipient, text string) *OutgoingMessage { return &OutgoingMessage{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Text: text, ParseMode: ModeDefault, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingMessage", "(", "recipient", "Recipient", ",", "text", "string", ")", "*", "OutgoingMessage", "{", "return", "&", "OutgoingMessage", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase...
// NewOutgoingMessage creates a new outgoing message.
[ "NewOutgoingMessage", "creates", "a", "new", "outgoing", "message", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L10-L21
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingLocation
func (api *TelegramBotAPI) NewOutgoingLocation(recipient Recipient, latitude, longitude float32) *OutgoingLocation { return &OutgoingLocation{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Latitude: latitude, Longitude: longitud...
go
func (api *TelegramBotAPI) NewOutgoingLocation(recipient Recipient, latitude, longitude float32) *OutgoingLocation { return &OutgoingLocation{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Latitude: latitude, Longitude: longitud...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingLocation", "(", "recipient", "Recipient", ",", "latitude", ",", "longitude", "float32", ")", "*", "OutgoingLocation", "{", "return", "&", "OutgoingLocation", "{", "outgoingMessageBase", ":", "outgoingMessag...
// NewOutgoingLocation creates a new outgoing location.
[ "NewOutgoingLocation", "creates", "a", "new", "outgoing", "location", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L24-L35
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingVenue
func (api *TelegramBotAPI) NewOutgoingVenue(recipient Recipient, latitude, longitude float32, title, address string) *OutgoingVenue { return &OutgoingVenue{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Latitude: latitude, Longi...
go
func (api *TelegramBotAPI) NewOutgoingVenue(recipient Recipient, latitude, longitude float32, title, address string) *OutgoingVenue { return &OutgoingVenue{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, Latitude: latitude, Longi...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVenue", "(", "recipient", "Recipient", ",", "latitude", ",", "longitude", "float32", ",", "title", ",", "address", "string", ")", "*", "OutgoingVenue", "{", "return", "&", "OutgoingVenue", "{", "outgo...
// NewOutgoingVenue creates a new outgoing location.
[ "NewOutgoingVenue", "creates", "a", "new", "outgoing", "location", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L38-L51
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingVideo
func (api *TelegramBotAPI) NewOutgoingVideo(recipient Recipient, fileName string, reader io.Reader) *OutgoingVideo { return &OutgoingVideo{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
go
func (api *TelegramBotAPI) NewOutgoingVideo(recipient Recipient, fileName string, reader io.Reader) *OutgoingVideo { return &OutgoingVideo{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVideo", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingVideo", "{", "return", "&", "OutgoingVideo", "{", "outgoingMessageBase", ":", "...
// NewOutgoingVideo creates a new outgoing video file.
[ "NewOutgoingVideo", "creates", "a", "new", "outgoing", "video", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L54-L67
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingVideoResend
func (api *TelegramBotAPI) NewOutgoingVideoResend(recipient Recipient, fileID string) *OutgoingVideo { return &OutgoingVideo{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
go
func (api *TelegramBotAPI) NewOutgoingVideoResend(recipient Recipient, fileID string) *OutgoingVideo { return &OutgoingVideo{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVideoResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingVideo", "{", "return", "&", "OutgoingVideo", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBa...
// NewOutgoingVideoResend creates a new outgoing video file for re-sending.
[ "NewOutgoingVideoResend", "creates", "a", "new", "outgoing", "video", "file", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L70-L82
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingPhoto
func (api *TelegramBotAPI) NewOutgoingPhoto(recipient Recipient, fileName string, reader io.Reader) *OutgoingPhoto { return &OutgoingPhoto{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
go
func (api *TelegramBotAPI) NewOutgoingPhoto(recipient Recipient, fileName string, reader io.Reader) *OutgoingPhoto { return &OutgoingPhoto{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingPhoto", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingPhoto", "{", "return", "&", "OutgoingPhoto", "{", "outgoingMessageBase", ":", "...
// NewOutgoingPhoto creates a new outgoing photo.
[ "NewOutgoingPhoto", "creates", "a", "new", "outgoing", "photo", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L85-L98
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingPhotoResend
func (api *TelegramBotAPI) NewOutgoingPhotoResend(recipient Recipient, fileID string) *OutgoingPhoto { return &OutgoingPhoto{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
go
func (api *TelegramBotAPI) NewOutgoingPhotoResend(recipient Recipient, fileID string) *OutgoingPhoto { return &OutgoingPhoto{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingPhotoResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingPhoto", "{", "return", "&", "OutgoingPhoto", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBa...
// NewOutgoingPhotoResend creates a new outgoing photo for re-sending.
[ "NewOutgoingPhotoResend", "creates", "a", "new", "outgoing", "photo", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L101-L113
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingSticker
func (api *TelegramBotAPI) NewOutgoingSticker(recipient Recipient, fileName string, reader io.Reader) *OutgoingSticker { return &OutgoingSticker{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ ...
go
func (api *TelegramBotAPI) NewOutgoingSticker(recipient Recipient, fileName string, reader io.Reader) *OutgoingSticker { return &OutgoingSticker{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ ...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingSticker", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingSticker", "{", "return", "&", "OutgoingSticker", "{", "outgoingMessageBase", ":...
// NewOutgoingSticker creates a new outgoing sticker message.
[ "NewOutgoingSticker", "creates", "a", "new", "outgoing", "sticker", "message", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L116-L129
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingStickerResend
func (api *TelegramBotAPI) NewOutgoingStickerResend(recipient Recipient, fileID string) *OutgoingSticker { return &OutgoingSticker{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID...
go
func (api *TelegramBotAPI) NewOutgoingStickerResend(recipient Recipient, fileID string) *OutgoingSticker { return &OutgoingSticker{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingStickerResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingSticker", "{", "return", "&", "OutgoingSticker", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outg...
// NewOutgoingStickerResend creates a new outgoing sticker message for // re-sending.
[ "NewOutgoingStickerResend", "creates", "a", "new", "outgoing", "sticker", "message", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L133-L145
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingVoice
func (api *TelegramBotAPI) NewOutgoingVoice(recipient Recipient, fileName string, reader io.Reader) *OutgoingVoice { return &OutgoingVoice{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
go
func (api *TelegramBotAPI) NewOutgoingVoice(recipient Recipient, fileName string, reader io.Reader) *OutgoingVoice { return &OutgoingVoice{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVoice", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingVoice", "{", "return", "&", "OutgoingVoice", "{", "outgoingMessageBase", ":", "...
// NewOutgoingVoice creates a new outgoing voice note.
[ "NewOutgoingVoice", "creates", "a", "new", "outgoing", "voice", "note", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L148-L161
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingVoiceResend
func (api *TelegramBotAPI) NewOutgoingVoiceResend(recipient Recipient, fileID string) *OutgoingVoice { return &OutgoingVoice{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
go
func (api *TelegramBotAPI) NewOutgoingVoiceResend(recipient Recipient, fileID string) *OutgoingVoice { return &OutgoingVoice{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingVoiceResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingVoice", "{", "return", "&", "OutgoingVoice", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBa...
// NewOutgoingVoiceResend creates a new outgoing voice note for re-sending.
[ "NewOutgoingVoiceResend", "creates", "a", "new", "outgoing", "voice", "note", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L164-L176
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingAudio
func (api *TelegramBotAPI) NewOutgoingAudio(recipient Recipient, fileName string, reader io.Reader) *OutgoingAudio { return &OutgoingAudio{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
go
func (api *TelegramBotAPI) NewOutgoingAudio(recipient Recipient, fileName string, reader io.Reader) *OutgoingAudio { return &OutgoingAudio{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileNa...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingAudio", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingAudio", "{", "return", "&", "OutgoingAudio", "{", "outgoingMessageBase", ":", "...
// NewOutgoingAudio creates a new outgoing audio file.
[ "NewOutgoingAudio", "creates", "a", "new", "outgoing", "audio", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L179-L192
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingAudioResend
func (api *TelegramBotAPI) NewOutgoingAudioResend(recipient Recipient, fileID string) *OutgoingAudio { return &OutgoingAudio{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
go
func (api *TelegramBotAPI) NewOutgoingAudioResend(recipient Recipient, fileID string) *OutgoingAudio { return &OutgoingAudio{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fileID, },...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingAudioResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingAudio", "{", "return", "&", "OutgoingAudio", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBa...
// NewOutgoingAudioResend creates a new outgoing audio file for re-sending.
[ "NewOutgoingAudioResend", "creates", "a", "new", "outgoing", "audio", "file", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L195-L207
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingDocument
func (api *TelegramBotAPI) NewOutgoingDocument(recipient Recipient, fileName string, reader io.Reader) *OutgoingDocument { return &OutgoingDocument{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ ...
go
func (api *TelegramBotAPI) NewOutgoingDocument(recipient Recipient, fileName string, reader io.Reader) *OutgoingDocument { return &OutgoingDocument{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ ...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingDocument", "(", "recipient", "Recipient", ",", "fileName", "string", ",", "reader", "io", ".", "Reader", ")", "*", "OutgoingDocument", "{", "return", "&", "OutgoingDocument", "{", "outgoingMessageBase", ...
// NewOutgoingDocument creates a new outgoing file.
[ "NewOutgoingDocument", "creates", "a", "new", "outgoing", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L210-L223
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingDocumentResend
func (api *TelegramBotAPI) NewOutgoingDocumentResend(recipient Recipient, fileID string) *OutgoingDocument { return &OutgoingDocument{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fil...
go
func (api *TelegramBotAPI) NewOutgoingDocumentResend(recipient Recipient, fileID string) *OutgoingDocument { return &OutgoingDocument{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, outgoingFileBase: outgoingFileBase{ fileID: fil...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingDocumentResend", "(", "recipient", "Recipient", ",", "fileID", "string", ")", "*", "OutgoingDocument", "{", "return", "&", "OutgoingDocument", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "o...
// NewOutgoingDocumentResend creates a new outgoing file for re-sending.
[ "NewOutgoingDocumentResend", "creates", "a", "new", "outgoing", "file", "for", "re", "-", "sending", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L226-L238
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingForward
func (api *TelegramBotAPI) NewOutgoingForward(recipient Recipient, origin Chat, messageID int) *OutgoingForward { return &OutgoingForward{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, FromChatID: NewRecipientFromChat(origin), Me...
go
func (api *TelegramBotAPI) NewOutgoingForward(recipient Recipient, origin Chat, messageID int) *OutgoingForward { return &OutgoingForward{ outgoingMessageBase: outgoingMessageBase{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, }, FromChatID: NewRecipientFromChat(origin), Me...
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingForward", "(", "recipient", "Recipient", ",", "origin", "Chat", ",", "messageID", "int", ")", "*", "OutgoingForward", "{", "return", "&", "OutgoingForward", "{", "outgoingMessageBase", ":", "outgoingMessa...
// NewOutgoingForward creates a new outgoing, forwarded message.
[ "NewOutgoingForward", "creates", "a", "new", "outgoing", "forwarded", "message", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L241-L252
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingChatAction
func (api *TelegramBotAPI) NewOutgoingChatAction(recipient Recipient, action ChatAction) *OutgoingChatAction { return &OutgoingChatAction{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, Action: action, } }
go
func (api *TelegramBotAPI) NewOutgoingChatAction(recipient Recipient, action ChatAction) *OutgoingChatAction { return &OutgoingChatAction{ outgoingBase: outgoingBase{ api: api, Recipient: recipient, }, Action: action, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingChatAction", "(", "recipient", "Recipient", ",", "action", "ChatAction", ")", "*", "OutgoingChatAction", "{", "return", "&", "OutgoingChatAction", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":"...
// NewOutgoingChatAction creates a new outgoing chat action.
[ "NewOutgoingChatAction", "creates", "a", "new", "outgoing", "chat", "action", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L255-L263
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingUserProfilePhotosRequest
func (api *TelegramBotAPI) NewOutgoingUserProfilePhotosRequest(userID int) *OutgoingUserProfilePhotosRequest { return &OutgoingUserProfilePhotosRequest{ api: api, UserID: userID, } }
go
func (api *TelegramBotAPI) NewOutgoingUserProfilePhotosRequest(userID int) *OutgoingUserProfilePhotosRequest { return &OutgoingUserProfilePhotosRequest{ api: api, UserID: userID, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingUserProfilePhotosRequest", "(", "userID", "int", ")", "*", "OutgoingUserProfilePhotosRequest", "{", "return", "&", "OutgoingUserProfilePhotosRequest", "{", "api", ":", "api", ",", "UserID", ":", "userID", "...
// NewOutgoingUserProfilePhotosRequest creates a new request for a users // profile photos.
[ "NewOutgoingUserProfilePhotosRequest", "creates", "a", "new", "request", "for", "a", "users", "profile", "photos", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L267-L272
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingKickChatMember
func (api *TelegramBotAPI) NewOutgoingKickChatMember(chat Recipient, userID int) *OutgoingKickChatMember { return &OutgoingKickChatMember{ api: api, Recipient: chat, UserID: userID, } }
go
func (api *TelegramBotAPI) NewOutgoingKickChatMember(chat Recipient, userID int) *OutgoingKickChatMember { return &OutgoingKickChatMember{ api: api, Recipient: chat, UserID: userID, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingKickChatMember", "(", "chat", "Recipient", ",", "userID", "int", ")", "*", "OutgoingKickChatMember", "{", "return", "&", "OutgoingKickChatMember", "{", "api", ":", "api", ",", "Recipient", ":", "chat", ...
// NewOutgoingKickChatMember creates a request to kick a member from a // group chat or channel.
[ "NewOutgoingKickChatMember", "creates", "a", "request", "to", "kick", "a", "member", "from", "a", "group", "chat", "or", "channel", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L276-L282
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingUnbanChatMember
func (api *TelegramBotAPI) NewOutgoingUnbanChatMember(chat Recipient, userID int) *OutgoingUnbanChatMember { return &OutgoingUnbanChatMember{ api: api, Recipient: chat, UserID: userID, } }
go
func (api *TelegramBotAPI) NewOutgoingUnbanChatMember(chat Recipient, userID int) *OutgoingUnbanChatMember { return &OutgoingUnbanChatMember{ api: api, Recipient: chat, UserID: userID, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingUnbanChatMember", "(", "chat", "Recipient", ",", "userID", "int", ")", "*", "OutgoingUnbanChatMember", "{", "return", "&", "OutgoingUnbanChatMember", "{", "api", ":", "api", ",", "Recipient", ":", "chat...
// NewOutgoingUnbanChatMember creates a request to unban a member of a // group chat or channel.
[ "NewOutgoingUnbanChatMember", "creates", "a", "request", "to", "unban", "a", "member", "of", "a", "group", "chat", "or", "channel", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L286-L292
test
mrd0ll4r/tbotapi
ctors.go
NewOutgoingCallbackQueryResponse
func (api *TelegramBotAPI) NewOutgoingCallbackQueryResponse(queryID string) *OutgoingCallbackQueryResponse { return &OutgoingCallbackQueryResponse{ api: api, CallbackQueryID: queryID, } }
go
func (api *TelegramBotAPI) NewOutgoingCallbackQueryResponse(queryID string) *OutgoingCallbackQueryResponse { return &OutgoingCallbackQueryResponse{ api: api, CallbackQueryID: queryID, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingCallbackQueryResponse", "(", "queryID", "string", ")", "*", "OutgoingCallbackQueryResponse", "{", "return", "&", "OutgoingCallbackQueryResponse", "{", "api", ":", "api", ",", "CallbackQueryID", ":", "queryID"...
// NewOutgoingCallbackQueryResponse creates a response to a callback query.
[ "NewOutgoingCallbackQueryResponse", "creates", "a", "response", "to", "a", "callback", "query", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L295-L300
test
mrd0ll4r/tbotapi
ctors.go
NewInlineQueryAnswer
func (api *TelegramBotAPI) NewInlineQueryAnswer(queryID string, results []InlineQueryResult) *InlineQueryAnswer { return &InlineQueryAnswer{ api: api, QueryID: queryID, Results: results, } }
go
func (api *TelegramBotAPI) NewInlineQueryAnswer(queryID string, results []InlineQueryResult) *InlineQueryAnswer { return &InlineQueryAnswer{ api: api, QueryID: queryID, Results: results, } }
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewInlineQueryAnswer", "(", "queryID", "string", ",", "results", "[", "]", "InlineQueryResult", ")", "*", "InlineQueryAnswer", "{", "return", "&", "InlineQueryAnswer", "{", "api", ":", "api", ",", "QueryID", ":"...
// NewInlineQueryAnswer creates a new inline query answer.
[ "NewInlineQueryAnswer", "creates", "a", "new", "inline", "query", "answer", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/ctors.go#L303-L309
test
mrd0ll4r/tbotapi
incoming.go
Type
func (m *Message) Type() MessageType { if m.Text != nil { return TextMessage } else if m.Audio != nil { return AudioMessage } else if m.Document != nil { return DocumentMessage } else if m.Photo != nil { return PhotoMessage } else if m.Sticker != nil { return StickerMessage } else if m.Video != nil { ...
go
func (m *Message) Type() MessageType { if m.Text != nil { return TextMessage } else if m.Audio != nil { return AudioMessage } else if m.Document != nil { return DocumentMessage } else if m.Photo != nil { return PhotoMessage } else if m.Sticker != nil { return StickerMessage } else if m.Video != nil { ...
[ "func", "(", "m", "*", "Message", ")", "Type", "(", ")", "MessageType", "{", "if", "m", ".", "Text", "!=", "nil", "{", "return", "TextMessage", "\n", "}", "else", "if", "m", ".", "Audio", "!=", "nil", "{", "return", "AudioMessage", "\n", "}", "else...
// Type determines the type of the message. // Note that, for all these types, messages can still be replies or // forwarded.
[ "Type", "determines", "the", "type", "of", "the", "message", ".", "Note", "that", "for", "all", "these", "types", "messages", "can", "still", "be", "replies", "or", "forwarded", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/incoming.go#L150-L196
test
mrd0ll4r/tbotapi
incoming.go
Type
func (u *Update) Type() UpdateType { if u.Message != nil { return MessageUpdate } else if u.InlineQuery != nil { return InlineQueryUpdate } else if u.ChosenInlineResult != nil { return ChosenInlineResultUpdate } return UnknownUpdate }
go
func (u *Update) Type() UpdateType { if u.Message != nil { return MessageUpdate } else if u.InlineQuery != nil { return InlineQueryUpdate } else if u.ChosenInlineResult != nil { return ChosenInlineResultUpdate } return UnknownUpdate }
[ "func", "(", "u", "*", "Update", ")", "Type", "(", ")", "UpdateType", "{", "if", "u", ".", "Message", "!=", "nil", "{", "return", "MessageUpdate", "\n", "}", "else", "if", "u", ".", "InlineQuery", "!=", "nil", "{", "return", "InlineQueryUpdate", "\n", ...
// Type returns the type of the update.
[ "Type", "returns", "the", "type", "of", "the", "update", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/incoming.go#L376-L385
test
mrd0ll4r/tbotapi
shared.go
MarshalJSON
func (r Recipient) MarshalJSON() ([]byte, error) { toReturn := "" if r.isChannel() { toReturn = fmt.Sprintf("\"%s\"", *r.ChannelID) } else { toReturn = fmt.Sprintf("%d", *r.ChatID) } return []byte(toReturn), nil }
go
func (r Recipient) MarshalJSON() ([]byte, error) { toReturn := "" if r.isChannel() { toReturn = fmt.Sprintf("\"%s\"", *r.ChannelID) } else { toReturn = fmt.Sprintf("%d", *r.ChatID) } return []byte(toReturn), nil }
[ "func", "(", "r", "Recipient", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "toReturn", ":=", "\"\"", "\n", "if", "r", ".", "isChannel", "(", ")", "{", "toReturn", "=", "fmt", ".", "Sprintf", "(", "\"\\\"%s\\\"\"", "...
// MarshalJSON marshals the recipient to JSON.
[ "MarshalJSON", "marshals", "the", "recipient", "to", "JSON", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/shared.go#L43-L53
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (ow *outgoingSetWebhook) querystring() querystring { toReturn := make(map[string]string) if ow.URL != "" { toReturn["url"] = ow.URL } return querystring(toReturn) }
go
func (ow *outgoingSetWebhook) querystring() querystring { toReturn := make(map[string]string) if ow.URL != "" { toReturn["url"] = ow.URL } return querystring(toReturn) }
[ "func", "(", "ow", "*", "outgoingSetWebhook", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "if", "ow", ".", "URL", "!=", "\"\"", "{", "toReturn", "[", "\"url\"", "]", ...
// querystring implements querystringer to represent the outgoing certificate // file.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "outgoing", "certificate", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L20-L28
test
mrd0ll4r/tbotapi
outgoing.go
getBaseQueryString
func (op *outgoingBase) getBaseQueryString() querystring { toReturn := map[string]string{} if op.Recipient.isChannel() { //Channel toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChannelID) } else { toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChatID) } return querystring(toReturn) }
go
func (op *outgoingBase) getBaseQueryString() querystring { toReturn := map[string]string{} if op.Recipient.isChannel() { //Channel toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChannelID) } else { toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChatID) } return querystring(toReturn) }
[ "func", "(", "op", "*", "outgoingBase", ")", "getBaseQueryString", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "if", "op", ".", "Recipient", ".", "isChannel", "(", ")", "{", "toReturn", "[", "\"c...
// getBaseQueryString gets a Querystring representing this message.
[ "getBaseQueryString", "gets", "a", "Querystring", "representing", "this", "message", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L107-L117
test
mrd0ll4r/tbotapi
outgoing.go
getBaseQueryString
func (op *outgoingMessageBase) getBaseQueryString() querystring { toReturn := map[string]string{} if op.Recipient.isChannel() { //Channel. toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChannelID) } else { toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChatID) } if op.replyToMessageIDSet { toReturn["reply...
go
func (op *outgoingMessageBase) getBaseQueryString() querystring { toReturn := map[string]string{} if op.Recipient.isChannel() { //Channel. toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChannelID) } else { toReturn["chat_id"] = fmt.Sprint(*op.Recipient.ChatID) } if op.replyToMessageIDSet { toReturn["reply...
[ "func", "(", "op", "*", "outgoingMessageBase", ")", "getBaseQueryString", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "if", "op", ".", "Recipient", ".", "isChannel", "(", ")", "{", "toReturn", "[",...
// getMessageBaseQueryString gets a Querystring representing this message.
[ "getMessageBaseQueryString", "gets", "a", "Querystring", "representing", "this", "message", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L120-L146
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (oa *OutgoingAudio) querystring() querystring { toReturn := map[string]string(oa.getBaseQueryString()) if oa.Duration != 0 { toReturn["duration"] = fmt.Sprint(oa.Duration) } if oa.Performer != "" { toReturn["performer"] = oa.Performer } if oa.Title != "" { toReturn["title"] = oa.Title } return qu...
go
func (oa *OutgoingAudio) querystring() querystring { toReturn := map[string]string(oa.getBaseQueryString()) if oa.Duration != 0 { toReturn["duration"] = fmt.Sprint(oa.Duration) } if oa.Performer != "" { toReturn["performer"] = oa.Performer } if oa.Title != "" { toReturn["title"] = oa.Title } return qu...
[ "func", "(", "oa", "*", "OutgoingAudio", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "(", "oa", ".", "getBaseQueryString", "(", ")", ")", "\n", "if", "oa", ".", "Duration", "!=", "0", "{", ...
// querystring implements querystringer to represent the audio file.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "audio", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L194-L210
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (op *OutgoingPhoto) querystring() querystring { toReturn := map[string]string(op.getBaseQueryString()) if op.Caption != "" { toReturn["caption"] = op.Caption } return querystring(toReturn) }
go
func (op *OutgoingPhoto) querystring() querystring { toReturn := map[string]string(op.getBaseQueryString()) if op.Caption != "" { toReturn["caption"] = op.Caption } return querystring(toReturn) }
[ "func", "(", "op", "*", "OutgoingPhoto", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "(", "op", ".", "getBaseQueryString", "(", ")", ")", "\n", "if", "op", ".", "Caption", "!=", "\"\"", "{", ...
// querystring implements querystringer to represent the photo.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "photo", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L304-L312
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (op *OutgoingUserProfilePhotosRequest) querystring() querystring { toReturn := map[string]string{} toReturn["user_id"] = fmt.Sprint(op.UserID) if op.Offset != 0 { toReturn["offset"] = fmt.Sprint(op.Offset) } if op.Limit != 0 { toReturn["limit"] = fmt.Sprint(op.Limit) } return querystring(toReturn) }
go
func (op *OutgoingUserProfilePhotosRequest) querystring() querystring { toReturn := map[string]string{} toReturn["user_id"] = fmt.Sprint(op.UserID) if op.Offset != 0 { toReturn["offset"] = fmt.Sprint(op.Offset) } if op.Limit != 0 { toReturn["limit"] = fmt.Sprint(op.Limit) } return querystring(toReturn) }
[ "func", "(", "op", "*", "OutgoingUserProfilePhotosRequest", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "toReturn", "[", "\"user_id\"", "]", "=", "fmt", ".", "Sprint", "(", "op", ...
// querystring implements querystringer to represent the request.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "request", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L369-L382
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (ov *OutgoingVideo) querystring() querystring { toReturn := map[string]string(ov.getBaseQueryString()) if ov.Caption != "" { toReturn["caption"] = ov.Caption } if ov.Duration != 0 { toReturn["duration"] = fmt.Sprint(ov.Duration) } return querystring(toReturn) }
go
func (ov *OutgoingVideo) querystring() querystring { toReturn := map[string]string(ov.getBaseQueryString()) if ov.Caption != "" { toReturn["caption"] = ov.Caption } if ov.Duration != 0 { toReturn["duration"] = fmt.Sprint(ov.Duration) } return querystring(toReturn) }
[ "func", "(", "ov", "*", "OutgoingVideo", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "(", "ov", ".", "getBaseQueryString", "(", ")", ")", "\n", "if", "ov", ".", "Caption", "!=", "\"\"", "{", ...
// querystring implements querystringer to represent the outgoing video // file.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "outgoing", "video", "file", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L406-L418
test
mrd0ll4r/tbotapi
outgoing.go
querystring
func (ov *OutgoingVoice) querystring() querystring { toReturn := map[string]string(ov.getBaseQueryString()) if ov.Duration != 0 { toReturn["duration"] = fmt.Sprint(ov.Duration) } return querystring(toReturn) }
go
func (ov *OutgoingVoice) querystring() querystring { toReturn := map[string]string(ov.getBaseQueryString()) if ov.Duration != 0 { toReturn["duration"] = fmt.Sprint(ov.Duration) } return querystring(toReturn) }
[ "func", "(", "ov", "*", "OutgoingVoice", ")", "querystring", "(", ")", "querystring", "{", "toReturn", ":=", "map", "[", "string", "]", "string", "(", "ov", ".", "getBaseQueryString", "(", ")", ")", "\n", "if", "ov", ".", "Duration", "!=", "0", "{", ...
// querystring implements querystringer to represent the outgoing voice // note.
[ "querystring", "implements", "querystringer", "to", "represent", "the", "outgoing", "voice", "note", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L435-L443
test
mrd0ll4r/tbotapi
outgoing.go
NewInlineQueryResultArticle
func NewInlineQueryResultArticle(id, title, text string) *InlineQueryResultArticle { return &InlineQueryResultArticle{ InlineQueryResultBase: InlineQueryResultBase{ Type: ArticleResult, ID: id, }, Title: title, Text: text, } }
go
func NewInlineQueryResultArticle(id, title, text string) *InlineQueryResultArticle { return &InlineQueryResultArticle{ InlineQueryResultBase: InlineQueryResultBase{ Type: ArticleResult, ID: id, }, Title: title, Text: text, } }
[ "func", "NewInlineQueryResultArticle", "(", "id", ",", "title", ",", "text", "string", ")", "*", "InlineQueryResultArticle", "{", "return", "&", "InlineQueryResultArticle", "{", "InlineQueryResultBase", ":", "InlineQueryResultBase", "{", "Type", ":", "ArticleResult", ...
// NewInlineQueryResultArticle returns a new InlineQueryResultArticle with // all mandatory fields set.
[ "NewInlineQueryResultArticle", "returns", "a", "new", "InlineQueryResultArticle", "with", "all", "mandatory", "fields", "set", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L592-L601
test
mrd0ll4r/tbotapi
outgoing.go
NewInlineQueryResultPhoto
func NewInlineQueryResultPhoto(id, photoURL, thumbURL string) *InlineQueryResultPhoto { return &InlineQueryResultPhoto{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, PhotoURL: photoURL, ThumbURL: thumbURL, } }
go
func NewInlineQueryResultPhoto(id, photoURL, thumbURL string) *InlineQueryResultPhoto { return &InlineQueryResultPhoto{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, PhotoURL: photoURL, ThumbURL: thumbURL, } }
[ "func", "NewInlineQueryResultPhoto", "(", "id", ",", "photoURL", ",", "thumbURL", "string", ")", "*", "InlineQueryResultPhoto", "{", "return", "&", "InlineQueryResultPhoto", "{", "InlineQueryResultBase", ":", "InlineQueryResultBase", "{", "Type", ":", "PhotoResult", "...
// NewInlineQueryResultPhoto returns a new InlineQueryResultPhoto with all // mandatory fields set.
[ "NewInlineQueryResultPhoto", "returns", "a", "new", "InlineQueryResultPhoto", "with", "all", "mandatory", "fields", "set", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L624-L633
test
mrd0ll4r/tbotapi
outgoing.go
NewInlineQueryResultGif
func NewInlineQueryResultGif(id, gifURL, thumbURL string) *InlineQueryResultGif { return &InlineQueryResultGif{ InlineQueryResultBase: InlineQueryResultBase{ Type: GifResult, ID: id, }, GifURL: gifURL, ThumbURL: thumbURL, } }
go
func NewInlineQueryResultGif(id, gifURL, thumbURL string) *InlineQueryResultGif { return &InlineQueryResultGif{ InlineQueryResultBase: InlineQueryResultBase{ Type: GifResult, ID: id, }, GifURL: gifURL, ThumbURL: thumbURL, } }
[ "func", "NewInlineQueryResultGif", "(", "id", ",", "gifURL", ",", "thumbURL", "string", ")", "*", "InlineQueryResultGif", "{", "return", "&", "InlineQueryResultGif", "{", "InlineQueryResultBase", ":", "InlineQueryResultBase", "{", "Type", ":", "GifResult", ",", "ID"...
// NewInlineQueryResultGif returns a new InlineQueryResultGif with all // mandatory fields set.
[ "NewInlineQueryResultGif", "returns", "a", "new", "InlineQueryResultGif", "with", "all", "mandatory", "fields", "set", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L648-L657
test
mrd0ll4r/tbotapi
outgoing.go
NewInlineQueryResultMpeg4Gif
func NewInlineQueryResultMpeg4Gif(id, mpeg4URL, thumbURL string) *InlineQueryResultMpeg4Gif { return &InlineQueryResultMpeg4Gif{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, Mpeg4URL: mpeg4URL, ThumbURL: thumbURL, } }
go
func NewInlineQueryResultMpeg4Gif(id, mpeg4URL, thumbURL string) *InlineQueryResultMpeg4Gif { return &InlineQueryResultMpeg4Gif{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, Mpeg4URL: mpeg4URL, ThumbURL: thumbURL, } }
[ "func", "NewInlineQueryResultMpeg4Gif", "(", "id", ",", "mpeg4URL", ",", "thumbURL", "string", ")", "*", "InlineQueryResultMpeg4Gif", "{", "return", "&", "InlineQueryResultMpeg4Gif", "{", "InlineQueryResultBase", ":", "InlineQueryResultBase", "{", "Type", ":", "PhotoRes...
// NewInlineQueryResultMpeg4Gif returns a new InlineQueryResultMpeg4Gif // with all mandatory fields set.
[ "NewInlineQueryResultMpeg4Gif", "returns", "a", "new", "InlineQueryResultMpeg4Gif", "with", "all", "mandatory", "fields", "set", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L673-L682
test
mrd0ll4r/tbotapi
outgoing.go
NewInlineQueryResultVideo
func NewInlineQueryResultVideo(id, videoURL, thumbURL, title, text string, mimeType MIMEType) *InlineQueryResultVideo { return &InlineQueryResultVideo{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, VideoURL: videoURL, MIMEType: mimeType, ThumbURL: thumbURL, Title: t...
go
func NewInlineQueryResultVideo(id, videoURL, thumbURL, title, text string, mimeType MIMEType) *InlineQueryResultVideo { return &InlineQueryResultVideo{ InlineQueryResultBase: InlineQueryResultBase{ Type: PhotoResult, ID: id, }, VideoURL: videoURL, MIMEType: mimeType, ThumbURL: thumbURL, Title: t...
[ "func", "NewInlineQueryResultVideo", "(", "id", ",", "videoURL", ",", "thumbURL", ",", "title", ",", "text", "string", ",", "mimeType", "MIMEType", ")", "*", "InlineQueryResultVideo", "{", "return", "&", "InlineQueryResultVideo", "{", "InlineQueryResultBase", ":", ...
// NewInlineQueryResultVideo returns a new InlineQueryResultVideo with all // mandatory fields set.
[ "NewInlineQueryResultVideo", "returns", "a", "new", "InlineQueryResultVideo", "with", "all", "mandatory", "fields", "set", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/outgoing.go#L710-L722
test
mrd0ll4r/tbotapi
sendable.go
Send
func (op *OutgoingUserProfilePhotosRequest) Send() (*UserProfilePhotosResponse, error) { resp := &UserProfilePhotosResponse{} _, err := op.api.c.postJSON(getUserProfilePhotos, resp, op) if err != nil { return nil, err } err = check(&resp.baseResponse) if err != nil { return nil, err } return resp, nil }
go
func (op *OutgoingUserProfilePhotosRequest) Send() (*UserProfilePhotosResponse, error) { resp := &UserProfilePhotosResponse{} _, err := op.api.c.postJSON(getUserProfilePhotos, resp, op) if err != nil { return nil, err } err = check(&resp.baseResponse) if err != nil { return nil, err } return resp, nil }
[ "func", "(", "op", "*", "OutgoingUserProfilePhotosRequest", ")", "Send", "(", ")", "(", "*", "UserProfilePhotosResponse", ",", "error", ")", "{", "resp", ":=", "&", "UserProfilePhotosResponse", "{", "}", "\n", "_", ",", "err", ":=", "op", ".", "api", ".", ...
// Send sends the request. // On success, the photos are returned as a UserProfilePhotosResponse.
[ "Send", "sends", "the", "request", ".", "On", "success", "the", "photos", "are", "returned", "as", "a", "UserProfilePhotosResponse", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L91-L104
test
mrd0ll4r/tbotapi
sendable.go
Send
func (oc *OutgoingChatAction) Send() error { resp := &baseResponse{} _, err := oc.api.c.postJSON(sendChatAction, resp, oc) if err != nil { return err } return check(resp) }
go
func (oc *OutgoingChatAction) Send() error { resp := &baseResponse{} _, err := oc.api.c.postJSON(sendChatAction, resp, oc) if err != nil { return err } return check(resp) }
[ "func", "(", "oc", "*", "OutgoingChatAction", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "oc", ".", "api", ".", "c", ".", "postJSON", "(", "sendChatAction", ",", "resp", ",", "oc",...
// Send sends the chat action. // On success, nil is returned.
[ "Send", "sends", "the", "chat", "action", ".", "On", "success", "nil", "is", "returned", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L108-L117
test
mrd0ll4r/tbotapi
sendable.go
Send
func (ia *InlineQueryAnswer) Send() error { resp := &baseResponse{} _, err := ia.api.c.postJSON(answerInlineQuery, resp, ia) if err != nil { return err } return check(resp) }
go
func (ia *InlineQueryAnswer) Send() error { resp := &baseResponse{} _, err := ia.api.c.postJSON(answerInlineQuery, resp, ia) if err != nil { return err } return check(resp) }
[ "func", "(", "ia", "*", "InlineQueryAnswer", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "ia", ".", "api", ".", "c", ".", "postJSON", "(", "answerInlineQuery", ",", "resp", ",", "ia...
// Send sends the inline query answer. // On success, nil is returned.
[ "Send", "sends", "the", "inline", "query", "answer", ".", "On", "success", "nil", "is", "returned", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L121-L130
test
mrd0ll4r/tbotapi
sendable.go
Send
func (kr *OutgoingKickChatMember) Send() error { resp := &baseResponse{} _, err := kr.api.c.postJSON(kickChatMember, resp, kr) if err != nil { return err } return check(resp) }
go
func (kr *OutgoingKickChatMember) Send() error { resp := &baseResponse{} _, err := kr.api.c.postJSON(kickChatMember, resp, kr) if err != nil { return err } return check(resp) }
[ "func", "(", "kr", "*", "OutgoingKickChatMember", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "kr", ".", "api", ".", "c", ".", "postJSON", "(", "kickChatMember", ",", "resp", ",", "...
// Send sends the kick request.
[ "Send", "sends", "the", "kick", "request", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L133-L142
test
mrd0ll4r/tbotapi
sendable.go
Send
func (ub *OutgoingUnbanChatMember) Send() error { resp := &baseResponse{} _, err := ub.api.c.postJSON(unbanChatMember, resp, ub) if err != nil { return err } return check(resp) }
go
func (ub *OutgoingUnbanChatMember) Send() error { resp := &baseResponse{} _, err := ub.api.c.postJSON(unbanChatMember, resp, ub) if err != nil { return err } return check(resp) }
[ "func", "(", "ub", "*", "OutgoingUnbanChatMember", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "ub", ".", "api", ".", "c", ".", "postJSON", "(", "unbanChatMember", ",", "resp", ",", ...
// Send sends the unban request.
[ "Send", "sends", "the", "unban", "request", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L145-L154
test
mrd0ll4r/tbotapi
sendable.go
Send
func (cbr *OutgoingCallbackQueryResponse) Send() error { resp := &baseResponse{} _, err := cbr.api.c.postJSON(answerCallbackQuery, resp, cbr) if err != nil { return err } return check(resp) }
go
func (cbr *OutgoingCallbackQueryResponse) Send() error { resp := &baseResponse{} _, err := cbr.api.c.postJSON(answerCallbackQuery, resp, cbr) if err != nil { return err } return check(resp) }
[ "func", "(", "cbr", "*", "OutgoingCallbackQueryResponse", ")", "Send", "(", ")", "error", "{", "resp", ":=", "&", "baseResponse", "{", "}", "\n", "_", ",", "err", ":=", "cbr", ".", "api", ".", "c", ".", "postJSON", "(", "answerCallbackQuery", ",", "res...
// Send sends the callback response.
[ "Send", "sends", "the", "callback", "response", "." ]
edc257282178bb5cebbfcc41260ec04c1ec7ac19
https://github.com/mrd0ll4r/tbotapi/blob/edc257282178bb5cebbfcc41260ec04c1ec7ac19/sendable.go#L157-L166
test
grokify/go-scim-client
api_client.go
NewAPIClient
func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.ServiceProviderConfigApi = (*ServiceProviderConfigApiService)(&c.common) c.UserApi = (*UserApiService)(&c.common) return c...
go
func NewAPIClient(cfg *Configuration) *APIClient { if cfg.HTTPClient == nil { cfg.HTTPClient = http.DefaultClient } c := &APIClient{} c.cfg = cfg c.common.client = c // API Services c.ServiceProviderConfigApi = (*ServiceProviderConfigApiService)(&c.common) c.UserApi = (*UserApiService)(&c.common) return c...
[ "func", "NewAPIClient", "(", "cfg", "*", "Configuration", ")", "*", "APIClient", "{", "if", "cfg", ".", "HTTPClient", "==", "nil", "{", "cfg", ".", "HTTPClient", "=", "http", ".", "DefaultClient", "\n", "}", "\n", "c", ":=", "&", "APIClient", "{", "}",...
// NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching.
[ "NewAPIClient", "creates", "a", "new", "API", "client", ".", "Requires", "a", "userAgent", "string", "describing", "your", "application", ".", "optionally", "a", "custom", "http", ".", "Client", "to", "allow", "for", "advanced", "features", "such", "as", "cach...
800878015236174e45b05db1ec125aae20a093e4
https://github.com/grokify/go-scim-client/blob/800878015236174e45b05db1ec125aae20a093e4/api_client.go#L56-L70
test
naoina/genmai
field.go
BeforeInsert
func (ts *TimeStamp) BeforeInsert() error { n := now() ts.CreatedAt = n ts.UpdatedAt = n return nil }
go
func (ts *TimeStamp) BeforeInsert() error { n := now() ts.CreatedAt = n ts.UpdatedAt = n return nil }
[ "func", "(", "ts", "*", "TimeStamp", ")", "BeforeInsert", "(", ")", "error", "{", "n", ":=", "now", "(", ")", "\n", "ts", ".", "CreatedAt", "=", "n", "\n", "ts", ".", "UpdatedAt", "=", "n", "\n", "return", "nil", "\n", "}" ]
// BeforeInsert sets current time to CreatedAt and UpdatedAt field. // It always returns nil.
[ "BeforeInsert", "sets", "current", "time", "to", "CreatedAt", "and", "UpdatedAt", "field", ".", "It", "always", "returns", "nil", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/field.go#L16-L21
test
naoina/genmai
util.go
ColumnName
func ColumnName(d Dialect, tname, cname string) string { if cname != "*" { cname = d.Quote(cname) } if tname == "" { return cname } return fmt.Sprintf("%s.%s", d.Quote(tname), cname) }
go
func ColumnName(d Dialect, tname, cname string) string { if cname != "*" { cname = d.Quote(cname) } if tname == "" { return cname } return fmt.Sprintf("%s.%s", d.Quote(tname), cname) }
[ "func", "ColumnName", "(", "d", "Dialect", ",", "tname", ",", "cname", "string", ")", "string", "{", "if", "cname", "!=", "\"*\"", "{", "cname", "=", "d", ".", "Quote", "(", "cname", ")", "\n", "}", "\n", "if", "tname", "==", "\"\"", "{", "return",...
// columnName returns the column name that added the table name with quoted if needed.
[ "columnName", "returns", "the", "column", "name", "that", "added", "the", "table", "name", "with", "quoted", "if", "needed", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/util.go#L22-L30
test
naoina/genmai
genmai.go
New
func New(dialect Dialect, dsn string) (*DB, error) { db, err := sql.Open(dialect.Name(), dsn) if err != nil { return nil, err } return &DB{db: db, dialect: dialect, logger: defaultLogger}, nil }
go
func New(dialect Dialect, dsn string) (*DB, error) { db, err := sql.Open(dialect.Name(), dsn) if err != nil { return nil, err } return &DB{db: db, dialect: dialect, logger: defaultLogger}, nil }
[ "func", "New", "(", "dialect", "Dialect", ",", "dsn", "string", ")", "(", "*", "DB", ",", "error", ")", "{", "db", ",", "err", ":=", "sql", ".", "Open", "(", "dialect", ".", "Name", "(", ")", ",", "dsn", ")", "\n", "if", "err", "!=", "nil", "...
// New returns a new DB. // If any error occurs, it returns nil and error.
[ "New", "returns", "a", "new", "DB", ".", "If", "any", "error", "occurs", "it", "returns", "nil", "and", "error", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L36-L42
test
naoina/genmai
genmai.go
From
func (db *DB) From(arg interface{}) *From { t := reflect.Indirect(reflect.ValueOf(arg)).Type() if t.Kind() != reflect.Struct { panic(fmt.Errorf("From: argument must be struct (or that pointer) type, got %v", t)) } return &From{TableName: db.tableName(t)} }
go
func (db *DB) From(arg interface{}) *From { t := reflect.Indirect(reflect.ValueOf(arg)).Type() if t.Kind() != reflect.Struct { panic(fmt.Errorf("From: argument must be struct (or that pointer) type, got %v", t)) } return &From{TableName: db.tableName(t)} }
[ "func", "(", "db", "*", "DB", ")", "From", "(", "arg", "interface", "{", "}", ")", "*", "From", "{", "t", ":=", "reflect", ".", "Indirect", "(", "reflect", ".", "ValueOf", "(", "arg", ")", ")", ".", "Type", "(", ")", "\n", "if", "t", ".", "Ki...
// From returns a "FROM" statement. // A table name will be determined from name of struct of arg. // If arg argument is not struct type, it panics.
[ "From", "returns", "a", "FROM", "statement", ".", "A", "table", "name", "will", "be", "determined", "from", "name", "of", "struct", "of", "arg", ".", "If", "arg", "argument", "is", "not", "struct", "type", "it", "panics", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L128-L134
test
naoina/genmai
genmai.go
Where
func (db *DB) Where(cond interface{}, args ...interface{}) *Condition { return newCondition(db).Where(cond, args...) }
go
func (db *DB) Where(cond interface{}, args ...interface{}) *Condition { return newCondition(db).Where(cond, args...) }
[ "func", "(", "db", "*", "DB", ")", "Where", "(", "cond", "interface", "{", "}", ",", "args", "...", "interface", "{", "}", ")", "*", "Condition", "{", "return", "newCondition", "(", "db", ")", ".", "Where", "(", "cond", ",", "args", "...", ")", "...
// Where returns a new Condition of "WHERE" clause.
[ "Where", "returns", "a", "new", "Condition", "of", "WHERE", "clause", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L137-L139
test
naoina/genmai
genmai.go
OrderBy
func (db *DB) OrderBy(table interface{}, column interface{}, order ...interface{}) *Condition { return newCondition(db).OrderBy(table, column, order...) }
go
func (db *DB) OrderBy(table interface{}, column interface{}, order ...interface{}) *Condition { return newCondition(db).OrderBy(table, column, order...) }
[ "func", "(", "db", "*", "DB", ")", "OrderBy", "(", "table", "interface", "{", "}", ",", "column", "interface", "{", "}", ",", "order", "...", "interface", "{", "}", ")", "*", "Condition", "{", "return", "newCondition", "(", "db", ")", ".", "OrderBy",...
// OrderBy returns a new Condition of "ORDER BY" clause.
[ "OrderBy", "returns", "a", "new", "Condition", "of", "ORDER", "BY", "clause", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L142-L144
test
naoina/genmai
genmai.go
Limit
func (db *DB) Limit(lim int) *Condition { return newCondition(db).Limit(lim) }
go
func (db *DB) Limit(lim int) *Condition { return newCondition(db).Limit(lim) }
[ "func", "(", "db", "*", "DB", ")", "Limit", "(", "lim", "int", ")", "*", "Condition", "{", "return", "newCondition", "(", "db", ")", ".", "Limit", "(", "lim", ")", "\n", "}" ]
// Limit returns a new Condition of "LIMIT" clause.
[ "Limit", "returns", "a", "new", "Condition", "of", "LIMIT", "clause", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L147-L149
test
naoina/genmai
genmai.go
Offset
func (db *DB) Offset(offset int) *Condition { return newCondition(db).Offset(offset) }
go
func (db *DB) Offset(offset int) *Condition { return newCondition(db).Offset(offset) }
[ "func", "(", "db", "*", "DB", ")", "Offset", "(", "offset", "int", ")", "*", "Condition", "{", "return", "newCondition", "(", "db", ")", ".", "Offset", "(", "offset", ")", "\n", "}" ]
// Offset returns a new Condition of "OFFSET" clause.
[ "Offset", "returns", "a", "new", "Condition", "of", "OFFSET", "clause", "." ]
78583835e1e41e3938e1ddfffd7101f8ad27fae0
https://github.com/naoina/genmai/blob/78583835e1e41e3938e1ddfffd7101f8ad27fae0/genmai.go#L152-L154
test