diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-04-11 20:18:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 20:18:05 +0800 |
commit | 41f56ad05d12520bb90f91889fa979465d0b3d6b (patch) | |
tree | 1ec7bc62a427ec2da011e882c61f2bfe04adef37 /internal/db/error.go | |
parent | 76bb647d2437dbdea86ac1a0caf5d768ab924e18 (diff) |
login_source: migrate to GORM and add tests (#6090)
* Use GORM in all write paths
* Migrate to GORM
* Fix lint errors
* Use GORM to init table
* dbutil: make writer detect error
* Add more tests
* Rename to clearTables
* db: finish adding tests
* osutil: add tests
* Fix load source files path
Diffstat (limited to 'internal/db/error.go')
-rw-r--r-- | internal/db/error.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/internal/db/error.go b/internal/db/error.go index ed173d86..46e7dde5 100644 --- a/internal/db/error.go +++ b/internal/db/error.go @@ -327,39 +327,6 @@ func (err ErrRepoFileAlreadyExist) Error() string { return fmt.Sprintf("repository file already exists [file_name: %s]", err.FileName) } -// .____ .__ _________ -// | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____ -// | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \ -// | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/ -// |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ > -// \/ /_____/ \/ \/ \/ \/ - -type ErrLoginSourceAlreadyExist struct { - Name string -} - -func IsErrLoginSourceAlreadyExist(err error) bool { - _, ok := err.(ErrLoginSourceAlreadyExist) - return ok -} - -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) -} - // ___________ // \__ ___/___ _____ _____ // | |_/ __ \\__ \ / \ |