msg database

This commit is contained in:
withchao
2023-02-23 18:17:17 +08:00
parent 2359d7ab37
commit 2af2716c2c
17 changed files with 588 additions and 241 deletions
+21
View File
@@ -21,6 +21,27 @@ func CopyStructFields(a interface{}, b interface{}, fields ...string) (err error
return copier.Copy(a, b)
}
func Wrap1(err error) error {
if err != nil {
return Wrap(err, "")
}
return nil
}
func Wrap2[T any](a T, err error) (T, error) {
if err != nil {
return a, Wrap(err, "")
}
return a, nil
}
func Wrap3[T any, V any](a T, b V, err error) (T, V, error) {
if err != nil {
return a, b, Wrap(err, "")
}
return a, b, nil
}
func Wrap(err error, message string) error {
return errors.Wrap(err, "==> "+printCallerNameAndLine()+message)
}