refactor(db): add Users.Update (#7263)

This commit is contained in:
Joe Chen
2022-11-27 15:19:44 +08:00
committed by GitHub
parent a7dbc970df
commit 13099a7e4f
16 changed files with 423 additions and 109 deletions

View File

@@ -54,3 +54,12 @@ func Ellipsis(str string, threshold int) string {
}
return str[:threshold] + "..."
}
// Truncate returns a truncated string if its length is over the limit.
// Otherwise, it returns the original string.
func Truncate(str string, limit int) string {
if len(str) < limit {
return str
}
return str[:limit]
}