logo

abstract const class

haven::ColDef

sys::Obj
  haven::ColDef

ColDef defines the mapping of a field in a Type to a column in a relational table.

Slots

allowNull

Bool allowNull()

Does this column allow null values to be persisted?

columnName

virtual Str columnName()

Get the database column name.

definition

virtual Str definition()

Get the definition of the column as it appears in a CREATE TABLE statement.

field

Field field()

fieldName

const Str fieldName

The field that this column represents. This field may be lazily loaded from the field qname if this column definition has been serialized.

fieldToSql

Str fieldToSql(Obj o)

Convert the field value of this column for the specified object to SQL text.

haven

const HavenService haven

The haven used by this column.

index

IndexDef index()

Get the index definition for this column. If the column is not indexed, null is returned.

isAuto

Bool isAuto()

Is this column value auto-generated?

isIndexed

Bool isIndexed()

Is this column indexed?

isKey

Bool isKey()

Is this column part of the primary key?

isRef

Bool isRef()

Is this column a foreign key to another table?

isUnique

Bool isUnique()

Is each value in this column unique?

make

new make()

Protected no argument constructor for subclasses.

makeForField

new makeForField(HavenService haven, Field field)

Make a new instance for the specified field.

name

Str name()

Get the column name.

paramValue

virtual Obj paramValue(Obj o, Str:Obj params := null)

Add a translated parameter or parameters to the specified map for use in a prepared statement.

rowValue

abstract Obj rowValue(Row row, Col col)

Get a value for this column type from the specified row. This is used by ref columns to read their database values.

setFieldFromRow

abstract Void setFieldFromRow(Obj obj, Row row, HavenNamespace ns)

Set the field for this column on the specified object by mapping the field value from the specified row.

sqlType

abstract Str sqlType()

Get the SQL type definition for this translator

toSql

abstract Str toSql(Obj o)

Convert an object to its equivalent SQL syntax.

validate

virtual Void validate(Obj defaultRow)

Validate the field for this column from the default row.