Table

public final class Table<Root: TableCodable>: CoreRepresentable

Convenient table interface

  • tag

    The tag of the related database.

    Declaration

    Swift

    public var tag: Tag?
  • The path of the related database.

    Declaration

    Swift

    public var path: String
  • Table name

    Declaration

    Swift

    public let name: String
  • Table related type

    Declaration

    Swift

    public var rootType: Root.Type
  • Execute inserting with TableCodable object on specific(or all) properties

    Note that it will run embedded transaction while objects.count>1.
    The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.

    Throws

    Error

    Declaration

    Swift

    public func insert(objects: [Object], on propertyConvertibleList: [PropertyConvertible]? = nil) throws

    Parameters

    objects

    Table encodable object

    propertyConvertibleList

    Property or CodingTableKey list

  • Execute inserting or replacing with TableCodable object on specific(or all) properties.
    It will replace the original row while they have same primary key or row id.

    Note that it will run embedded transaction while objects.count>1.
    The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.

    Throws

    Error

    Declaration

    Swift

    public func insertOrReplace(objects: [Object], on propertyConvertibleList: [PropertyConvertible]? = nil) throws

    Parameters

    objects

    Table encodable object

    propertyConvertibleList

    Property or CodingTableKey list

  • Execute inserting with TableCodable object on specific(or all) properties

    Note that it will run embedded transaction while objects.count>1.
    The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.

    Throws

    Error

    Declaration

    Swift

    public func insert(objects: Object..., on propertyConvertibleList: [PropertyConvertible]? = nil) throws

    Parameters

    objects

    Table encodable object

    propertyConvertibleList

    Property or CodingTableKey list

  • Execute inserting or replacing with TableCodable object on specific(or all) properties.
    It will replace the original row while they have same primary key or row id.

    Note that it will run embedded transaction while objects.count>1.
    The embedded transaction means that it will run a transaction if it’s not in other transaction, otherwise it will be executed within the existing transaction.

    Throws

    Error

    Declaration

    Swift

    public func insertOrReplace(objects: Object..., on propertyConvertibleList: [PropertyConvertible]? = nil) throws

    Parameters

    objects

    Table encodable object

    propertyConvertibleList

    Property or CodingTableKey list

  • Execute updating with TableCodable object on specific(or all) properties.

    Throws

    Error

    Declaration

    Swift

    public func update(on propertyConvertibleList: [PropertyConvertible],
                       with object: Object,
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       limit: Limit? = nil,
                       offset: Offset? = nil) throws

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    object

    Table encodable object

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

  • Execute updating with TableCodable object on specific(or all) properties.

    Throws

    Error

    Declaration

    Swift

    public func update(on propertyConvertibleList: PropertyConvertible...,
                       with object: Object,
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       limit: Limit? = nil,
                       offset: Offset? = nil) throws

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    object

    Table encodable object

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

  • Execute updating with row on specific(or all) properties.

    Throws

    Error

    Declaration

    Swift

    public func update(on propertyConvertibleList: PropertyConvertible...,
                       with row: [ColumnEncodableBase],
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       limit: Limit? = nil,
                       offset: Offset? = nil) throws

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    object

    Table encodable object

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

  • Execute updating with row on specific(or all) properties.

    Throws

    Error

    Declaration

    Swift

    public func update(on propertyConvertibleList: [PropertyConvertible],
                       with row: [ColumnEncodableBase],
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       limit: Limit? = nil,
                       offset: Offset? = nil) throws

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    object

    Table encodable object

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

  • Execute deleting

    Throws

    Error

    Declaration

    Swift

    public func delete(where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       limit: Limit? = nil,
                       offset: Offset? = nil) throws

    Parameters

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

  • Get objects on specific(or all) properties

    Throws

    Error

    Declaration

    Swift

    public func getObjects(on propertyConvertibleList: [PropertyConvertible],
                           where condition: Condition? = nil,
                           orderBy orderList: [OrderBy]? = nil,
                           limit: Limit? = nil,
                           offset: Offset? = nil) throws -> [Object]

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    Table decodable objects

  • Get objects on specific(or all) properties

    Throws

    Error

    Declaration

    Swift

    public func getObjects(on propertyConvertibleList: PropertyConvertible...,
                           where condition: Condition? = nil,
                           orderBy orderList: [OrderBy]? = nil,
                           limit: Limit? = nil,
                           offset: Offset? = nil) throws -> [Object]

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    Table decodable objects

  • Get object on specific(or all) properties

    Throws

    Error

    Declaration

    Swift

    public func getObject(on propertyConvertibleList: [PropertyConvertible],
                          where condition: Condition? = nil,
                          orderBy orderList: [OrderBy]? = nil,
                          offset: Offset? = nil) throws -> Object?

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    Table decodable objects

  • Get object on specific(or all) properties

    Throws

    Error

    Declaration

    Swift

    public func getObject(on propertyConvertibleList: PropertyConvertible...,
                          where condition: Condition? = nil,
                          orderBy orderList: [OrderBy]? = nil,
                          offset: Offset? = nil) throws -> Object?

    Parameters

    propertyConvertibleList

    Property or CodingTableKey list

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    Table decodable objects

  • Get rows by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getRows(on columnResultConvertibleList: [ColumnResultConvertible],
                        where condition: Condition? = nil,
                        orderBy orderList: [OrderBy]? = nil,
                        limit: Limit? = nil,
                        offset: Offset? = nil) throws -> FundamentalRowXColumn

    Parameters

    columnResultConvertibleList

    WINQ column result list

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    FundamentalRowXColumn

  • Get rows by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getRows(on columnResultConvertibleList: ColumnResultConvertible...,
                        where condition: Condition? = nil,
                        orderBy orderList: [OrderBy]? = nil,
                        limit: Limit? = nil,
                        offset: Offset? = nil) throws -> FundamentalRowXColumn

    Parameters

    columnResultConvertibleList

    WINQ column result list

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    FundamentalRowXColumn

  • Get row by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getRow(on columnResultConvertibleList: ColumnResultConvertible...,
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       offset: Offset? = nil) throws -> FundamentalRow

    Parameters

    columnResultConvertibleList

    WINQ column result list

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    FundamentalRowXColumn

  • Get row by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getRow(on columnResultConvertibleList: [ColumnResultConvertible],
                       where condition: Condition? = nil,
                       orderBy orderList: [OrderBy]? = nil,
                       offset: Offset? = nil) throws -> FundamentalRow

    Parameters

    columnResultConvertibleList

    WINQ column result list

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    FundamentalRowXColumn

  • Get column by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getColumn(on result: ColumnResultConvertible,
                          where condition: Condition? = nil,
                          orderBy orderList: [OrderBy]? = nil,
                          limit: Limit? = nil,
                          offset: Offset? = nil) throws -> FundamentalColumn

    Parameters

    columnResultConvertible

    WINQ column result

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    FundamentalColumn

  • Get distinct column by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getDistinctColumn(on result: ColumnResultConvertible,
                                  where condition: Condition? = nil,
                                  orderBy orderList: [OrderBy]? = nil,
                                  limit: Limit? = nil,
                                  offset: Offset? = nil) throws -> FundamentalColumn

    Parameters

    columnResultConvertible

    WINQ column result

    condition

    Expression convertible

    orderList

    Expression convertible list

    limit

    Expression convertible

    offset

    Expression convertible

    Return Value

    FundamentalColumn

  • Get value by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getValue(on result: ColumnResultConvertible,
                         where condition: Condition? = nil,
                         orderBy orderList: [OrderBy]? = nil,
                         limit: Limit? = nil,
                         offset: Offset? = nil) throws -> FundamentalValue

    Parameters

    columnResultConvertible

    WINQ column result

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    FundamentalValue

  • Get distinct value by specific selecting

    Throws

    Error

    Declaration

    Swift

    public func getDistinctValue(on result: ColumnResultConvertible,
                                 where condition: Condition? = nil,
                                 orderBy orderList: [OrderBy]? = nil,
                                 limit: Limit? = nil,
                                 offset: Offset? = nil) throws -> FundamentalValue

    Parameters

    columnResultConvertible

    WINQ column result

    condition

    Expression convertible

    orderList

    Expression convertible list

    offset

    Expression convertible

    Return Value

    FundamentalValue