id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
126,600
jinzhu/gorm
association.go
Append
func (association *Association) Append(values ...interface{}) *Association { if association.Error != nil { return association } if relationship := association.field.Relationship; relationship.Kind == "has_one" { return association.Replace(values...) } return association.saveAssociations(values...) }
go
func (association *Association) Append(values ...interface{}) *Association { if association.Error != nil { return association } if relationship := association.field.Relationship; relationship.Kind == "has_one" { return association.Replace(values...) } return association.saveAssociations(values...) }
[ "func", "(", "association", "*", "Association", ")", "Append", "(", "values", "...", "interface", "{", "}", ")", "*", "Association", "{", "if", "association", ".", "Error", "!=", "nil", "{", "return", "association", "\n", "}", "\n\n", "if", "relationship",...
// Append append new associations for many2many, has_many, replace current association for has_one, belongs_to
[ "Append", "append", "new", "associations", "for", "many2many", "has_many", "replace", "current", "association", "for", "has_one", "belongs_to" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/association.go#L24-L33
126,601
jinzhu/gorm
association.go
Count
func (association *Association) Count() int { var ( count = 0 relationship = association.field.Relationship scope = association.scope fieldValue = association.field.Field.Interface() query = scope.DB() ) switch relationship.Kind { case "many_to_many": query = relationship.JoinTab...
go
func (association *Association) Count() int { var ( count = 0 relationship = association.field.Relationship scope = association.scope fieldValue = association.field.Field.Interface() query = scope.DB() ) switch relationship.Kind { case "many_to_many": query = relationship.JoinTab...
[ "func", "(", "association", "*", "Association", ")", "Count", "(", ")", "int", "{", "var", "(", "count", "=", "0", "\n", "relationship", "=", "association", ".", "field", ".", "Relationship", "\n", "scope", "=", "association", ".", "scope", "\n", "fieldV...
// Count return the count of current associations
[ "Count", "return", "the", "count", "of", "current", "associations" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/association.go#L261-L298
126,602
jinzhu/gorm
association.go
setErr
func (association *Association) setErr(err error) *Association { if err != nil { association.Error = err } return association }
go
func (association *Association) setErr(err error) *Association { if err != nil { association.Error = err } return association }
[ "func", "(", "association", "*", "Association", ")", "setErr", "(", "err", "error", ")", "*", "Association", "{", "if", "err", "!=", "nil", "{", "association", ".", "Error", "=", "err", "\n", "}", "\n", "return", "association", "\n", "}" ]
// setErr set error when the error is not nil. And return Association.
[ "setErr", "set", "error", "when", "the", "error", "is", "not", "nil", ".", "And", "return", "Association", "." ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/association.go#L372-L377
126,603
jinzhu/gorm
callback_query.go
init
func init() { DefaultCallback.Query().Register("gorm:query", queryCallback) DefaultCallback.Query().Register("gorm:preload", preloadCallback) DefaultCallback.Query().Register("gorm:after_query", afterQueryCallback) }
go
func init() { DefaultCallback.Query().Register("gorm:query", queryCallback) DefaultCallback.Query().Register("gorm:preload", preloadCallback) DefaultCallback.Query().Register("gorm:after_query", afterQueryCallback) }
[ "func", "init", "(", ")", "{", "DefaultCallback", ".", "Query", "(", ")", ".", "Register", "(", "\"", "\"", ",", "queryCallback", ")", "\n", "DefaultCallback", ".", "Query", "(", ")", ".", "Register", "(", "\"", "\"", ",", "preloadCallback", ")", "\n",...
// Define callbacks for querying
[ "Define", "callbacks", "for", "querying" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_query.go#L10-L14
126,604
jinzhu/gorm
callback_update.go
init
func init() { DefaultCallback.Update().Register("gorm:assign_updating_attributes", assignUpdatingAttributesCallback) DefaultCallback.Update().Register("gorm:begin_transaction", beginTransactionCallback) DefaultCallback.Update().Register("gorm:before_update", beforeUpdateCallback) DefaultCallback.Update().Register("...
go
func init() { DefaultCallback.Update().Register("gorm:assign_updating_attributes", assignUpdatingAttributesCallback) DefaultCallback.Update().Register("gorm:begin_transaction", beginTransactionCallback) DefaultCallback.Update().Register("gorm:before_update", beforeUpdateCallback) DefaultCallback.Update().Register("...
[ "func", "init", "(", ")", "{", "DefaultCallback", ".", "Update", "(", ")", ".", "Register", "(", "\"", "\"", ",", "assignUpdatingAttributesCallback", ")", "\n", "DefaultCallback", ".", "Update", "(", ")", ".", "Register", "(", "\"", "\"", ",", "beginTransa...
// Define callbacks for updating
[ "Define", "callbacks", "for", "updating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L11-L21
126,605
jinzhu/gorm
callback_update.go
assignUpdatingAttributesCallback
func assignUpdatingAttributesCallback(scope *Scope) { if attrs, ok := scope.InstanceGet("gorm:update_interface"); ok { if updateMaps, hasUpdate := scope.updatedAttrsWithValues(attrs); hasUpdate { scope.InstanceSet("gorm:update_attrs", updateMaps) } else { scope.SkipLeft() } } }
go
func assignUpdatingAttributesCallback(scope *Scope) { if attrs, ok := scope.InstanceGet("gorm:update_interface"); ok { if updateMaps, hasUpdate := scope.updatedAttrsWithValues(attrs); hasUpdate { scope.InstanceSet("gorm:update_attrs", updateMaps) } else { scope.SkipLeft() } } }
[ "func", "assignUpdatingAttributesCallback", "(", "scope", "*", "Scope", ")", "{", "if", "attrs", ",", "ok", ":=", "scope", ".", "InstanceGet", "(", "\"", "\"", ")", ";", "ok", "{", "if", "updateMaps", ",", "hasUpdate", ":=", "scope", ".", "updatedAttrsWith...
// assignUpdatingAttributesCallback assign updating attributes to model
[ "assignUpdatingAttributesCallback", "assign", "updating", "attributes", "to", "model" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L24-L32
126,606
jinzhu/gorm
callback_update.go
beforeUpdateCallback
func beforeUpdateCallback(scope *Scope) { if scope.DB().HasBlockGlobalUpdate() && !scope.hasConditions() { scope.Err(errors.New("Missing WHERE clause while updating")) return } if _, ok := scope.Get("gorm:update_column"); !ok { if !scope.HasError() { scope.CallMethod("BeforeSave") } if !scope.HasError()...
go
func beforeUpdateCallback(scope *Scope) { if scope.DB().HasBlockGlobalUpdate() && !scope.hasConditions() { scope.Err(errors.New("Missing WHERE clause while updating")) return } if _, ok := scope.Get("gorm:update_column"); !ok { if !scope.HasError() { scope.CallMethod("BeforeSave") } if !scope.HasError()...
[ "func", "beforeUpdateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "scope", ".", "DB", "(", ")", ".", "HasBlockGlobalUpdate", "(", ")", "&&", "!", "scope", ".", "hasConditions", "(", ")", "{", "scope", ".", "Err", "(", "errors", ".", "New", ...
// beforeUpdateCallback will invoke `BeforeSave`, `BeforeUpdate` method before updating
[ "beforeUpdateCallback", "will", "invoke", "BeforeSave", "BeforeUpdate", "method", "before", "updating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L35-L48
126,607
jinzhu/gorm
callback_update.go
updateTimeStampForUpdateCallback
func updateTimeStampForUpdateCallback(scope *Scope) { if _, ok := scope.Get("gorm:update_column"); !ok { scope.SetColumn("UpdatedAt", NowFunc()) } }
go
func updateTimeStampForUpdateCallback(scope *Scope) { if _, ok := scope.Get("gorm:update_column"); !ok { scope.SetColumn("UpdatedAt", NowFunc()) } }
[ "func", "updateTimeStampForUpdateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "_", ",", "ok", ":=", "scope", ".", "Get", "(", "\"", "\"", ")", ";", "!", "ok", "{", "scope", ".", "SetColumn", "(", "\"", "\"", ",", "NowFunc", "(", ")", ")",...
// updateTimeStampForUpdateCallback will set `UpdatedAt` when updating
[ "updateTimeStampForUpdateCallback", "will", "set", "UpdatedAt", "when", "updating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L51-L55
126,608
jinzhu/gorm
callback_update.go
updateCallback
func updateCallback(scope *Scope) { if !scope.HasError() { var sqls []string if updateAttrs, ok := scope.InstanceGet("gorm:update_attrs"); ok { // Sort the column names so that the generated SQL is the same every time. updateMap := updateAttrs.(map[string]interface{}) var columns []string for c := ran...
go
func updateCallback(scope *Scope) { if !scope.HasError() { var sqls []string if updateAttrs, ok := scope.InstanceGet("gorm:update_attrs"); ok { // Sort the column names so that the generated SQL is the same every time. updateMap := updateAttrs.(map[string]interface{}) var columns []string for c := ran...
[ "func", "updateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "!", "scope", ".", "HasError", "(", ")", "{", "var", "sqls", "[", "]", "string", "\n\n", "if", "updateAttrs", ",", "ok", ":=", "scope", ".", "InstanceGet", "(", "\"", "\"", ")", ...
// updateCallback the callback used to update data to database
[ "updateCallback", "the", "callback", "used", "to", "update", "data", "to", "database" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L58-L109
126,609
jinzhu/gorm
callback_update.go
afterUpdateCallback
func afterUpdateCallback(scope *Scope) { if _, ok := scope.Get("gorm:update_column"); !ok { if !scope.HasError() { scope.CallMethod("AfterUpdate") } if !scope.HasError() { scope.CallMethod("AfterSave") } } }
go
func afterUpdateCallback(scope *Scope) { if _, ok := scope.Get("gorm:update_column"); !ok { if !scope.HasError() { scope.CallMethod("AfterUpdate") } if !scope.HasError() { scope.CallMethod("AfterSave") } } }
[ "func", "afterUpdateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "_", ",", "ok", ":=", "scope", ".", "Get", "(", "\"", "\"", ")", ";", "!", "ok", "{", "if", "!", "scope", ".", "HasError", "(", ")", "{", "scope", ".", "CallMethod", "(", ...
// afterUpdateCallback will invoke `AfterUpdate`, `AfterSave` method after updating
[ "afterUpdateCallback", "will", "invoke", "AfterUpdate", "AfterSave", "method", "after", "updating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_update.go#L112-L121
126,610
jinzhu/gorm
naming.go
AddNamingStrategy
func AddNamingStrategy(ns *NamingStrategy) { if ns.DB == nil { ns.DB = defaultNamer } if ns.Table == nil { ns.Table = defaultNamer } if ns.Column == nil { ns.Column = defaultNamer } TheNamingStrategy = ns }
go
func AddNamingStrategy(ns *NamingStrategy) { if ns.DB == nil { ns.DB = defaultNamer } if ns.Table == nil { ns.Table = defaultNamer } if ns.Column == nil { ns.Column = defaultNamer } TheNamingStrategy = ns }
[ "func", "AddNamingStrategy", "(", "ns", "*", "NamingStrategy", ")", "{", "if", "ns", ".", "DB", "==", "nil", "{", "ns", ".", "DB", "=", "defaultNamer", "\n", "}", "\n", "if", "ns", ".", "Table", "==", "nil", "{", "ns", ".", "Table", "=", "defaultNa...
// AddNamingStrategy sets the naming strategy
[ "AddNamingStrategy", "sets", "the", "naming", "strategy" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/naming.go#L26-L37
126,611
jinzhu/gorm
dialect.go
GetDialect
func GetDialect(name string) (dialect Dialect, ok bool) { dialect, ok = dialectsMap[name] return }
go
func GetDialect(name string) (dialect Dialect, ok bool) { dialect, ok = dialectsMap[name] return }
[ "func", "GetDialect", "(", "name", "string", ")", "(", "dialect", "Dialect", ",", "ok", "bool", ")", "{", "dialect", ",", "ok", "=", "dialectsMap", "[", "name", "]", "\n", "return", "\n", "}" ]
// GetDialect gets the dialect for the specified dialect name
[ "GetDialect", "gets", "the", "dialect", "for", "the", "specified", "dialect", "name" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/dialect.go#L79-L82
126,612
jinzhu/gorm
callback_query_preload.go
preloadCallback
func preloadCallback(scope *Scope) { if _, skip := scope.InstanceGet("gorm:skip_query_callback"); skip { return } if ap, ok := scope.Get("gorm:auto_preload"); ok { // If gorm:auto_preload IS NOT a bool then auto preload. // Else if it IS a bool, use the value if apb, ok := ap.(bool); !ok { autoPreload(sc...
go
func preloadCallback(scope *Scope) { if _, skip := scope.InstanceGet("gorm:skip_query_callback"); skip { return } if ap, ok := scope.Get("gorm:auto_preload"); ok { // If gorm:auto_preload IS NOT a bool then auto preload. // Else if it IS a bool, use the value if apb, ok := ap.(bool); !ok { autoPreload(sc...
[ "func", "preloadCallback", "(", "scope", "*", "Scope", ")", "{", "if", "_", ",", "skip", ":=", "scope", ".", "InstanceGet", "(", "\"", "\"", ")", ";", "skip", "{", "return", "\n", "}", "\n\n", "if", "ap", ",", "ok", ":=", "scope", ".", "Get", "("...
// preloadCallback used to preload associations
[ "preloadCallback", "used", "to", "preload", "associations" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_query_preload.go#L12-L95
126,613
jinzhu/gorm
callback_query_preload.go
handleHasOnePreload
func (scope *Scope) handleHasOnePreload(field *Field, conditions []interface{}) { relation := field.Relationship // get relations's primary keys primaryKeys := scope.getColumnAsArray(relation.AssociationForeignFieldNames, scope.Value) if len(primaryKeys) == 0 { return } // preload conditions preloadDB, prelo...
go
func (scope *Scope) handleHasOnePreload(field *Field, conditions []interface{}) { relation := field.Relationship // get relations's primary keys primaryKeys := scope.getColumnAsArray(relation.AssociationForeignFieldNames, scope.Value) if len(primaryKeys) == 0 { return } // preload conditions preloadDB, prelo...
[ "func", "(", "scope", "*", "Scope", ")", "handleHasOnePreload", "(", "field", "*", "Field", ",", "conditions", "[", "]", "interface", "{", "}", ")", "{", "relation", ":=", "field", ".", "Relationship", "\n\n", "// get relations's primary keys", "primaryKeys", ...
// handleHasOnePreload used to preload has one associations
[ "handleHasOnePreload", "used", "to", "preload", "has", "one", "associations" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_query_preload.go#L134-L183
126,614
jinzhu/gorm
callback_query_preload.go
handleBelongsToPreload
func (scope *Scope) handleBelongsToPreload(field *Field, conditions []interface{}) { relation := field.Relationship // preload conditions preloadDB, preloadConditions := scope.generatePreloadDBWithConditions(conditions) // get relations's primary keys primaryKeys := scope.getColumnAsArray(relation.ForeignFieldNa...
go
func (scope *Scope) handleBelongsToPreload(field *Field, conditions []interface{}) { relation := field.Relationship // preload conditions preloadDB, preloadConditions := scope.generatePreloadDBWithConditions(conditions) // get relations's primary keys primaryKeys := scope.getColumnAsArray(relation.ForeignFieldNa...
[ "func", "(", "scope", "*", "Scope", ")", "handleBelongsToPreload", "(", "field", "*", "Field", ",", "conditions", "[", "]", "interface", "{", "}", ")", "{", "relation", ":=", "field", ".", "Relationship", "\n\n", "// preload conditions", "preloadDB", ",", "p...
// handleBelongsToPreload used to preload belongs to associations
[ "handleBelongsToPreload", "used", "to", "preload", "belongs", "to", "associations" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_query_preload.go#L239-L283
126,615
jinzhu/gorm
callback_create.go
init
func init() { DefaultCallback.Create().Register("gorm:begin_transaction", beginTransactionCallback) DefaultCallback.Create().Register("gorm:before_create", beforeCreateCallback) DefaultCallback.Create().Register("gorm:save_before_associations", saveBeforeAssociationsCallback) DefaultCallback.Create().Register("gorm...
go
func init() { DefaultCallback.Create().Register("gorm:begin_transaction", beginTransactionCallback) DefaultCallback.Create().Register("gorm:before_create", beforeCreateCallback) DefaultCallback.Create().Register("gorm:save_before_associations", saveBeforeAssociationsCallback) DefaultCallback.Create().Register("gorm...
[ "func", "init", "(", ")", "{", "DefaultCallback", ".", "Create", "(", ")", ".", "Register", "(", "\"", "\"", ",", "beginTransactionCallback", ")", "\n", "DefaultCallback", ".", "Create", "(", ")", ".", "Register", "(", "\"", "\"", ",", "beforeCreateCallbac...
// Define callbacks for creating
[ "Define", "callbacks", "for", "creating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_create.go#L9-L19
126,616
jinzhu/gorm
callback_create.go
beforeCreateCallback
func beforeCreateCallback(scope *Scope) { if !scope.HasError() { scope.CallMethod("BeforeSave") } if !scope.HasError() { scope.CallMethod("BeforeCreate") } }
go
func beforeCreateCallback(scope *Scope) { if !scope.HasError() { scope.CallMethod("BeforeSave") } if !scope.HasError() { scope.CallMethod("BeforeCreate") } }
[ "func", "beforeCreateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "!", "scope", ".", "HasError", "(", ")", "{", "scope", ".", "CallMethod", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "scope", ".", "HasError", "(", ")", "{", "scope"...
// beforeCreateCallback will invoke `BeforeSave`, `BeforeCreate` method before creating
[ "beforeCreateCallback", "will", "invoke", "BeforeSave", "BeforeCreate", "method", "before", "creating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_create.go#L22-L29
126,617
jinzhu/gorm
callback_create.go
updateTimeStampForCreateCallback
func updateTimeStampForCreateCallback(scope *Scope) { if !scope.HasError() { now := NowFunc() if createdAtField, ok := scope.FieldByName("CreatedAt"); ok { if createdAtField.IsBlank { createdAtField.Set(now) } } if updatedAtField, ok := scope.FieldByName("UpdatedAt"); ok { if updatedAtField.IsBl...
go
func updateTimeStampForCreateCallback(scope *Scope) { if !scope.HasError() { now := NowFunc() if createdAtField, ok := scope.FieldByName("CreatedAt"); ok { if createdAtField.IsBlank { createdAtField.Set(now) } } if updatedAtField, ok := scope.FieldByName("UpdatedAt"); ok { if updatedAtField.IsBl...
[ "func", "updateTimeStampForCreateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "!", "scope", ".", "HasError", "(", ")", "{", "now", ":=", "NowFunc", "(", ")", "\n\n", "if", "createdAtField", ",", "ok", ":=", "scope", ".", "FieldByName", "(", "\"...
// updateTimeStampForCreateCallback will set `CreatedAt`, `UpdatedAt` when creating
[ "updateTimeStampForCreateCallback", "will", "set", "CreatedAt", "UpdatedAt", "when", "creating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_create.go#L32-L48
126,618
jinzhu/gorm
callback_create.go
forceReloadAfterCreateCallback
func forceReloadAfterCreateCallback(scope *Scope) { if blankColumnsWithDefaultValue, ok := scope.InstanceGet("gorm:blank_columns_with_default_value"); ok { db := scope.DB().New().Table(scope.TableName()).Select(blankColumnsWithDefaultValue.([]string)) for _, field := range scope.Fields() { if field.IsPrimaryKey...
go
func forceReloadAfterCreateCallback(scope *Scope) { if blankColumnsWithDefaultValue, ok := scope.InstanceGet("gorm:blank_columns_with_default_value"); ok { db := scope.DB().New().Table(scope.TableName()).Select(blankColumnsWithDefaultValue.([]string)) for _, field := range scope.Fields() { if field.IsPrimaryKey...
[ "func", "forceReloadAfterCreateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "blankColumnsWithDefaultValue", ",", "ok", ":=", "scope", ".", "InstanceGet", "(", "\"", "\"", ")", ";", "ok", "{", "db", ":=", "scope", ".", "DB", "(", ")", ".", "New"...
// forceReloadAfterCreateCallback will reload columns that having default value, and set it back to current object
[ "forceReloadAfterCreateCallback", "will", "reload", "columns", "that", "having", "default", "value", "and", "set", "it", "back", "to", "current", "object" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_create.go#L153-L163
126,619
jinzhu/gorm
callback_create.go
afterCreateCallback
func afterCreateCallback(scope *Scope) { if !scope.HasError() { scope.CallMethod("AfterCreate") } if !scope.HasError() { scope.CallMethod("AfterSave") } }
go
func afterCreateCallback(scope *Scope) { if !scope.HasError() { scope.CallMethod("AfterCreate") } if !scope.HasError() { scope.CallMethod("AfterSave") } }
[ "func", "afterCreateCallback", "(", "scope", "*", "Scope", ")", "{", "if", "!", "scope", ".", "HasError", "(", ")", "{", "scope", ".", "CallMethod", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "scope", ".", "HasError", "(", ")", "{", "scope",...
// afterCreateCallback will invoke `AfterCreate`, `AfterSave` method after creating
[ "afterCreateCallback", "will", "invoke", "AfterCreate", "AfterSave", "method", "after", "creating" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/callback_create.go#L166-L173
126,620
jinzhu/gorm
dialects/postgres/postgres.go
Value
func (h Hstore) Value() (driver.Value, error) { hstore := hstore.Hstore{Map: map[string]sql.NullString{}} if len(h) == 0 { return nil, nil } for key, value := range h { var s sql.NullString if value != nil { s.String = *value s.Valid = true } hstore.Map[key] = s } return hstore.Value() }
go
func (h Hstore) Value() (driver.Value, error) { hstore := hstore.Hstore{Map: map[string]sql.NullString{}} if len(h) == 0 { return nil, nil } for key, value := range h { var s sql.NullString if value != nil { s.String = *value s.Valid = true } hstore.Map[key] = s } return hstore.Value() }
[ "func", "(", "h", "Hstore", ")", "Value", "(", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "hstore", ":=", "hstore", ".", "Hstore", "{", "Map", ":", "map", "[", "string", "]", "sql", ".", "NullString", "{", "}", "}", "\n", "if", "...
// Value get value of Hstore
[ "Value", "get", "value", "of", "Hstore" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/dialects/postgres/postgres.go#L17-L32
126,621
jinzhu/gorm
dialects/postgres/postgres.go
Scan
func (h *Hstore) Scan(value interface{}) error { hstore := hstore.Hstore{} if err := hstore.Scan(value); err != nil { return err } if len(hstore.Map) == 0 { return nil } *h = Hstore{} for k := range hstore.Map { if hstore.Map[k].Valid { s := hstore.Map[k].String (*h)[k] = &s } else { (*h)[k] ...
go
func (h *Hstore) Scan(value interface{}) error { hstore := hstore.Hstore{} if err := hstore.Scan(value); err != nil { return err } if len(hstore.Map) == 0 { return nil } *h = Hstore{} for k := range hstore.Map { if hstore.Map[k].Valid { s := hstore.Map[k].String (*h)[k] = &s } else { (*h)[k] ...
[ "func", "(", "h", "*", "Hstore", ")", "Scan", "(", "value", "interface", "{", "}", ")", "error", "{", "hstore", ":=", "hstore", ".", "Hstore", "{", "}", "\n\n", "if", "err", ":=", "hstore", ".", "Scan", "(", "value", ")", ";", "err", "!=", "nil",...
// Scan scan value into Hstore
[ "Scan", "scan", "value", "into", "Hstore" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/dialects/postgres/postgres.go#L35-L57
126,622
jinzhu/gorm
dialects/postgres/postgres.go
Scan
func (j *Jsonb) Scan(value interface{}) error { bytes, ok := value.([]byte) if !ok { return errors.New(fmt.Sprint("Failed to unmarshal JSONB value:", value)) } return json.Unmarshal(bytes, j) }
go
func (j *Jsonb) Scan(value interface{}) error { bytes, ok := value.([]byte) if !ok { return errors.New(fmt.Sprint("Failed to unmarshal JSONB value:", value)) } return json.Unmarshal(bytes, j) }
[ "func", "(", "j", "*", "Jsonb", ")", "Scan", "(", "value", "interface", "{", "}", ")", "error", "{", "bytes", ",", "ok", ":=", "value", ".", "(", "[", "]", "byte", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "New", "(", "fmt", "...
// Scan scan value into Jsonb
[ "Scan", "scan", "value", "into", "Jsonb" ]
b00248862ac8ca12dd54274094d404007173ec2c
https://github.com/jinzhu/gorm/blob/b00248862ac8ca12dd54274094d404007173ec2c/dialects/postgres/postgres.go#L73-L80
126,623
go-kit/kit
examples/addsvc/pkg/addtransport/http.go
NewHTTPHandler
func NewHTTPHandler(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) http.Handler { // Zipkin HTTP Server Trace can either be instantiated per endpoint with a // provided operation name or a global tracing service can be instantiated // without an operatio...
go
func NewHTTPHandler(endpoints addendpoint.Set, otTracer stdopentracing.Tracer, zipkinTracer *stdzipkin.Tracer, logger log.Logger) http.Handler { // Zipkin HTTP Server Trace can either be instantiated per endpoint with a // provided operation name or a global tracing service can be instantiated // without an operatio...
[ "func", "NewHTTPHandler", "(", "endpoints", "addendpoint", ".", "Set", ",", "otTracer", "stdopentracing", ".", "Tracer", ",", "zipkinTracer", "*", "stdzipkin", ".", "Tracer", ",", "logger", "log", ".", "Logger", ")", "http", ".", "Handler", "{", "// Zipkin HTT...
// NewHTTPHandler returns an HTTP handler that makes a set of endpoints // available on predefined paths.
[ "NewHTTPHandler", "returns", "an", "HTTP", "handler", "that", "makes", "a", "set", "of", "endpoints", "available", "on", "predefined", "paths", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/addsvc/pkg/addtransport/http.go#L35-L63
126,624
go-kit/kit
sd/eureka/instancer.go
NewInstancer
func NewInstancer(conn fargoConnection, app string, logger log.Logger) *Instancer { logger = log.With(logger, "app", app) s := &Instancer{ cache: instance.NewCache(), conn: conn, app: app, logger: logger, quitc: make(chan chan struct{}), } done := make(chan struct{}) updates := conn.ScheduleAppU...
go
func NewInstancer(conn fargoConnection, app string, logger log.Logger) *Instancer { logger = log.With(logger, "app", app) s := &Instancer{ cache: instance.NewCache(), conn: conn, app: app, logger: logger, quitc: make(chan chan struct{}), } done := make(chan struct{}) updates := conn.ScheduleAppU...
[ "func", "NewInstancer", "(", "conn", "fargoConnection", ",", "app", "string", ",", "logger", "log", ".", "Logger", ")", "*", "Instancer", "{", "logger", "=", "log", ".", "With", "(", "logger", ",", "\"", "\"", ",", "app", ")", "\n\n", "s", ":=", "&",...
// NewInstancer returns a Eureka Instancer. It will start watching the given // app string for changes, and update the subscribers accordingly.
[ "NewInstancer", "returns", "a", "Eureka", "Instancer", ".", "It", "will", "start", "watching", "the", "given", "app", "string", "for", "changes", "and", "update", "the", "subscribers", "accordingly", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/eureka/instancer.go#L25-L41
126,625
go-kit/kit
sd/eureka/instancer.go
Stop
func (s *Instancer) Stop() { q := make(chan struct{}) s.quitc <- q <-q s.quitc = nil }
go
func (s *Instancer) Stop() { q := make(chan struct{}) s.quitc <- q <-q s.quitc = nil }
[ "func", "(", "s", "*", "Instancer", ")", "Stop", "(", ")", "{", "q", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "s", ".", "quitc", "<-", "q", "\n", "<-", "q", "\n", "s", ".", "quitc", "=", "nil", "\n", "}" ]
// Stop terminates the Instancer.
[ "Stop", "terminates", "the", "Instancer", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/eureka/instancer.go#L44-L49
126,626
go-kit/kit
examples/profilesvc/endpoints.go
MakeServerEndpoints
func MakeServerEndpoints(s Service) Endpoints { return Endpoints{ PostProfileEndpoint: MakePostProfileEndpoint(s), GetProfileEndpoint: MakeGetProfileEndpoint(s), PutProfileEndpoint: MakePutProfileEndpoint(s), PatchProfileEndpoint: MakePatchProfileEndpoint(s), DeleteProfileEndpoint: MakeDeleteProfile...
go
func MakeServerEndpoints(s Service) Endpoints { return Endpoints{ PostProfileEndpoint: MakePostProfileEndpoint(s), GetProfileEndpoint: MakeGetProfileEndpoint(s), PutProfileEndpoint: MakePutProfileEndpoint(s), PatchProfileEndpoint: MakePatchProfileEndpoint(s), DeleteProfileEndpoint: MakeDeleteProfile...
[ "func", "MakeServerEndpoints", "(", "s", "Service", ")", "Endpoints", "{", "return", "Endpoints", "{", "PostProfileEndpoint", ":", "MakePostProfileEndpoint", "(", "s", ")", ",", "GetProfileEndpoint", ":", "MakeGetProfileEndpoint", "(", "s", ")", ",", "PutProfileEndp...
// MakeServerEndpoints returns an Endpoints struct where each endpoint invokes // the corresponding method on the provided service. Useful in a profilesvc // server.
[ "MakeServerEndpoints", "returns", "an", "Endpoints", "struct", "where", "each", "endpoint", "invokes", "the", "corresponding", "method", "on", "the", "provided", "service", ".", "Useful", "in", "a", "profilesvc", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L41-L53
126,627
go-kit/kit
examples/profilesvc/endpoints.go
PostProfile
func (e Endpoints) PostProfile(ctx context.Context, p Profile) error { request := postProfileRequest{Profile: p} response, err := e.PostProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(postProfileResponse) return resp.Err }
go
func (e Endpoints) PostProfile(ctx context.Context, p Profile) error { request := postProfileRequest{Profile: p} response, err := e.PostProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(postProfileResponse) return resp.Err }
[ "func", "(", "e", "Endpoints", ")", "PostProfile", "(", "ctx", "context", ".", "Context", ",", "p", "Profile", ")", "error", "{", "request", ":=", "postProfileRequest", "{", "Profile", ":", "p", "}", "\n", "response", ",", "err", ":=", "e", ".", "PostP...
// PostProfile implements Service. Primarily useful in a client.
[ "PostProfile", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L88-L96
126,628
go-kit/kit
examples/profilesvc/endpoints.go
GetProfile
func (e Endpoints) GetProfile(ctx context.Context, id string) (Profile, error) { request := getProfileRequest{ID: id} response, err := e.GetProfileEndpoint(ctx, request) if err != nil { return Profile{}, err } resp := response.(getProfileResponse) return resp.Profile, resp.Err }
go
func (e Endpoints) GetProfile(ctx context.Context, id string) (Profile, error) { request := getProfileRequest{ID: id} response, err := e.GetProfileEndpoint(ctx, request) if err != nil { return Profile{}, err } resp := response.(getProfileResponse) return resp.Profile, resp.Err }
[ "func", "(", "e", "Endpoints", ")", "GetProfile", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "Profile", ",", "error", ")", "{", "request", ":=", "getProfileRequest", "{", "ID", ":", "id", "}", "\n", "response", ",", "err", ...
// GetProfile implements Service. Primarily useful in a client.
[ "GetProfile", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L99-L107
126,629
go-kit/kit
examples/profilesvc/endpoints.go
PutProfile
func (e Endpoints) PutProfile(ctx context.Context, id string, p Profile) error { request := putProfileRequest{ID: id, Profile: p} response, err := e.PutProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(putProfileResponse) return resp.Err }
go
func (e Endpoints) PutProfile(ctx context.Context, id string, p Profile) error { request := putProfileRequest{ID: id, Profile: p} response, err := e.PutProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(putProfileResponse) return resp.Err }
[ "func", "(", "e", "Endpoints", ")", "PutProfile", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "p", "Profile", ")", "error", "{", "request", ":=", "putProfileRequest", "{", "ID", ":", "id", ",", "Profile", ":", "p", "}", "\n", "re...
// PutProfile implements Service. Primarily useful in a client.
[ "PutProfile", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L110-L118
126,630
go-kit/kit
examples/profilesvc/endpoints.go
PatchProfile
func (e Endpoints) PatchProfile(ctx context.Context, id string, p Profile) error { request := patchProfileRequest{ID: id, Profile: p} response, err := e.PatchProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(patchProfileResponse) return resp.Err }
go
func (e Endpoints) PatchProfile(ctx context.Context, id string, p Profile) error { request := patchProfileRequest{ID: id, Profile: p} response, err := e.PatchProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(patchProfileResponse) return resp.Err }
[ "func", "(", "e", "Endpoints", ")", "PatchProfile", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "p", "Profile", ")", "error", "{", "request", ":=", "patchProfileRequest", "{", "ID", ":", "id", ",", "Profile", ":", "p", "}", "\n", ...
// PatchProfile implements Service. Primarily useful in a client.
[ "PatchProfile", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L121-L129
126,631
go-kit/kit
examples/profilesvc/endpoints.go
DeleteProfile
func (e Endpoints) DeleteProfile(ctx context.Context, id string) error { request := deleteProfileRequest{ID: id} response, err := e.DeleteProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(deleteProfileResponse) return resp.Err }
go
func (e Endpoints) DeleteProfile(ctx context.Context, id string) error { request := deleteProfileRequest{ID: id} response, err := e.DeleteProfileEndpoint(ctx, request) if err != nil { return err } resp := response.(deleteProfileResponse) return resp.Err }
[ "func", "(", "e", "Endpoints", ")", "DeleteProfile", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "error", "{", "request", ":=", "deleteProfileRequest", "{", "ID", ":", "id", "}", "\n", "response", ",", "err", ":=", "e", ".", "Delet...
// DeleteProfile implements Service. Primarily useful in a client.
[ "DeleteProfile", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L132-L140
126,632
go-kit/kit
examples/profilesvc/endpoints.go
GetAddresses
func (e Endpoints) GetAddresses(ctx context.Context, profileID string) ([]Address, error) { request := getAddressesRequest{ProfileID: profileID} response, err := e.GetAddressesEndpoint(ctx, request) if err != nil { return nil, err } resp := response.(getAddressesResponse) return resp.Addresses, resp.Err }
go
func (e Endpoints) GetAddresses(ctx context.Context, profileID string) ([]Address, error) { request := getAddressesRequest{ProfileID: profileID} response, err := e.GetAddressesEndpoint(ctx, request) if err != nil { return nil, err } resp := response.(getAddressesResponse) return resp.Addresses, resp.Err }
[ "func", "(", "e", "Endpoints", ")", "GetAddresses", "(", "ctx", "context", ".", "Context", ",", "profileID", "string", ")", "(", "[", "]", "Address", ",", "error", ")", "{", "request", ":=", "getAddressesRequest", "{", "ProfileID", ":", "profileID", "}", ...
// GetAddresses implements Service. Primarily useful in a client.
[ "GetAddresses", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L143-L151
126,633
go-kit/kit
examples/profilesvc/endpoints.go
GetAddress
func (e Endpoints) GetAddress(ctx context.Context, profileID string, addressID string) (Address, error) { request := getAddressRequest{ProfileID: profileID, AddressID: addressID} response, err := e.GetAddressEndpoint(ctx, request) if err != nil { return Address{}, err } resp := response.(getAddressResponse) ret...
go
func (e Endpoints) GetAddress(ctx context.Context, profileID string, addressID string) (Address, error) { request := getAddressRequest{ProfileID: profileID, AddressID: addressID} response, err := e.GetAddressEndpoint(ctx, request) if err != nil { return Address{}, err } resp := response.(getAddressResponse) ret...
[ "func", "(", "e", "Endpoints", ")", "GetAddress", "(", "ctx", "context", ".", "Context", ",", "profileID", "string", ",", "addressID", "string", ")", "(", "Address", ",", "error", ")", "{", "request", ":=", "getAddressRequest", "{", "ProfileID", ":", "prof...
// GetAddress implements Service. Primarily useful in a client.
[ "GetAddress", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L154-L162
126,634
go-kit/kit
examples/profilesvc/endpoints.go
PostAddress
func (e Endpoints) PostAddress(ctx context.Context, profileID string, a Address) error { request := postAddressRequest{ProfileID: profileID, Address: a} response, err := e.PostAddressEndpoint(ctx, request) if err != nil { return err } resp := response.(postAddressResponse) return resp.Err }
go
func (e Endpoints) PostAddress(ctx context.Context, profileID string, a Address) error { request := postAddressRequest{ProfileID: profileID, Address: a} response, err := e.PostAddressEndpoint(ctx, request) if err != nil { return err } resp := response.(postAddressResponse) return resp.Err }
[ "func", "(", "e", "Endpoints", ")", "PostAddress", "(", "ctx", "context", ".", "Context", ",", "profileID", "string", ",", "a", "Address", ")", "error", "{", "request", ":=", "postAddressRequest", "{", "ProfileID", ":", "profileID", ",", "Address", ":", "a...
// PostAddress implements Service. Primarily useful in a client.
[ "PostAddress", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L165-L173
126,635
go-kit/kit
examples/profilesvc/endpoints.go
DeleteAddress
func (e Endpoints) DeleteAddress(ctx context.Context, profileID string, addressID string) error { request := deleteAddressRequest{ProfileID: profileID, AddressID: addressID} response, err := e.DeleteAddressEndpoint(ctx, request) if err != nil { return err } resp := response.(deleteAddressResponse) return resp.E...
go
func (e Endpoints) DeleteAddress(ctx context.Context, profileID string, addressID string) error { request := deleteAddressRequest{ProfileID: profileID, AddressID: addressID} response, err := e.DeleteAddressEndpoint(ctx, request) if err != nil { return err } resp := response.(deleteAddressResponse) return resp.E...
[ "func", "(", "e", "Endpoints", ")", "DeleteAddress", "(", "ctx", "context", ".", "Context", ",", "profileID", "string", ",", "addressID", "string", ")", "error", "{", "request", ":=", "deleteAddressRequest", "{", "ProfileID", ":", "profileID", ",", "AddressID"...
// DeleteAddress implements Service. Primarily useful in a client.
[ "DeleteAddress", "implements", "Service", ".", "Primarily", "useful", "in", "a", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L176-L184
126,636
go-kit/kit
examples/profilesvc/endpoints.go
MakePostProfileEndpoint
func MakePostProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(postProfileRequest) e := s.PostProfile(ctx, req.Profile) return postProfileResponse{Err: e}, nil } }
go
func MakePostProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(postProfileRequest) e := s.PostProfile(ctx, req.Profile) return postProfileResponse{Err: e}, nil } }
[ "func", "MakePostProfileEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error",...
// MakePostProfileEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakePostProfileEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L188-L194
126,637
go-kit/kit
examples/profilesvc/endpoints.go
MakeGetProfileEndpoint
func MakeGetProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getProfileRequest) p, e := s.GetProfile(ctx, req.ID) return getProfileResponse{Profile: p, Err: e}, nil } }
go
func MakeGetProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getProfileRequest) p, e := s.GetProfile(ctx, req.ID) return getProfileResponse{Profile: p, Err: e}, nil } }
[ "func", "MakeGetProfileEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error", ...
// MakeGetProfileEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakeGetProfileEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L198-L204
126,638
go-kit/kit
examples/profilesvc/endpoints.go
MakePutProfileEndpoint
func MakePutProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(putProfileRequest) e := s.PutProfile(ctx, req.ID, req.Profile) return putProfileResponse{Err: e}, nil } }
go
func MakePutProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(putProfileRequest) e := s.PutProfile(ctx, req.ID, req.Profile) return putProfileResponse{Err: e}, nil } }
[ "func", "MakePutProfileEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error", ...
// MakePutProfileEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakePutProfileEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L208-L214
126,639
go-kit/kit
examples/profilesvc/endpoints.go
MakePatchProfileEndpoint
func MakePatchProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(patchProfileRequest) e := s.PatchProfile(ctx, req.ID, req.Profile) return patchProfileResponse{Err: e}, nil } }
go
func MakePatchProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(patchProfileRequest) e := s.PatchProfile(ctx, req.ID, req.Profile) return patchProfileResponse{Err: e}, nil } }
[ "func", "MakePatchProfileEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error"...
// MakePatchProfileEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakePatchProfileEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L218-L224
126,640
go-kit/kit
examples/profilesvc/endpoints.go
MakeDeleteProfileEndpoint
func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(deleteProfileRequest) e := s.DeleteProfile(ctx, req.ID) return deleteProfileResponse{Err: e}, nil } }
go
func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(deleteProfileRequest) e := s.DeleteProfile(ctx, req.ID) return deleteProfileResponse{Err: e}, nil } }
[ "func", "MakeDeleteProfileEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error...
// MakeDeleteProfileEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakeDeleteProfileEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L228-L234
126,641
go-kit/kit
examples/profilesvc/endpoints.go
MakeGetAddressesEndpoint
func MakeGetAddressesEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getAddressesRequest) a, e := s.GetAddresses(ctx, req.ProfileID) return getAddressesResponse{Addresses: a, Err: e}, nil } }
go
func MakeGetAddressesEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getAddressesRequest) a, e := s.GetAddresses(ctx, req.ProfileID) return getAddressesResponse{Addresses: a, Err: e}, nil } }
[ "func", "MakeGetAddressesEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error"...
// MakeGetAddressesEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakeGetAddressesEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L238-L244
126,642
go-kit/kit
examples/profilesvc/endpoints.go
MakeGetAddressEndpoint
func MakeGetAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getAddressRequest) a, e := s.GetAddress(ctx, req.ProfileID, req.AddressID) return getAddressResponse{Address: a, Err: e}, nil } }
go
func MakeGetAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(getAddressRequest) a, e := s.GetAddress(ctx, req.ProfileID, req.AddressID) return getAddressResponse{Address: a, Err: e}, nil } }
[ "func", "MakeGetAddressEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error", ...
// MakeGetAddressEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakeGetAddressEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L248-L254
126,643
go-kit/kit
examples/profilesvc/endpoints.go
MakePostAddressEndpoint
func MakePostAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(postAddressRequest) e := s.PostAddress(ctx, req.ProfileID, req.Address) return postAddressResponse{Err: e}, nil } }
go
func MakePostAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(postAddressRequest) e := s.PostAddress(ctx, req.ProfileID, req.Address) return postAddressResponse{Err: e}, nil } }
[ "func", "MakePostAddressEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error",...
// MakePostAddressEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakePostAddressEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L258-L264
126,644
go-kit/kit
examples/profilesvc/endpoints.go
MakeDeleteAddressEndpoint
func MakeDeleteAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(deleteAddressRequest) e := s.DeleteAddress(ctx, req.ProfileID, req.AddressID) return deleteAddressResponse{Err: e}, nil } }
go
func MakeDeleteAddressEndpoint(s Service) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { req := request.(deleteAddressRequest) e := s.DeleteAddress(ctx, req.ProfileID, req.AddressID) return deleteAddressResponse{Err: e}, nil } }
[ "func", "MakeDeleteAddressEndpoint", "(", "s", "Service", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "request", "interface", "{", "}", ")", "(", "response", "interface", "{", "}", ",", "err", "error...
// MakeDeleteAddressEndpoint returns an endpoint via the passed service. // Primarily useful in a server.
[ "MakeDeleteAddressEndpoint", "returns", "an", "endpoint", "via", "the", "passed", "service", ".", "Primarily", "useful", "in", "a", "server", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/profilesvc/endpoints.go#L268-L274
126,645
go-kit/kit
log/term/term.go
NewLogger
func NewLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger { if !IsTerminal(w) { return newLogger(w) } return NewColorLogger(NewColorWriter(w), newLogger, color) }
go
func NewLogger(w io.Writer, newLogger func(io.Writer) log.Logger, color func(keyvals ...interface{}) FgBgColor) log.Logger { if !IsTerminal(w) { return newLogger(w) } return NewColorLogger(NewColorWriter(w), newLogger, color) }
[ "func", "NewLogger", "(", "w", "io", ".", "Writer", ",", "newLogger", "func", "(", "io", ".", "Writer", ")", "log", ".", "Logger", ",", "color", "func", "(", "keyvals", "...", "interface", "{", "}", ")", "FgBgColor", ")", "log", ".", "Logger", "{", ...
// NewLogger returns a Logger that takes advantage of terminal features if // possible. Log events are formatted by the Logger returned by newLogger. If // w is a terminal each log event is colored according to the color function.
[ "NewLogger", "returns", "a", "Logger", "that", "takes", "advantage", "of", "terminal", "features", "if", "possible", ".", "Log", "events", "are", "formatted", "by", "the", "Logger", "returned", "by", "newLogger", ".", "If", "w", "is", "a", "terminal", "each"...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/term/term.go#L13-L18
126,646
go-kit/kit
ratelimit/token_bucket.go
NewErroringLimiter
func NewErroringLimiter(limit Allower) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { if !limit.Allow() { return nil, ErrLimited } return next(ctx, request) } } }
go
func NewErroringLimiter(limit Allower) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { if !limit.Allow() { return nil, ErrLimited } return next(ctx, request) } } }
[ "func", "NewErroringLimiter", "(", "limit", "Allower", ")", "endpoint", ".", "Middleware", "{", "return", "func", "(", "next", "endpoint", ".", "Endpoint", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", ...
// NewErroringLimiter returns an endpoint.Middleware that acts as a rate // limiter. Requests that would exceed the // maximum request rate are simply rejected with an error.
[ "NewErroringLimiter", "returns", "an", "endpoint", ".", "Middleware", "that", "acts", "as", "a", "rate", "limiter", ".", "Requests", "that", "would", "exceed", "the", "maximum", "request", "rate", "are", "simply", "rejected", "with", "an", "error", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/ratelimit/token_bucket.go#L24-L33
126,647
go-kit/kit
ratelimit/token_bucket.go
NewDelayingLimiter
func NewDelayingLimiter(limit Waiter) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { if err := limit.Wait(ctx); err != nil { return nil, err } return next(ctx, request) } } }
go
func NewDelayingLimiter(limit Waiter) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (interface{}, error) { if err := limit.Wait(ctx); err != nil { return nil, err } return next(ctx, request) } } }
[ "func", "NewDelayingLimiter", "(", "limit", "Waiter", ")", "endpoint", ".", "Middleware", "{", "return", "func", "(", "next", "endpoint", ".", "Endpoint", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", ...
// NewDelayingLimiter returns an endpoint.Middleware that acts as a // request throttler. Requests that would // exceed the maximum request rate are delayed via the Waiter function
[ "NewDelayingLimiter", "returns", "an", "endpoint", ".", "Middleware", "that", "acts", "as", "a", "request", "throttler", ".", "Requests", "that", "would", "exceed", "the", "maximum", "request", "rate", "are", "delayed", "via", "the", "Waiter", "function" ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/ratelimit/token_bucket.go#L45-L54
126,648
go-kit/kit
sd/zk/registrar.go
NewRegistrar
func NewRegistrar(client Client, service Service, logger log.Logger) *Registrar { return &Registrar{ client: client, service: service, logger: log.With(logger, "service", service.Name, "path", service.Path, "data", string(service.Data), ), } }
go
func NewRegistrar(client Client, service Service, logger log.Logger) *Registrar { return &Registrar{ client: client, service: service, logger: log.With(logger, "service", service.Name, "path", service.Path, "data", string(service.Data), ), } }
[ "func", "NewRegistrar", "(", "client", "Client", ",", "service", "Service", ",", "logger", "log", ".", "Logger", ")", "*", "Registrar", "{", "return", "&", "Registrar", "{", "client", ":", "client", ",", "service", ":", "service", ",", "logger", ":", "lo...
// NewRegistrar returns a ZooKeeper Registrar acting on the provided catalog // registration.
[ "NewRegistrar", "returns", "a", "ZooKeeper", "Registrar", "acting", "on", "the", "provided", "catalog", "registration", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/zk/registrar.go#L23-L33
126,649
go-kit/kit
sd/etcd/instancer.go
NewInstancer
func NewInstancer(c Client, prefix string, logger log.Logger) (*Instancer, error) { s := &Instancer{ client: c, prefix: prefix, cache: instance.NewCache(), logger: logger, quitc: make(chan struct{}), } instances, err := s.client.GetEntries(s.prefix) if err == nil { logger.Log("prefix", s.prefix, "ins...
go
func NewInstancer(c Client, prefix string, logger log.Logger) (*Instancer, error) { s := &Instancer{ client: c, prefix: prefix, cache: instance.NewCache(), logger: logger, quitc: make(chan struct{}), } instances, err := s.client.GetEntries(s.prefix) if err == nil { logger.Log("prefix", s.prefix, "ins...
[ "func", "NewInstancer", "(", "c", "Client", ",", "prefix", "string", ",", "logger", "log", ".", "Logger", ")", "(", "*", "Instancer", ",", "error", ")", "{", "s", ":=", "&", "Instancer", "{", "client", ":", "c", ",", "prefix", ":", "prefix", ",", "...
// NewInstancer returns an etcd instancer. It will start watching the given // prefix for changes, and update the subscribers.
[ "NewInstancer", "returns", "an", "etcd", "instancer", ".", "It", "will", "start", "watching", "the", "given", "prefix", "for", "changes", "and", "update", "the", "subscribers", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/etcd/instancer.go#L21-L40
126,650
go-kit/kit
log/zap/zap_sugar_logger.go
NewZapSugarLogger
func NewZapSugarLogger(logger *zap.Logger, level zapcore.Level) log.Logger { sugarLogger := logger.WithOptions(zap.AddCallerSkip(2)).Sugar() var sugar zapSugarLogger switch level { case zapcore.DebugLevel: sugar = sugarLogger.Debugw case zapcore.InfoLevel: sugar = sugarLogger.Infow case zapcore.WarnLevel: s...
go
func NewZapSugarLogger(logger *zap.Logger, level zapcore.Level) log.Logger { sugarLogger := logger.WithOptions(zap.AddCallerSkip(2)).Sugar() var sugar zapSugarLogger switch level { case zapcore.DebugLevel: sugar = sugarLogger.Debugw case zapcore.InfoLevel: sugar = sugarLogger.Infow case zapcore.WarnLevel: s...
[ "func", "NewZapSugarLogger", "(", "logger", "*", "zap", ".", "Logger", ",", "level", "zapcore", ".", "Level", ")", "log", ".", "Logger", "{", "sugarLogger", ":=", "logger", ".", "WithOptions", "(", "zap", ".", "AddCallerSkip", "(", "2", ")", ")", ".", ...
// NewZapSugarLogger returns a Go kit log.Logger that sends // log events to a zap.Logger.
[ "NewZapSugarLogger", "returns", "a", "Go", "kit", "log", ".", "Logger", "that", "sends", "log", "events", "to", "a", "zap", ".", "Logger", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/zap/zap_sugar_logger.go#L18-L40
126,651
go-kit/kit
transport/amqp/request_response_func.go
SetPublishExchange
func SetPublishExchange(publishExchange string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyExchange, publishExchange) } }
go
func SetPublishExchange(publishExchange string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyExchange, publishExchange) } }
[ "func", "SetPublishExchange", "(", "publishExchange", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Cont...
// SetPublishExchange returns a RequestFunc that sets the Exchange field // of an AMQP Publish call.
[ "SetPublishExchange", "returns", "a", "RequestFunc", "that", "sets", "the", "Exchange", "field", "of", "an", "AMQP", "Publish", "call", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L31-L35
126,652
go-kit/kit
transport/amqp/request_response_func.go
SetPublishKey
func SetPublishKey(publishKey string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyPublishKey, publishKey) } }
go
func SetPublishKey(publishKey string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyPublishKey, publishKey) } }
[ "func", "SetPublishKey", "(", "publishKey", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Context", "{...
// SetPublishKey returns a RequestFunc that sets the Key field // of an AMQP Publish call.
[ "SetPublishKey", "returns", "a", "RequestFunc", "that", "sets", "the", "Key", "field", "of", "an", "AMQP", "Publish", "call", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L39-L43
126,653
go-kit/kit
transport/amqp/request_response_func.go
SetPublishDeliveryMode
func SetPublishDeliveryMode(dmode uint8) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.DeliveryMode = dmode return ctx } }
go
func SetPublishDeliveryMode(dmode uint8) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.DeliveryMode = dmode return ctx } }
[ "func", "SetPublishDeliveryMode", "(", "dmode", "uint8", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Context", ...
// SetPublishDeliveryMode sets the delivery mode of a Publishing. // Please refer to AMQP delivery mode constants in the AMQP package.
[ "SetPublishDeliveryMode", "sets", "the", "delivery", "mode", "of", "a", "Publishing", ".", "Please", "refer", "to", "AMQP", "delivery", "mode", "constants", "in", "the", "AMQP", "package", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L47-L52
126,654
go-kit/kit
transport/amqp/request_response_func.go
SetNackSleepDuration
func SetNackSleepDuration(duration time.Duration) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyNackSleepDuration, duration) } }
go
func SetNackSleepDuration(duration time.Duration) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyNackSleepDuration, duration) } }
[ "func", "SetNackSleepDuration", "(", "duration", "time", ".", "Duration", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ...
// SetNackSleepDuration returns a RequestFunc that sets the amount of time // to sleep in the event of a Nack. // This has to be used in conjunction with an error encoder that Nack and sleeps. // One example is the SingleNackRequeueErrorEncoder. // It is designed to be used by Subscribers.
[ "SetNackSleepDuration", "returns", "a", "RequestFunc", "that", "sets", "the", "amount", "of", "time", "to", "sleep", "in", "the", "event", "of", "a", "Nack", ".", "This", "has", "to", "be", "used", "in", "conjunction", "with", "an", "error", "encoder", "th...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L59-L63
126,655
go-kit/kit
transport/amqp/request_response_func.go
SetConsumeAutoAck
func SetConsumeAutoAck(autoAck bool) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyAutoAck, autoAck) } }
go
func SetConsumeAutoAck(autoAck bool) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyAutoAck, autoAck) } }
[ "func", "SetConsumeAutoAck", "(", "autoAck", "bool", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Context", "{"...
// SetConsumeAutoAck returns a RequestFunc that sets whether or not to autoAck // messages when consuming. // When set to false, the publisher will Ack the first message it receives with // a matching correlationId. // It is designed to be used by Publishers.
[ "SetConsumeAutoAck", "returns", "a", "RequestFunc", "that", "sets", "whether", "or", "not", "to", "autoAck", "messages", "when", "consuming", ".", "When", "set", "to", "false", "the", "publisher", "will", "Ack", "the", "first", "message", "it", "receives", "wi...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L70-L74
126,656
go-kit/kit
transport/amqp/request_response_func.go
SetConsumeArgs
func SetConsumeArgs(args amqp.Table) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyConsumeArgs, args) } }
go
func SetConsumeArgs(args amqp.Table) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { return context.WithValue(ctx, ContextKeyConsumeArgs, args) } }
[ "func", "SetConsumeArgs", "(", "args", "amqp", ".", "Table", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Con...
// SetConsumeArgs returns a RequestFunc that set the arguments for amqp Consume // function. // It is designed to be used by Publishers.
[ "SetConsumeArgs", "returns", "a", "RequestFunc", "that", "set", "the", "arguments", "for", "amqp", "Consume", "function", ".", "It", "is", "designed", "to", "be", "used", "by", "Publishers", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L79-L83
126,657
go-kit/kit
transport/amqp/request_response_func.go
SetContentType
func SetContentType(contentType string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.ContentType = contentType return ctx } }
go
func SetContentType(contentType string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.ContentType = contentType return ctx } }
[ "func", "SetContentType", "(", "contentType", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Context", ...
// SetContentType returns a RequestFunc that sets the ContentType field of // an AMQP Publishing.
[ "SetContentType", "returns", "a", "RequestFunc", "that", "sets", "the", "ContentType", "field", "of", "an", "AMQP", "Publishing", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L87-L92
126,658
go-kit/kit
transport/amqp/request_response_func.go
SetContentEncoding
func SetContentEncoding(contentEncoding string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.ContentEncoding = contentEncoding return ctx } }
go
func SetContentEncoding(contentEncoding string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.ContentEncoding = contentEncoding return ctx } }
[ "func", "SetContentEncoding", "(", "contentEncoding", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Cont...
// SetContentEncoding returns a RequestFunc that sets the ContentEncoding field // of an AMQP Publishing.
[ "SetContentEncoding", "returns", "a", "RequestFunc", "that", "sets", "the", "ContentEncoding", "field", "of", "an", "AMQP", "Publishing", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L96-L101
126,659
go-kit/kit
transport/amqp/request_response_func.go
SetCorrelationID
func SetCorrelationID(cid string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.CorrelationId = cid return ctx } }
go
func SetCorrelationID(cid string) RequestFunc { return func(ctx context.Context, pub *amqp.Publishing, _ *amqp.Delivery) context.Context { pub.CorrelationId = cid return ctx } }
[ "func", "SetCorrelationID", "(", "cid", "string", ")", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "pub", "*", "amqp", ".", "Publishing", ",", "_", "*", "amqp", ".", "Delivery", ")", "context", ".", "Context", "{", ...
// SetCorrelationID returns a RequestFunc that sets the CorrelationId field // of an AMQP Publishing.
[ "SetCorrelationID", "returns", "a", "RequestFunc", "that", "sets", "the", "CorrelationId", "field", "of", "an", "AMQP", "Publishing", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L105-L110
126,660
go-kit/kit
transport/amqp/request_response_func.go
SetAckAfterEndpoint
func SetAckAfterEndpoint(multiple bool) SubscriberResponseFunc { return func(ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) context.Context { deliv.Ack(multiple) return ctx } }
go
func SetAckAfterEndpoint(multiple bool) SubscriberResponseFunc { return func(ctx context.Context, deliv *amqp.Delivery, ch Channel, pub *amqp.Publishing, ) context.Context { deliv.Ack(multiple) return ctx } }
[ "func", "SetAckAfterEndpoint", "(", "multiple", "bool", ")", "SubscriberResponseFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "deliv", "*", "amqp", ".", "Delivery", ",", "ch", "Channel", ",", "pub", "*", "amqp", ".", "Publishing",...
// SetAckAfterEndpoint returns a SubscriberResponseFunc that prompts the service // to Ack the Delivery object after successfully evaluating the endpoint, // and before it encodes the response. // It is designed to be used by Subscribers.
[ "SetAckAfterEndpoint", "returns", "a", "SubscriberResponseFunc", "that", "prompts", "the", "service", "to", "Ack", "the", "Delivery", "object", "after", "successfully", "evaluating", "the", "endpoint", "and", "before", "it", "encodes", "the", "response", ".", "It", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/amqp/request_response_func.go#L116-L125
126,661
go-kit/kit
transport/httprp/server.go
ServerBefore
func ServerBefore(before ...RequestFunc) ServerOption { return func(s *Server) { s.before = append(s.before, before...) } }
go
func ServerBefore(before ...RequestFunc) ServerOption { return func(s *Server) { s.before = append(s.before, before...) } }
[ "func", "ServerBefore", "(", "before", "...", "RequestFunc", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "before", "=", "append", "(", "s", ".", "before", ",", "before", "...", ")", "}", "\n", "}" ]
// ServerBefore functions are executed on the HTTP request object before the // request is decoded.
[ "ServerBefore", "functions", "are", "executed", "on", "the", "HTTP", "request", "object", "before", "the", "request", "is", "decoded", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/httprp/server.go#L44-L46
126,662
go-kit/kit
tracing/opencensus/endpoint_options.go
WithEndpointAttributes
func WithEndpointAttributes(attrs ...trace.Attribute) EndpointOption { return func(o *EndpointOptions) { o.Attributes = attrs } }
go
func WithEndpointAttributes(attrs ...trace.Attribute) EndpointOption { return func(o *EndpointOptions) { o.Attributes = attrs } }
[ "func", "WithEndpointAttributes", "(", "attrs", "...", "trace", ".", "Attribute", ")", "EndpointOption", "{", "return", "func", "(", "o", "*", "EndpointOptions", ")", "{", "o", ".", "Attributes", "=", "attrs", "\n", "}", "\n", "}" ]
// WithEndpointAttributes sets the default attributes for the spans created by // the Endpoint tracer.
[ "WithEndpointAttributes", "sets", "the", "default", "attributes", "for", "the", "spans", "created", "by", "the", "Endpoint", "tracer", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/opencensus/endpoint_options.go#L30-L34
126,663
go-kit/kit
auth/jwt/transport.go
HTTPToContext
func HTTPToContext() http.RequestFunc { return func(ctx context.Context, r *stdhttp.Request) context.Context { token, ok := extractTokenFromAuthHeader(r.Header.Get("Authorization")) if !ok { return ctx } return context.WithValue(ctx, JWTTokenContextKey, token) } }
go
func HTTPToContext() http.RequestFunc { return func(ctx context.Context, r *stdhttp.Request) context.Context { token, ok := extractTokenFromAuthHeader(r.Header.Get("Authorization")) if !ok { return ctx } return context.WithValue(ctx, JWTTokenContextKey, token) } }
[ "func", "HTTPToContext", "(", ")", "http", ".", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "r", "*", "stdhttp", ".", "Request", ")", "context", ".", "Context", "{", "token", ",", "ok", ":=", "extractTokenFromAuthHeade...
// HTTPToContext moves a JWT from request header to context. Particularly // useful for servers.
[ "HTTPToContext", "moves", "a", "JWT", "from", "request", "header", "to", "context", ".", "Particularly", "useful", "for", "servers", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/auth/jwt/transport.go#L22-L31
126,664
go-kit/kit
auth/jwt/transport.go
ContextToHTTP
func ContextToHTTP() http.RequestFunc { return func(ctx context.Context, r *stdhttp.Request) context.Context { token, ok := ctx.Value(JWTTokenContextKey).(string) if ok { r.Header.Add("Authorization", generateAuthHeaderFromToken(token)) } return ctx } }
go
func ContextToHTTP() http.RequestFunc { return func(ctx context.Context, r *stdhttp.Request) context.Context { token, ok := ctx.Value(JWTTokenContextKey).(string) if ok { r.Header.Add("Authorization", generateAuthHeaderFromToken(token)) } return ctx } }
[ "func", "ContextToHTTP", "(", ")", "http", ".", "RequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "r", "*", "stdhttp", ".", "Request", ")", "context", ".", "Context", "{", "token", ",", "ok", ":=", "ctx", ".", "Value", ...
// ContextToHTTP moves a JWT from context to request header. Particularly // useful for clients.
[ "ContextToHTTP", "moves", "a", "JWT", "from", "context", "to", "request", "header", ".", "Particularly", "useful", "for", "clients", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/auth/jwt/transport.go#L35-L43
126,665
go-kit/kit
auth/jwt/transport.go
GRPCToContext
func GRPCToContext() grpc.ServerRequestFunc { return func(ctx context.Context, md metadata.MD) context.Context { // capital "Key" is illegal in HTTP/2. authHeader, ok := md["authorization"] if !ok { return ctx } token, ok := extractTokenFromAuthHeader(authHeader[0]) if ok { ctx = context.WithValue(c...
go
func GRPCToContext() grpc.ServerRequestFunc { return func(ctx context.Context, md metadata.MD) context.Context { // capital "Key" is illegal in HTTP/2. authHeader, ok := md["authorization"] if !ok { return ctx } token, ok := extractTokenFromAuthHeader(authHeader[0]) if ok { ctx = context.WithValue(c...
[ "func", "GRPCToContext", "(", ")", "grpc", ".", "ServerRequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "md", "metadata", ".", "MD", ")", "context", ".", "Context", "{", "// capital \"Key\" is illegal in HTTP/2.", "authHeader", ",...
// GRPCToContext moves a JWT from grpc metadata to context. Particularly // userful for servers.
[ "GRPCToContext", "moves", "a", "JWT", "from", "grpc", "metadata", "to", "context", ".", "Particularly", "userful", "for", "servers", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/auth/jwt/transport.go#L47-L62
126,666
go-kit/kit
auth/jwt/transport.go
ContextToGRPC
func ContextToGRPC() grpc.ClientRequestFunc { return func(ctx context.Context, md *metadata.MD) context.Context { token, ok := ctx.Value(JWTTokenContextKey).(string) if ok { // capital "Key" is illegal in HTTP/2. (*md)["authorization"] = []string{generateAuthHeaderFromToken(token)} } return ctx } }
go
func ContextToGRPC() grpc.ClientRequestFunc { return func(ctx context.Context, md *metadata.MD) context.Context { token, ok := ctx.Value(JWTTokenContextKey).(string) if ok { // capital "Key" is illegal in HTTP/2. (*md)["authorization"] = []string{generateAuthHeaderFromToken(token)} } return ctx } }
[ "func", "ContextToGRPC", "(", ")", "grpc", ".", "ClientRequestFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "md", "*", "metadata", ".", "MD", ")", "context", ".", "Context", "{", "token", ",", "ok", ":=", "ctx", ".", "Value"...
// ContextToGRPC moves a JWT from context to grpc metadata. Particularly // useful for clients.
[ "ContextToGRPC", "moves", "a", "JWT", "from", "context", "to", "grpc", "metadata", ".", "Particularly", "useful", "for", "clients", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/auth/jwt/transport.go#L66-L76
126,667
go-kit/kit
log/term/terminal_windows.go
IsConsole
func IsConsole(w io.Writer) bool { var handle syscall.Handle if fw, ok := w.(fder); ok { handle = syscall.Handle(fw.Fd()) } else { // The writer has no file-descriptor and so can't be a terminal. return false } var st uint32 err := syscall.GetConsoleMode(handle, &st) // If the handle is attached to a te...
go
func IsConsole(w io.Writer) bool { var handle syscall.Handle if fw, ok := w.(fder); ok { handle = syscall.Handle(fw.Fd()) } else { // The writer has no file-descriptor and so can't be a terminal. return false } var st uint32 err := syscall.GetConsoleMode(handle, &st) // If the handle is attached to a te...
[ "func", "IsConsole", "(", "w", "io", ".", "Writer", ")", "bool", "{", "var", "handle", "syscall", ".", "Handle", "\n\n", "if", "fw", ",", "ok", ":=", "w", ".", "(", "fder", ")", ";", "ok", "{", "handle", "=", "syscall", ".", "Handle", "(", "fw", ...
// IsConsole returns true if w writes to a Windows console.
[ "IsConsole", "returns", "true", "if", "w", "writes", "to", "a", "Windows", "console", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/log/term/terminal_windows.go#L35-L52
126,668
go-kit/kit
transport/grpc/server.go
NewServer
func NewServer( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...ServerOption, ) *Server { s := &Server{ e: e, dec: dec, enc: enc, errorHandler: transport.NewLogErrorHandler(log.NewNopLogger()), } for _, option := range options { option(s) } ...
go
func NewServer( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...ServerOption, ) *Server { s := &Server{ e: e, dec: dec, enc: enc, errorHandler: transport.NewLogErrorHandler(log.NewNopLogger()), } for _, option := range options { option(s) } ...
[ "func", "NewServer", "(", "e", "endpoint", ".", "Endpoint", ",", "dec", "DecodeRequestFunc", ",", "enc", "EncodeResponseFunc", ",", "options", "...", "ServerOption", ",", ")", "*", "Server", "{", "s", ":=", "&", "Server", "{", "e", ":", "e", ",", "dec", ...
// NewServer constructs a new server, which implements wraps the provided // endpoint and implements the Handler interface. Consumers should write // bindings that adapt the concrete gRPC methods from their compiled protobuf // definitions to individual handlers. Request and response objects are from the // caller busi...
[ "NewServer", "constructs", "a", "new", "server", "which", "implements", "wraps", "the", "provided", "endpoint", "and", "implements", "the", "Handler", "interface", ".", "Consumers", "should", "write", "bindings", "that", "adapt", "the", "concrete", "gRPC", "method...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L37-L53
126,669
go-kit/kit
transport/grpc/server.go
ServerBefore
func ServerBefore(before ...ServerRequestFunc) ServerOption { return func(s *Server) { s.before = append(s.before, before...) } }
go
func ServerBefore(before ...ServerRequestFunc) ServerOption { return func(s *Server) { s.before = append(s.before, before...) } }
[ "func", "ServerBefore", "(", "before", "...", "ServerRequestFunc", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "before", "=", "append", "(", "s", ".", "before", ",", "before", "...", ")", "}", "\n", "}" ]
// ServerBefore functions are executed on the gRPC request object before the // request is decoded.
[ "ServerBefore", "functions", "are", "executed", "on", "the", "gRPC", "request", "object", "before", "the", "request", "is", "decoded", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L60-L62
126,670
go-kit/kit
transport/grpc/server.go
ServerAfter
func ServerAfter(after ...ServerResponseFunc) ServerOption { return func(s *Server) { s.after = append(s.after, after...) } }
go
func ServerAfter(after ...ServerResponseFunc) ServerOption { return func(s *Server) { s.after = append(s.after, after...) } }
[ "func", "ServerAfter", "(", "after", "...", "ServerResponseFunc", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "after", "=", "append", "(", "s", ".", "after", ",", "after", "...", ")", "}", "\n", "}" ]
// ServerAfter functions are executed on the gRPC response writer after the // endpoint is invoked, but before anything is written to the client.
[ "ServerAfter", "functions", "are", "executed", "on", "the", "gRPC", "response", "writer", "after", "the", "endpoint", "is", "invoked", "but", "before", "anything", "is", "written", "to", "the", "client", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L66-L68
126,671
go-kit/kit
transport/grpc/server.go
ServerErrorHandler
func ServerErrorHandler(errorHandler transport.ErrorHandler) ServerOption { return func(s *Server) { s.errorHandler = errorHandler } }
go
func ServerErrorHandler(errorHandler transport.ErrorHandler) ServerOption { return func(s *Server) { s.errorHandler = errorHandler } }
[ "func", "ServerErrorHandler", "(", "errorHandler", "transport", ".", "ErrorHandler", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "errorHandler", "=", "errorHandler", "}", "\n", "}" ]
// ServerErrorHandler is used to handle non-terminal errors. By default, non-terminal errors // are ignored.
[ "ServerErrorHandler", "is", "used", "to", "handle", "non", "-", "terminal", "errors", ".", "By", "default", "non", "-", "terminal", "errors", "are", "ignored", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L79-L81
126,672
go-kit/kit
transport/grpc/server.go
ServerFinalizer
func ServerFinalizer(f ...ServerFinalizerFunc) ServerOption { return func(s *Server) { s.finalizer = append(s.finalizer, f...) } }
go
func ServerFinalizer(f ...ServerFinalizerFunc) ServerOption { return func(s *Server) { s.finalizer = append(s.finalizer, f...) } }
[ "func", "ServerFinalizer", "(", "f", "...", "ServerFinalizerFunc", ")", "ServerOption", "{", "return", "func", "(", "s", "*", "Server", ")", "{", "s", ".", "finalizer", "=", "append", "(", "s", ".", "finalizer", ",", "f", "...", ")", "}", "\n", "}" ]
// ServerFinalizer is executed at the end of every gRPC request. // By default, no finalizer is registered.
[ "ServerFinalizer", "is", "executed", "at", "the", "end", "of", "every", "gRPC", "request", ".", "By", "default", "no", "finalizer", "is", "registered", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L85-L87
126,673
go-kit/kit
transport/grpc/server.go
ServeGRPC
func (s Server) ServeGRPC(ctx context.Context, req interface{}) (retctx context.Context, resp interface{}, err error) { // Retrieve gRPC metadata. md, ok := metadata.FromIncomingContext(ctx) if !ok { md = metadata.MD{} } if len(s.finalizer) > 0 { defer func() { for _, f := range s.finalizer { f(ctx, er...
go
func (s Server) ServeGRPC(ctx context.Context, req interface{}) (retctx context.Context, resp interface{}, err error) { // Retrieve gRPC metadata. md, ok := metadata.FromIncomingContext(ctx) if !ok { md = metadata.MD{} } if len(s.finalizer) > 0 { defer func() { for _, f := range s.finalizer { f(ctx, er...
[ "func", "(", "s", "Server", ")", "ServeGRPC", "(", "ctx", "context", ".", "Context", ",", "req", "interface", "{", "}", ")", "(", "retctx", "context", ".", "Context", ",", "resp", "interface", "{", "}", ",", "err", "error", ")", "{", "// Retrieve gRPC ...
// ServeGRPC implements the Handler interface.
[ "ServeGRPC", "implements", "the", "Handler", "interface", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/grpc/server.go#L90-L153
126,674
go-kit/kit
metrics/provider/prometheus.go
NewCounter
func (p *prometheusProvider) NewCounter(name string) metrics.Counter { return prometheus.NewCounterFrom(stdprometheus.CounterOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
go
func (p *prometheusProvider) NewCounter(name string) metrics.Counter { return prometheus.NewCounterFrom(stdprometheus.CounterOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
[ "func", "(", "p", "*", "prometheusProvider", ")", "NewCounter", "(", "name", "string", ")", "metrics", ".", "Counter", "{", "return", "prometheus", ".", "NewCounterFrom", "(", "stdprometheus", ".", "CounterOpts", "{", "Namespace", ":", "p", ".", "namespace", ...
// NewCounter implements Provider via prometheus.NewCounterFrom, i.e. the // counter is registered. The metric's namespace and subsystem are taken from // the Provider. Help is set to the name of the metric, and no const label names // are set.
[ "NewCounter", "implements", "Provider", "via", "prometheus", ".", "NewCounterFrom", "i", ".", "e", ".", "the", "counter", "is", "registered", ".", "The", "metric", "s", "namespace", "and", "subsystem", "are", "taken", "from", "the", "Provider", ".", "Help", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/prometheus.go#L28-L35
126,675
go-kit/kit
metrics/provider/prometheus.go
NewGauge
func (p *prometheusProvider) NewGauge(name string) metrics.Gauge { return prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
go
func (p *prometheusProvider) NewGauge(name string) metrics.Gauge { return prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
[ "func", "(", "p", "*", "prometheusProvider", ")", "NewGauge", "(", "name", "string", ")", "metrics", ".", "Gauge", "{", "return", "prometheus", ".", "NewGaugeFrom", "(", "stdprometheus", ".", "GaugeOpts", "{", "Namespace", ":", "p", ".", "namespace", ",", ...
// NewGauge implements Provider via prometheus.NewGaugeFrom, i.e. the gauge is // registered. The metric's namespace and subsystem are taken from the Provider. // Help is set to the name of the metric, and no const label names are set.
[ "NewGauge", "implements", "Provider", "via", "prometheus", ".", "NewGaugeFrom", "i", ".", "e", ".", "the", "gauge", "is", "registered", ".", "The", "metric", "s", "namespace", "and", "subsystem", "are", "taken", "from", "the", "Provider", ".", "Help", "is", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/prometheus.go#L40-L47
126,676
go-kit/kit
metrics/provider/prometheus.go
NewHistogram
func (p *prometheusProvider) NewHistogram(name string, _ int) metrics.Histogram { return prometheus.NewSummaryFrom(stdprometheus.SummaryOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
go
func (p *prometheusProvider) NewHistogram(name string, _ int) metrics.Histogram { return prometheus.NewSummaryFrom(stdprometheus.SummaryOpts{ Namespace: p.namespace, Subsystem: p.subsystem, Name: name, Help: name, }, []string{}) }
[ "func", "(", "p", "*", "prometheusProvider", ")", "NewHistogram", "(", "name", "string", ",", "_", "int", ")", "metrics", ".", "Histogram", "{", "return", "prometheus", ".", "NewSummaryFrom", "(", "stdprometheus", ".", "SummaryOpts", "{", "Namespace", ":", "...
// NewGauge implements Provider via prometheus.NewSummaryFrom, i.e. the summary // is registered. The metric's namespace and subsystem are taken from the // Provider. Help is set to the name of the metric, and no const label names are // set. Buckets are ignored.
[ "NewGauge", "implements", "Provider", "via", "prometheus", ".", "NewSummaryFrom", "i", ".", "e", ".", "the", "summary", "is", "registered", ".", "The", "metric", "s", "namespace", "and", "subsystem", "are", "taken", "from", "the", "Provider", ".", "Help", "i...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/prometheus.go#L53-L60
126,677
go-kit/kit
examples/addsvc/pkg/addendpoint/middleware.go
LoggingMiddleware
func LoggingMiddleware(logger log.Logger) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { defer func(begin time.Time) { logger.Log("transport_error", err, "took", time.Since(begin)) }(ti...
go
func LoggingMiddleware(logger log.Logger) endpoint.Middleware { return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (response interface{}, err error) { defer func(begin time.Time) { logger.Log("transport_error", err, "took", time.Since(begin)) }(ti...
[ "func", "LoggingMiddleware", "(", "logger", "log", ".", "Logger", ")", "endpoint", ".", "Middleware", "{", "return", "func", "(", "next", "endpoint", ".", "Endpoint", ")", "endpoint", ".", "Endpoint", "{", "return", "func", "(", "ctx", "context", ".", "Con...
// LoggingMiddleware returns an endpoint middleware that logs the // duration of each invocation, and the resulting error, if any.
[ "LoggingMiddleware", "returns", "an", "endpoint", "middleware", "that", "logs", "the", "duration", "of", "each", "invocation", "and", "the", "resulting", "error", "if", "any", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/addsvc/pkg/addendpoint/middleware.go#L32-L43
126,678
go-kit/kit
metrics/pcp/pcp.go
NewReporter
func NewReporter(appname string) (*Reporter, error) { c, err := speed.NewPCPClient(appname) if err != nil { return nil, err } return &Reporter{c}, nil }
go
func NewReporter(appname string) (*Reporter, error) { c, err := speed.NewPCPClient(appname) if err != nil { return nil, err } return &Reporter{c}, nil }
[ "func", "NewReporter", "(", "appname", "string", ")", "(", "*", "Reporter", ",", "error", ")", "{", "c", ",", "err", ":=", "speed", ".", "NewPCPClient", "(", "appname", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}...
// NewReporter creates a new Reporter instance. The first parameter is the // application name and is used to create the speed client. Hence it should be a // valid speed parameter name and should not contain spaces or the path // separator for your operating system.
[ "NewReporter", "creates", "a", "new", "Reporter", "instance", ".", "The", "first", "parameter", "is", "the", "application", "name", "and", "is", "used", "to", "create", "the", "speed", "client", ".", "Hence", "it", "should", "be", "a", "valid", "speed", "p...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/pcp/pcp.go#L18-L25
126,679
go-kit/kit
metrics/pcp/pcp.go
NewCounter
func (r *Reporter) NewCounter(name string, desc ...string) (*Counter, error) { c, err := speed.NewPCPCounter(0, name, desc...) if err != nil { return nil, err } r.c.MustRegister(c) return &Counter{c}, nil }
go
func (r *Reporter) NewCounter(name string, desc ...string) (*Counter, error) { c, err := speed.NewPCPCounter(0, name, desc...) if err != nil { return nil, err } r.c.MustRegister(c) return &Counter{c}, nil }
[ "func", "(", "r", "*", "Reporter", ")", "NewCounter", "(", "name", "string", ",", "desc", "...", "string", ")", "(", "*", "Counter", ",", "error", ")", "{", "c", ",", "err", ":=", "speed", ".", "NewPCPCounter", "(", "0", ",", "name", ",", "desc", ...
// NewCounter creates a new Counter. This requires a name parameter and can // optionally take a couple of description strings, that are used to create the // underlying speed.Counter and are reported by PCP.
[ "NewCounter", "creates", "a", "new", "Counter", ".", "This", "requires", "a", "name", "parameter", "and", "can", "optionally", "take", "a", "couple", "of", "description", "strings", "that", "are", "used", "to", "create", "the", "underlying", "speed", ".", "C...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/pcp/pcp.go#L43-L51
126,680
go-kit/kit
metrics/pcp/pcp.go
NewGauge
func (r *Reporter) NewGauge(name string, desc ...string) (*Gauge, error) { g, err := speed.NewPCPGauge(0, name, desc...) if err != nil { return nil, err } r.c.MustRegister(g) return &Gauge{g}, nil }
go
func (r *Reporter) NewGauge(name string, desc ...string) (*Gauge, error) { g, err := speed.NewPCPGauge(0, name, desc...) if err != nil { return nil, err } r.c.MustRegister(g) return &Gauge{g}, nil }
[ "func", "(", "r", "*", "Reporter", ")", "NewGauge", "(", "name", "string", ",", "desc", "...", "string", ")", "(", "*", "Gauge", ",", "error", ")", "{", "g", ",", "err", ":=", "speed", ".", "NewPCPGauge", "(", "0", ",", "name", ",", "desc", "..."...
// NewGauge creates a new Gauge. This requires a name parameter and can // optionally take a couple of description strings, that are used to create the // underlying speed.Gauge and are reported by PCP.
[ "NewGauge", "creates", "a", "new", "Gauge", ".", "This", "requires", "a", "name", "parameter", "and", "can", "optionally", "take", "a", "couple", "of", "description", "strings", "that", "are", "used", "to", "create", "the", "underlying", "speed", ".", "Gauge...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/pcp/pcp.go#L68-L76
126,681
go-kit/kit
sd/zk/instancer.go
NewInstancer
func NewInstancer(c Client, path string, logger log.Logger) (*Instancer, error) { s := &Instancer{ cache: instance.NewCache(), client: c, path: path, logger: logger, quitc: make(chan struct{}), } err := s.client.CreateParentNodes(s.path) if err != nil { return nil, err } instances, eventc, err :...
go
func NewInstancer(c Client, path string, logger log.Logger) (*Instancer, error) { s := &Instancer{ cache: instance.NewCache(), client: c, path: path, logger: logger, quitc: make(chan struct{}), } err := s.client.CreateParentNodes(s.path) if err != nil { return nil, err } instances, eventc, err :...
[ "func", "NewInstancer", "(", "c", "Client", ",", "path", "string", ",", "logger", "log", ".", "Logger", ")", "(", "*", "Instancer", ",", "error", ")", "{", "s", ":=", "&", "Instancer", "{", "cache", ":", "instance", ".", "NewCache", "(", ")", ",", ...
// NewInstancer returns a ZooKeeper Instancer. ZooKeeper will start watching // the given path for changes and update the Instancer endpoints.
[ "NewInstancer", "returns", "a", "ZooKeeper", "Instancer", ".", "ZooKeeper", "will", "start", "watching", "the", "given", "path", "for", "changes", "and", "update", "the", "Instancer", "endpoints", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/sd/zk/instancer.go#L23-L49
126,682
go-kit/kit
tracing/opencensus/endpoint.go
TraceEndpoint
func TraceEndpoint(name string, options ...EndpointOption) endpoint.Middleware { if name == "" { name = TraceEndpointDefaultName } cfg := &EndpointOptions{} for _, o := range options { o(cfg) } return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (...
go
func TraceEndpoint(name string, options ...EndpointOption) endpoint.Middleware { if name == "" { name = TraceEndpointDefaultName } cfg := &EndpointOptions{} for _, o := range options { o(cfg) } return func(next endpoint.Endpoint) endpoint.Endpoint { return func(ctx context.Context, request interface{}) (...
[ "func", "TraceEndpoint", "(", "name", "string", ",", "options", "...", "EndpointOption", ")", "endpoint", ".", "Middleware", "{", "if", "name", "==", "\"", "\"", "{", "name", "=", "TraceEndpointDefaultName", "\n", "}", "\n\n", "cfg", ":=", "&", "EndpointOpti...
// TraceEndpoint returns an Endpoint middleware, tracing a Go kit endpoint. // This endpoint tracer should be used in combination with a Go kit Transport // tracing middleware, generic OpenCensus transport middleware or custom before // and after transport functions as service propagation of SpanContext is not // provi...
[ "TraceEndpoint", "returns", "an", "Endpoint", "middleware", "tracing", "a", "Go", "kit", "endpoint", ".", "This", "endpoint", "tracer", "should", "be", "used", "in", "combination", "with", "a", "Go", "kit", "Transport", "tracing", "middleware", "generic", "OpenC...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/tracing/opencensus/endpoint.go#L21-L89
126,683
go-kit/kit
metrics/influx/influx.go
New
func New(tags map[string]string, conf influxdb.BatchPointsConfig, logger log.Logger) *Influx { return &Influx{ counters: lv.NewSpace(), gauges: lv.NewSpace(), histograms: lv.NewSpace(), tags: tags, conf: conf, logger: logger, } }
go
func New(tags map[string]string, conf influxdb.BatchPointsConfig, logger log.Logger) *Influx { return &Influx{ counters: lv.NewSpace(), gauges: lv.NewSpace(), histograms: lv.NewSpace(), tags: tags, conf: conf, logger: logger, } }
[ "func", "New", "(", "tags", "map", "[", "string", "]", "string", ",", "conf", "influxdb", ".", "BatchPointsConfig", ",", "logger", "log", ".", "Logger", ")", "*", "Influx", "{", "return", "&", "Influx", "{", "counters", ":", "lv", ".", "NewSpace", "(",...
// New returns an Influx, ready to create metrics and collect observations. Tags // are applied to all metrics created from this object. The BatchPointsConfig is // used during flushing.
[ "New", "returns", "an", "Influx", "ready", "to", "create", "metrics", "and", "collect", "observations", ".", "Tags", "are", "applied", "to", "all", "metrics", "created", "from", "this", "object", ".", "The", "BatchPointsConfig", "is", "used", "during", "flushi...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L46-L55
126,684
go-kit/kit
metrics/influx/influx.go
NewCounter
func (in *Influx) NewCounter(name string) *Counter { return &Counter{ name: name, obs: in.counters.Observe, } }
go
func (in *Influx) NewCounter(name string) *Counter { return &Counter{ name: name, obs: in.counters.Observe, } }
[ "func", "(", "in", "*", "Influx", ")", "NewCounter", "(", "name", "string", ")", "*", "Counter", "{", "return", "&", "Counter", "{", "name", ":", "name", ",", "obs", ":", "in", ".", "counters", ".", "Observe", ",", "}", "\n", "}" ]
// NewCounter returns an Influx counter.
[ "NewCounter", "returns", "an", "Influx", "counter", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L58-L63
126,685
go-kit/kit
metrics/influx/influx.go
NewGauge
func (in *Influx) NewGauge(name string) *Gauge { return &Gauge{ name: name, obs: in.gauges.Observe, add: in.gauges.Add, } }
go
func (in *Influx) NewGauge(name string) *Gauge { return &Gauge{ name: name, obs: in.gauges.Observe, add: in.gauges.Add, } }
[ "func", "(", "in", "*", "Influx", ")", "NewGauge", "(", "name", "string", ")", "*", "Gauge", "{", "return", "&", "Gauge", "{", "name", ":", "name", ",", "obs", ":", "in", ".", "gauges", ".", "Observe", ",", "add", ":", "in", ".", "gauges", ".", ...
// NewGauge returns an Influx gauge.
[ "NewGauge", "returns", "an", "Influx", "gauge", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L66-L72
126,686
go-kit/kit
metrics/influx/influx.go
NewHistogram
func (in *Influx) NewHistogram(name string) *Histogram { return &Histogram{ name: name, obs: in.histograms.Observe, } }
go
func (in *Influx) NewHistogram(name string) *Histogram { return &Histogram{ name: name, obs: in.histograms.Observe, } }
[ "func", "(", "in", "*", "Influx", ")", "NewHistogram", "(", "name", "string", ")", "*", "Histogram", "{", "return", "&", "Histogram", "{", "name", ":", "name", ",", "obs", ":", "in", ".", "histograms", ".", "Observe", ",", "}", "\n", "}" ]
// NewHistogram returns an Influx histogram.
[ "NewHistogram", "returns", "an", "Influx", "histogram", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L75-L80
126,687
go-kit/kit
metrics/influx/influx.go
WriteLoop
func (in *Influx) WriteLoop(ctx context.Context, c <-chan time.Time, w BatchPointsWriter) { for { select { case <-c: if err := in.WriteTo(w); err != nil { in.logger.Log("during", "WriteTo", "err", err) } case <-ctx.Done(): return } } }
go
func (in *Influx) WriteLoop(ctx context.Context, c <-chan time.Time, w BatchPointsWriter) { for { select { case <-c: if err := in.WriteTo(w); err != nil { in.logger.Log("during", "WriteTo", "err", err) } case <-ctx.Done(): return } } }
[ "func", "(", "in", "*", "Influx", ")", "WriteLoop", "(", "ctx", "context", ".", "Context", ",", "c", "<-", "chan", "time", ".", "Time", ",", "w", "BatchPointsWriter", ")", "{", "for", "{", "select", "{", "case", "<-", "c", ":", "if", "err", ":=", ...
// WriteLoop is a helper method that invokes WriteTo to the passed writer every // time the passed channel fires. This method blocks until the channel is // closed, so clients probably want to run it in its own goroutine. For typical // usage, create a time.Ticker and pass its C channel to this method.
[ "WriteLoop", "is", "a", "helper", "method", "that", "invokes", "WriteTo", "to", "the", "passed", "writer", "every", "time", "the", "passed", "channel", "fires", ".", "This", "method", "blocks", "until", "the", "channel", "is", "closed", "so", "clients", "pro...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L92-L103
126,688
go-kit/kit
metrics/influx/influx.go
WriteTo
func (in *Influx) WriteTo(w BatchPointsWriter) (err error) { bp, err := influxdb.NewBatchPoints(in.conf) if err != nil { return err } now := time.Now() in.counters.Reset().Walk(func(name string, lvs lv.LabelValues, values []float64) bool { tags := mergeTags(in.tags, lvs) var p *influxdb.Point fields := m...
go
func (in *Influx) WriteTo(w BatchPointsWriter) (err error) { bp, err := influxdb.NewBatchPoints(in.conf) if err != nil { return err } now := time.Now() in.counters.Reset().Walk(func(name string, lvs lv.LabelValues, values []float64) bool { tags := mergeTags(in.tags, lvs) var p *influxdb.Point fields := m...
[ "func", "(", "in", "*", "Influx", ")", "WriteTo", "(", "w", "BatchPointsWriter", ")", "(", "err", "error", ")", "{", "bp", ",", "err", ":=", "influxdb", ".", "NewBatchPoints", "(", "in", ".", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// WriteTo flushes the buffered content of the metrics to the writer, in an // Influx BatchPoints format. WriteTo abides best-effort semantics, so // observations are lost if there is a problem with the write. Clients should be // sure to call WriteTo regularly, ideally through the WriteLoop helper method.
[ "WriteTo", "flushes", "the", "buffered", "content", "of", "the", "metrics", "to", "the", "writer", "in", "an", "Influx", "BatchPoints", "format", ".", "WriteTo", "abides", "best", "-", "effort", "semantics", "so", "observations", "are", "lost", "if", "there", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L109-L172
126,689
go-kit/kit
metrics/influx/influx.go
With
func (c *Counter) With(labelValues ...string) metrics.Counter { return &Counter{ name: c.name, lvs: c.lvs.With(labelValues...), obs: c.obs, } }
go
func (c *Counter) With(labelValues ...string) metrics.Counter { return &Counter{ name: c.name, lvs: c.lvs.With(labelValues...), obs: c.obs, } }
[ "func", "(", "c", "*", "Counter", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Counter", "{", "return", "&", "Counter", "{", "name", ":", "c", ".", "name", ",", "lvs", ":", "c", ".", "lvs", ".", "With", "(", "labelValues"...
// With implements metrics.Counter.
[ "With", "implements", "metrics", ".", "Counter", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L211-L217
126,690
go-kit/kit
metrics/influx/influx.go
With
func (h *Histogram) With(labelValues ...string) metrics.Histogram { return &Histogram{ name: h.name, lvs: h.lvs.With(labelValues...), obs: h.obs, } }
go
func (h *Histogram) With(labelValues ...string) metrics.Histogram { return &Histogram{ name: h.name, lvs: h.lvs.With(labelValues...), obs: h.obs, } }
[ "func", "(", "h", "*", "Histogram", ")", "With", "(", "labelValues", "...", "string", ")", "metrics", ".", "Histogram", "{", "return", "&", "Histogram", "{", "name", ":", "h", ".", "name", ",", "lvs", ":", "h", ".", "lvs", ".", "With", "(", "labelV...
// With implements metrics.Histogram.
[ "With", "implements", "metrics", ".", "Histogram", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L262-L268
126,691
go-kit/kit
metrics/influx/influx.go
Observe
func (h *Histogram) Observe(value float64) { h.obs(h.name, h.lvs, value) }
go
func (h *Histogram) Observe(value float64) { h.obs(h.name, h.lvs, value) }
[ "func", "(", "h", "*", "Histogram", ")", "Observe", "(", "value", "float64", ")", "{", "h", ".", "obs", "(", "h", ".", "name", ",", "h", ".", "lvs", ",", "value", ")", "\n", "}" ]
// Observe implements metrics.Histogram.
[ "Observe", "implements", "metrics", ".", "Histogram", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/influx/influx.go#L271-L273
126,692
go-kit/kit
metrics/provider/influx.go
NewInfluxProvider
func NewInfluxProvider(in *influx.Influx, stop func()) Provider { return &influxProvider{ in: in, stop: stop, } }
go
func NewInfluxProvider(in *influx.Influx, stop func()) Provider { return &influxProvider{ in: in, stop: stop, } }
[ "func", "NewInfluxProvider", "(", "in", "*", "influx", ".", "Influx", ",", "stop", "func", "(", ")", ")", "Provider", "{", "return", "&", "influxProvider", "{", "in", ":", "in", ",", "stop", ":", "stop", ",", "}", "\n", "}" ]
// NewInfluxProvider takes the given Influx object and stop func, and returns // a Provider that produces Influx metrics.
[ "NewInfluxProvider", "takes", "the", "given", "Influx", "object", "and", "stop", "func", "and", "returns", "a", "Provider", "that", "produces", "Influx", "metrics", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/influx.go#L15-L20
126,693
go-kit/kit
metrics/provider/influx.go
NewCounter
func (p *influxProvider) NewCounter(name string) metrics.Counter { return p.in.NewCounter(name) }
go
func (p *influxProvider) NewCounter(name string) metrics.Counter { return p.in.NewCounter(name) }
[ "func", "(", "p", "*", "influxProvider", ")", "NewCounter", "(", "name", "string", ")", "metrics", ".", "Counter", "{", "return", "p", ".", "in", ".", "NewCounter", "(", "name", ")", "\n", "}" ]
// NewCounter implements Provider. Per-metric tags are not supported.
[ "NewCounter", "implements", "Provider", ".", "Per", "-", "metric", "tags", "are", "not", "supported", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/influx.go#L23-L25
126,694
go-kit/kit
metrics/provider/influx.go
NewGauge
func (p *influxProvider) NewGauge(name string) metrics.Gauge { return p.in.NewGauge(name) }
go
func (p *influxProvider) NewGauge(name string) metrics.Gauge { return p.in.NewGauge(name) }
[ "func", "(", "p", "*", "influxProvider", ")", "NewGauge", "(", "name", "string", ")", "metrics", ".", "Gauge", "{", "return", "p", ".", "in", ".", "NewGauge", "(", "name", ")", "\n", "}" ]
// NewGauge implements Provider. Per-metric tags are not supported.
[ "NewGauge", "implements", "Provider", ".", "Per", "-", "metric", "tags", "are", "not", "supported", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/influx.go#L28-L30
126,695
go-kit/kit
metrics/provider/influx.go
NewHistogram
func (p *influxProvider) NewHistogram(name string, buckets int) metrics.Histogram { return p.in.NewHistogram(name) }
go
func (p *influxProvider) NewHistogram(name string, buckets int) metrics.Histogram { return p.in.NewHistogram(name) }
[ "func", "(", "p", "*", "influxProvider", ")", "NewHistogram", "(", "name", "string", ",", "buckets", "int", ")", "metrics", ".", "Histogram", "{", "return", "p", ".", "in", ".", "NewHistogram", "(", "name", ")", "\n", "}" ]
// NewHistogram implements Provider. Per-metric tags are not supported.
[ "NewHistogram", "implements", "Provider", ".", "Per", "-", "metric", "tags", "are", "not", "supported", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/metrics/provider/influx.go#L33-L35
126,696
go-kit/kit
transport/http/server.go
EncodeJSONResponse
func EncodeJSONResponse(_ context.Context, w http.ResponseWriter, response interface{}) error { w.Header().Set("Content-Type", "application/json; charset=utf-8") if headerer, ok := response.(Headerer); ok { for k, values := range headerer.Headers() { for _, v := range values { w.Header().Add(k, v) } } ...
go
func EncodeJSONResponse(_ context.Context, w http.ResponseWriter, response interface{}) error { w.Header().Set("Content-Type", "application/json; charset=utf-8") if headerer, ok := response.(Headerer); ok { for k, values := range headerer.Headers() { for _, v := range values { w.Header().Add(k, v) } } ...
[ "func", "EncodeJSONResponse", "(", "_", "context", ".", "Context", ",", "w", "http", ".", "ResponseWriter", ",", "response", "interface", "{", "}", ")", "error", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", ...
// EncodeJSONResponse is a EncodeResponseFunc that serializes the response as a // JSON object to the ResponseWriter. Many JSON-over-HTTP services can use it as // a sensible default. If the response implements Headerer, the provided headers // will be applied to the response. If the response implements StatusCoder, th...
[ "EncodeJSONResponse", "is", "a", "EncodeResponseFunc", "that", "serializes", "the", "response", "as", "a", "JSON", "object", "to", "the", "ResponseWriter", ".", "Many", "JSON", "-", "over", "-", "HTTP", "services", "can", "use", "it", "as", "a", "sensible", ...
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/server.go#L163-L181
126,697
go-kit/kit
transport/http/server.go
WriteHeader
func (w *interceptingWriter) WriteHeader(code int) { w.code = code w.ResponseWriter.WriteHeader(code) }
go
func (w *interceptingWriter) WriteHeader(code int) { w.code = code w.ResponseWriter.WriteHeader(code) }
[ "func", "(", "w", "*", "interceptingWriter", ")", "WriteHeader", "(", "code", "int", ")", "{", "w", ".", "code", "=", "code", "\n", "w", ".", "ResponseWriter", ".", "WriteHeader", "(", "code", ")", "\n", "}" ]
// WriteHeader may not be explicitly called, so care must be taken to // initialize w.code to its default value of http.StatusOK.
[ "WriteHeader", "may", "not", "be", "explicitly", "called", "so", "care", "must", "be", "taken", "to", "initialize", "w", ".", "code", "to", "its", "default", "value", "of", "http", ".", "StatusOK", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/transport/http/server.go#L235-L238
126,698
go-kit/kit
examples/shipping/cargo/cargo.go
SpecifyNewRoute
func (c *Cargo) SpecifyNewRoute(rs RouteSpecification) { c.RouteSpecification = rs c.Delivery = c.Delivery.UpdateOnRouting(c.RouteSpecification, c.Itinerary) }
go
func (c *Cargo) SpecifyNewRoute(rs RouteSpecification) { c.RouteSpecification = rs c.Delivery = c.Delivery.UpdateOnRouting(c.RouteSpecification, c.Itinerary) }
[ "func", "(", "c", "*", "Cargo", ")", "SpecifyNewRoute", "(", "rs", "RouteSpecification", ")", "{", "c", ".", "RouteSpecification", "=", "rs", "\n", "c", ".", "Delivery", "=", "c", ".", "Delivery", ".", "UpdateOnRouting", "(", "c", ".", "RouteSpecification"...
// SpecifyNewRoute specifies a new route for this cargo.
[ "SpecifyNewRoute", "specifies", "a", "new", "route", "for", "this", "cargo", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/cargo.go#L27-L30
126,699
go-kit/kit
examples/shipping/cargo/cargo.go
AssignToRoute
func (c *Cargo) AssignToRoute(itinerary Itinerary) { c.Itinerary = itinerary c.Delivery = c.Delivery.UpdateOnRouting(c.RouteSpecification, c.Itinerary) }
go
func (c *Cargo) AssignToRoute(itinerary Itinerary) { c.Itinerary = itinerary c.Delivery = c.Delivery.UpdateOnRouting(c.RouteSpecification, c.Itinerary) }
[ "func", "(", "c", "*", "Cargo", ")", "AssignToRoute", "(", "itinerary", "Itinerary", ")", "{", "c", ".", "Itinerary", "=", "itinerary", "\n", "c", ".", "Delivery", "=", "c", ".", "Delivery", ".", "UpdateOnRouting", "(", "c", ".", "RouteSpecification", ",...
// AssignToRoute attaches a new itinerary to this cargo.
[ "AssignToRoute", "attaches", "a", "new", "itinerary", "to", "this", "cargo", "." ]
da68e7640663097af890b9bdd76da9cb816ebb82
https://github.com/go-kit/kit/blob/da68e7640663097af890b9bdd76da9cb816ebb82/examples/shipping/cargo/cargo.go#L33-L36