/
left76
/
cli
Обзор
Документация
Войти
/
left76
/
cli
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
vendor/github.com/docker/distribution/context/util.go
24 строки
689 B
Daniel Nephin
Add vendor
18 апр 2017, 01:12
18 апр 2017, 01:12
6686ada
Код
Авторство
О чём код?
package context import ( "time" ) // Since looks up key, which should be a time.Time, and returns the duration // since that time. If the key is not found, the value returned will be zero. // This is helpful when inferring metrics related to context execution times. func Since(ctx Context, key interface{}) time.Duration { if startedAt, ok := ctx.Value(key).(time.Time); ok { return time.Since(startedAt) } return 0 } // GetStringValue returns a string value from the context. The empty string // will be returned if not found. func GetStringValue(ctx Context, key interface{}) (value string) { if valuev, ok := ctx.Value(key).(string); ok { value = valuev } return value }