/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
util/gutil/gutil_default.go
27 строк
912 B
John Guo
feature/v2.2.0 (#2154)
26 сен 2022, 17:11
Не верифицирован
26 сен 2022, 17:11
141ca62
Код
Авторство
О чём код?
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. package gutil // GetOrDefaultStr checks and returns value according whether parameter `param` available. // It returns `param[0]` if it is available, or else it returns `def`. func GetOrDefaultStr(def string, param ...string) string { value := def if len(param) > 0 && param[0] != "" { value = param[0] } return value } // GetOrDefaultAny checks and returns value according whether parameter `param` available. // It returns `param[0]` if it is available, or else it returns `def`. func GetOrDefaultAny(def interface{}, param ...interface{}) interface{} { value := def if len(param) > 0 && param[0] != "" { value = param[0] } return value }