mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 16:15:56 +00:00
44 lines
995 B
Go
44 lines
995 B
Go
package schemar
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/dax"
|
|
"github.com/featurebasedb/featurebase/v3/errors"
|
|
)
|
|
|
|
const (
|
|
ErrCodeTableIDInvalid errors.Code = "TableIDInvalid"
|
|
ErrCodeTableNameInvalid errors.Code = "TableNameInvalid"
|
|
ErrCodeInvalidPrimaryKey errors.Code = "InvalidPrimaryKey"
|
|
|
|
ErrCodeFieldNameInvalid errors.Code = "FieldNameInvalid"
|
|
)
|
|
|
|
func NewErrTableIDInvalid(tableID dax.TableID) error {
|
|
return errors.New(
|
|
ErrCodeTableIDInvalid,
|
|
fmt.Sprintf("table ID '%s' is invalid", tableID),
|
|
)
|
|
}
|
|
|
|
func NewErrTableNameInvalid(tableName dax.TableName) error {
|
|
return errors.New(
|
|
ErrCodeTableNameInvalid,
|
|
fmt.Sprintf("table name '%s' is invalid", tableName),
|
|
)
|
|
}
|
|
|
|
func NewErrInvalidPrimaryKey() error {
|
|
return errors.New(
|
|
ErrCodeInvalidPrimaryKey,
|
|
"invalid primary key",
|
|
)
|
|
}
|
|
|
|
func NewErrFieldNameInvalid(fieldName dax.FieldName) error {
|
|
return errors.New(
|
|
ErrCodeFieldNameInvalid,
|
|
fmt.Sprintf("field name '%s' is invalid", fieldName),
|
|
)
|
|
}
|