YapDatabaseRelationshipEdge

@interface YapDatabaseRelationshipEdge : NSObject <NSCopying>

/**
 * Returns an edge with the given name, destination & nodeDeleteRules.
 * 
 * This method is suitable for use with the YapDatabaseRelationshipNode protocol.
 * When using this protocol, the source object is directly queried by the YapDatabaseRelationship extension.
 * Thus the extension already knows what the source node is,
 * and so the source node information (sourceKey & sourceCollection) doesn't need to be explicitly set on the edge.
 * 
 * This method is not suitable for use with manual edge management.
 * When manually adding an edge, you must fully specify the source node.
 */
+ (instancetype)edgeWithName:(NSString *)name
              destinationKey:(NSString *)destinationKey
                  collection:(nullable NSString *)destinationCollection
             nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * Returns an edge with the given name, destinationFileURL & nodeDeleteRules.
 * 
 * When using a destinationFileURL, only a subset of the nodeDeleteRules apply.
 * Specifically only the following work:
 * - YDB_DeleteDestinationIfSourceDeleted
 * - YDB_DeleteDestinationIfAllSourcesDeleted
 *
 * This method is suitable for use with the YapDatabaseRelationshipNode protocol.
 * When using this protocol, the source object is directly queried by the YapDatabaseRelationship extension.
 * Thus the extension already knows what the source node is,
 * and so the source node information (sourceKey & sourceCollection) doesn't need to be explicitly set on the edge.
 * 
 * This method is not suitable for use with manual edge management.
 * When directly adding an edge, you must fully specify the source node.
 */
+ (instancetype)edgeWithName:(NSString *)name
          destinationFileURL:(NSURL *)destinationFileURL
             nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * Returns a fully specified edge.
 * 
 * This method is suitable for use with manual edge management.
 * 
 * If you're using the YapDatabaseRelationshipNode protocol, then you can use the shorter version of this method
 * which doesn't specify the source node. This is because the source node is implied with the
 * YapDatabaseRelationshipNode protocol, and thus doesn't need to be explicitly specified in the edge.
 */
+ (instancetype)edgeWithName:(NSString *)name
                   sourceKey:(NSString *)sourceKey
                  collection:(nullable NSString *)sourceCollection
              destinationKey:(NSString *)destinationKey
                  collection:(nullable NSString *)destinationCollection
             nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * Returns a fully specified edge.
 * 
 * When using a destinationFileURL, only a subset of the nodeDeleteRules apply.
 * Specifically only the following work:
 * - YDB_DeleteDestinationIfSourceDeleted
 * - YDB_DeleteDestinationIfAllSourcesDeleted
 *
 * This method is suitable for use with manual edge management.
 *
 * If you're using the YapDatabaseRelationshipNode protocol, then you can use the shorter version of this method
 * which doesn't specify the source node. This is because the source node is implied with the
 * YapDatabaseRelationshipNode protocol, and thus doesn't need to be explicitly specified in the edge.
 */
+ (instancetype)edgeWithName:(NSString *)name
                   sourceKey:(NSString *)sourceKey
                  collection:(nullable NSString *)sourceCollection
          destinationFileURL:(NSURL *)destinationFileURL
             nodeDeleteRules:(YDB_NodeDeleteRules)rules;

#pragma mark Init

/**
 * For documentation @see edgeWithName:destinationKey:collection:nodeDeleteRules:
 */
- (id)initWithName:(NSString *)name
    destinationKey:(NSString *)key
        collection:(nullable NSString *)collection
   nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * For documentation @see edgeWithName:destinationFileURL:nodeDeleteRules:
 */
- (id)initWithName:(NSString *)name destinationFileURL:(NSURL *)destinationFileURL
                                       nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * For documentation @see edgeWithName:sourceKey:collection:destinationKey:collection:nodeDeleteRules:
 */
- (id)initWithName:(NSString *)name
         sourceKey:(NSString *)sourceKey
        collection:(nullable NSString *)sourceCollection
    destinationKey:(NSString *)destinationKey
        collection:(nullable NSString *)destinationCollection
   nodeDeleteRules:(YDB_NodeDeleteRules)rules;

/**
 * For documentation @see edgeWithName:sourceKey:collection:destinationFileURL:nodeDeleteRules:
 */
- (id)initWithName:(NSString *)name sourceKey:(NSString *)sourceKey
                                   collection:(nullable NSString *)sourceCollection
                           destinationFileURL:(NSURL *)destinationFileURL
                              nodeDeleteRules:(YDB_NodeDeleteRules)rules;

#pragma mark Properties

@property (nonatomic, copy, readonly) NSString *name;

@property (nonatomic, copy, readonly) NSString *sourceKey;
@property (nonatomic, copy, readonly) NSString *sourceCollection;

