YapDatabaseSecondaryIndex

@interface YapDatabaseSecondaryIndex : YapDatabaseExtension

Welcome to YapDatabase! https://github.com/yapstudios/YapDatabase

The project wiki has a wealth of documentation if you have any questions. https://github.com/yapstudios/YapDatabase/wiki

YapDatabaseSecondaryIndex is an extension which allows you to add additional indexes for fast searching.

That is, it allows you to create index(es) within sqlite for particular properties of your objects. You can then issue queries to find or enumerate objects. Examples:

  • enumerate all people in the database where: age >= 62
  • find the contact where: email == johndoe@domain.com

For more information, see the wiki article about secondary indexes: https://github.com/yapstudios/YapDatabase/wiki/Secondary-Indexes

  • Creates a new secondary index extension. After creation, you’ll need to register the extension with the database system.

    A YapDatabaseSecondaryIndexSetup instance allows you to specify the column names and type. The column names can be whatever you want, with a few exceptions for reserved names such as rowid. The types can reflect numbers or text.

    The block (and blockType) that handles extracting secondary index information from a row in the database.

    See

    YapDatabaseSecondaryIndexSetup

    See

    YapDatabaseSecondaryIndexHandler

    See

    YapDatabase registerExtension:withName:

    Declaration

    Objective-C

    - (nonnull id)initWithSetup:(nonnull YapDatabaseSecondaryIndexSetup *)setup
                        handler:(nonnull YapDatabaseSecondaryIndexHandler *)handler;

    Parameters

    setup

    handler

  • Creates a new secondary index extension. After creation, you’ll need to register the extension with the database system.

    See

    YapDatabaseSecondaryIndexSetup

    See

    YapDatabaseSecondaryIndexHandler

    See

    YapDatabase registerExtension:withName:

    Declaration

    Objective-C

    - (nonnull id)initWithSetup:(nonnull YapDatabaseSecondaryIndexSetup *)setup
                        handler:(nonnull YapDatabaseSecondaryIndexHandler *)handler
                     versionTag:(nullable NSString *)versionTag;

    Swift

    init(setup: YapDatabaseSecondaryIndexSetup, handler: YapDatabaseSecondaryIndexHandler, versionTag: String?)

    Parameters

    setup

    A YapDatabaseSecondaryIndexSetup instance allows you to specify the column names and type. The column names can be whatever you want, with a few exceptions for reserved names such as rowid. The types can reflect numbers or text.

    handler

    The block (and blockType) that handles extracting secondary index information from a row in the database.

    versionTag

    If, after creating the secondary index(es), you need to change the setup or block, then simply increment the version parameter. If you pass a version that is different from the last initialization of the extension, then it will automatically re-create itself.

  • Creates a new secondary index extension. After creation, you’ll need to register the extension with the database system.

    A YapDatabaseSecondaryIndexSetup instance allows you to specify the column names and type. The column names can be whatever you want, with a few exceptions for reserved names such as rowid. The types can reflect numbers or text.

    The block (and blockType) that handles extracting secondary index information from a row in the database.

    If, after creating the secondary index(es), you need to change the setup or block, then simply increment the version parameter. If you pass a version that is different from the last initialization of the extension, then it will automatically re-create itself.

    Allows you to specify extra options to configure the extension. See the YapDatabaseSecondaryIndexOptions class for more information.

    See

    YapDatabaseSecondaryIndexSetup

    See

    YapDatabaseSecondaryIndexHandler

    See

    YapDatabase registerExtension:withName:

    Declaration

    Objective-C

    - (nonnull id)initWithSetup:(nonnull YapDatabaseSecondaryIndexSetup *)setup
                        handler:(nonnull YapDatabaseSecondaryIndexHandler *)handler
                     versionTag:(nullable NSString *)versionTag
                        options:
                            (nullable YapDatabaseSecondaryIndexOptions *)options;

    Swift

    init(setup: YapDatabaseSecondaryIndexSetup, handler: YapDatabaseSecondaryIndexHandler, versionTag: String?, options: YapDatabaseSecondaryIndexOptions?)

    Parameters

    setup

    handler

    versionTag

    options

  • The versionTag assists in making changes to the extension.

    If you need to change the columnNames and/or block, then simply pass a different versionTag during the init method, and the extension will automatically update itself.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull versionTag;

    Swift

    var versionTag: String { get }