-
Notifications
You must be signed in to change notification settings - Fork 14
DatabaseField
Represents a column & value pair in a database row.
public struct DatabaseField: Equatable
If there were a table with columns "id", "email", "phone" and a
row with values 1 ,"josh@alchemy.dev", "(555) 555-5555",
DatabaseField(column: id, .int(1))
would represent a
field on that table.
Equatable
The name of the column this value came from.
let column: String
The value of this field.
let value: DatabaseValue
Unwrap and return an Int
value from this DatabaseField
.
This throws if the underlying value
isn't an .int
or
the .int
has a nil
associated value.
public func int() throws -> Int
A DatabaseError
if this field's value
isn't a DatabaseValue.int
or its contents is nil.
The unwrapped Int
of this field's value, if it was indeed a non-null .int
.
Unwrap and return a String
value from this DatabaseField
.
This throws if the underlying value
isn't a .string
or
the .string
has a nil associated value.
public func string() throws -> String
A DatabaseError
if this field's value
isn't a DatabaseValue.string
or its contents is nil.
The unwrapped String
of this field's value, if it was indeed a non-null .string
.
Unwrap and return a Double
value from this DatabaseField
.
This throws if the underlying value
isn't a .double
or
the .double
has a nil associated value.
public func double() throws -> Double
A DatabaseError
if this field's value
isn't a DatabaseValue.double
or its contents is nil.
The unwrapped Double
of this field's value, if it was indeed a non-null .double
.
Unwrap and return a Bool
value from this DatabaseField
.
This throws if the underlying value
isn't a .bool
or
the .bool
has a nil associated value.
public func bool() throws -> Bool
A DatabaseError
if this field's value
isn't a DatabaseValue.bool
or its contents is nil.
The unwrapped Bool
of this field's value, if it was indeed a non-null .bool
.
Unwrap and return a Date
value from this DatabaseField
.
This throws if the underlying value
isn't a .date
or
the .date
has a nil associated value.
public func date() throws -> Date
A DatabaseError
if this field's value
isn't a DatabaseValue.date
or its contents is nil.
The unwrapped Date
of this field's value, if it was indeed a non-null .date
.
Unwrap and return a JSON Data
value from this
DatabaseField
. This throws if the underlying value
isn't
a .json
or the .json
has a nil associated value.
public func json() throws -> Data
A DatabaseError
if this field's value
isn't a DatabaseValue.json
or its contents is nil.
The Data
of this field's unwrapped json value, if it was indeed a non-null .json
.
Unwrap and return a UUID
value from this DatabaseField
.
This throws if the underlying value
isn't a .uuid
or
the .uuid
has a nil associated value.
public func uuid() throws -> UUID
A DatabaseError
if this field's value
isn't a DatabaseValue.uuid
or its contents is nil.
The unwrapped UUID
of this field's value, if it was indeed a non-null .uuid
.
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue