Beispiel #1
0
func PrimaryKey(exec gomodel.Executor) string {
	return exec.Driver().PrimaryKey()
}
Beispiel #2
0
func QueryOneResultById(exec gomodel.Executor, sqlid uint64, ptr interface{}, args ...interface{}) error {
	sc := exec.QueryById(sqlid, args...)
	defer sc.Close()
	return sc.One(ptr)
}
Beispiel #3
0
func DuplicatePrimaryKeyError(exec gomodel.Executor, err error, newErr error) error {
	pk := exec.Driver().PrimaryKey()
	return parseKeyError(err, pk, newErr, exec.Driver().DuplicateKey)
}
Beispiel #4
0
func ForeignKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyError(err, key, newErr, fk)
}
Beispiel #5
0
func ForeignKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyFunc(err, keyfunc, fk)
}
Beispiel #6
0
func DuplicateKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyError(err, key, newErr, dk)
}
Beispiel #7
0
func DuplicateKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyFunc(err, keyfunc, dk)
}