@property (nonatomic, copy, readonly) NSString *destinationKey;
@property (nonatomic, copy, readonly) NSString *destinationCollection;

@property (nonatomic, copy, readonly) NSURL *destinationFileURL;

@property (nonatomic, assign, readonly) YDB_NodeDeleteRules nodeDeleteRules;

/**
 * NO if the edge was created via the YapDatabaseRelationshipNode protocol.
 * YES if the edge was created via "manual edge management" methods.
 */
@property (nonatomic, assign, readonly) BOOL isManualEdge;

@end

Undocumented

  • Returns an edge with the given name, destination & nodeDeleteRules.

    This method is suitable for use with the YapDatabaseRelationshipNode protocol. When using this protocol, the source object is directly queried by the YapDatabaseRelationship extension. Thus the extension already knows what the source node is, and so the source node information (sourceKey & sourceCollection) doesn’t need to be explicitly set on the edge.

    This method is not suitable for use with manual edge management. When manually adding an edge, you must fully specify the source node.

    Declaration

    Objective-C

    + (nonnull instancetype)edgeWithName:(nonnull NSString *)name
                          destinationKey:(nonnull NSString *)destinationKey
                              collection:(nullable NSString *)destinationCollection
                         nodeDeleteRules:(YDB_NodeDeleteRules)rules;
  • Returns an edge with the given name, destinationFileURL & nodeDeleteRules.

    When using a destinationFileURL, only a subset of the nodeDeleteRules apply. Specifically only the following work:

    • YDB_DeleteDestinationIfSourceDeleted
    • YDB_DeleteDestinationIfAllSourcesDeleted

    This method is suitable for use with the YapDatabaseRelationshipNode protocol. When using this protocol, the source object is directly queried by the YapDatabaseRelationship extension. Thus the extension already knows what the source node is, and so the source node information (sourceKey & sourceCollection) doesn’t need to be explicitly set on the edge.

    This method is not suitable for use with manual edge management. When directly adding an edge, you must fully specify the source node.

    Declaration

    Objective-C

    + (nonnull instancetype)edgeWithName:(nonnull NSString *)name
                      destinationFileURL:(nonnull NSURL *)destinationFileURL
                         nodeDeleteRules:(YDB_NodeDeleteRules)rules;
  • Returns a fully specified edge.

    This method is suitable for use with manual edge management.

    If you’re using the YapDatabaseRelationshipNode protocol, then you can use the shorter version of this method which doesn’t specify the source node. This is because the source node is implied with the YapDatabaseRelationshipNode protocol, and thus doesn’t need to be explicitly specified in the edge.

    Declaration

    Objective-C

    + (nonnull instancetype)edgeWithName:(nonnull NSString *)name
                               sourceKey:(nonnull NSString *)sourceKey
                              collection:(nullable NSString *)sourceCollection
                          destinationKey:(nonnull NSString *)destinationKey
                              collection:(nullable NSString *)destinationCollection
                         nodeDeleteRules:(YDB_NodeDeleteRules)rules;
  • Returns a fully specified edge.

    When using a destinationFileURL, only a subset of the nodeDeleteRules apply. Specifically only the following work:

    • YDB_DeleteDestinationIfSourceDeleted
    • YDB_DeleteDestinationIfAllSourcesDeleted

    This method is suitable for use with manual edge management.

    If you’re using the YapDatabaseRelationshipNode protocol, then you can use the shorter version of this method which doesn’t specify the source node. This is because the source node is implied with the YapDatabaseRelationshipNode protocol, and thus doesn’t need to be explicitly specified in the edge.

    Declaration

    Objective-C

    + (nonnull instancetype)edgeWithName:(nonnull NSString *)name
                               sourceKey:(nonnull NSString *)sourceKey
                              collection:(nullable NSString *)sourceCollection
                      destinationFileURL:(nonnull NSURL *)destinationFileURL
                         nodeDeleteRules:(YDB_NodeDeleteRules)rules;
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *name

    Swift

    var name: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *sourceKey

    Swift

    var sourceKey: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *sourceCollection

    Swift

    var sourceCollection: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *destinationKey

    Swift

    var destinationKey: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *destinationCollection

    Swift

    var destinationCollection: String { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSURL *destinationFileURL

    Swift

    var destinationFileURL: URL { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, assign, readonly) YDB_NodeDeleteRules nodeDeleteRules

    Swift

    var nodeDeleteRules: YDB_NodeDeleteRules { get }
  • NO if the edge was created via the YapDatabaseRelationshipNode protocol. YES if the edge was created via manual edge management methods.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) BOOL isManualEdge;

    Swift

    var isManualEdge: Bool { get }