You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: errors.go
    path of file: ./repos/chai
    
    the code of the file until where you have to start completion: package chai

import (
	"github.com/chaisql/chai/internal/database"
	errs "github.com/chaisql/chai
    
func IsAlreadyExistsError(err error) bool {
	if errs.IsAlreadyExistsError(err) {
		return true
	}

	for err != nil {
		if cerr, ok := err.(*database.ConstraintViolationError); ok {
			switch cerr.Constraint {
			case "UNIQUE", "PRIMARY KEY":
				return true
			default:
				return false
			}
		}

		err = errors.Unwrap(err)
	}

	return false
}