ADTableSchema
open class ADTableSchema
Holds all the information about a table’s schema as read from a backing data store.
-
The table name.
Declaration
Swift
public var name = ""
-
The table’s column information as an array of
ADColumnSchema
instances.Declaration
Swift
public var column: [ADColumnSchema] = []
-
Returns the column that has been defined as the primary key
Declaration
Swift
public var primaryKeyColumn: ADColumnSchema?
-
Returns the primary key for the table or an empty string (“”) if no primary key has been defined.
Declaration
Swift
public var primaryKey: String
-
Creates a new instance of the table schema.
Declaration
Swift
public init(name: String)
Parameters
name
The name of the table
-
Initializes a new
ADTableSchema
and sets its initial properties.Declaration
Swift
public init(fromInstance dictionary: ADInstanceDictionary)
Parameters
dictionary
A
ADInstanceDictionary
to initialize the schema from.
-
Adds the given column schema to the table’s collection of columns.
Declaration
Swift
public func add(value: ADColumnSchema)
Parameters
value
The
ADColumnSchema
to add to the collection. -
Checks to see if the table contains a column with the given name.
Declaration
Swift
public func hasColumn(named: String) -> Bool
Parameters
named
The name of the column to check for.
Return Value
true
if the table contains the column else returnsfalse
. -
Encodes the table schema into an Instance Dictionary for storage in a Swift Portable Object Notation (SPON) format. -Returns: The table schema represented as an Instance Dictionary.
Declaration
Swift
public func encode() -> ADInstanceDictionary
-
Decodes the table schema from an Instance Dictionary that has been read from a Swift Portable Object Notation (SPON) stream.
Declaration
Swift
public func decode(fromInstance dictionary: ADInstanceDictionary)
Parameters
dictionary
A
ADInstanceDictionary
representing the values for the table schema.