models/login_source: code improvement
This commit is contained in:
parent
99c2ae7b35
commit
152e715999
6 changed files with 131 additions and 134 deletions
|
@ -635,6 +635,19 @@ func (err ErrLoginSourceAlreadyExist) Error() string {
|
|||
return fmt.Sprintf("login source already exists [name: %s]", err.Name)
|
||||
}
|
||||
|
||||
type ErrLoginSourceInUse struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func IsErrLoginSourceInUse(err error) bool {
|
||||
_, ok := err.(ErrLoginSourceInUse)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrLoginSourceInUse) Error() string {
|
||||
return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
|
||||
}
|
||||
|
||||
// ___________
|
||||
// \__ ___/___ _____ _____
|
||||
// | |_/ __ \\__ \ / \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue