mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
small fixses
This commit is contained in:
@@ -18,6 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Returns first non empty string out of vals. Useful to extract defaults
|
||||
func FirstNonEmpty(vals ...string) string {
|
||||
for _, val := range vals {
|
||||
@@ -27,3 +32,9 @@ func FirstNonEmpty(vals ...string) string {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func FSCgrId(uuid string) string {
|
||||
hasher := sha1.New()
|
||||
hasher.Write([]byte(uuid))
|
||||
return fmt.Sprintf("%x", hasher.Sum(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user