forked from parse-community/Parse-Swift
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add batch and increment double operation (#88)
* feat: Add batch and increment double operation * delete file * make operations Codable. * improve documentation * nits
- Loading branch information
Showing
59 changed files
with
648 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// ParseOperationable.swift | ||
// ParseSwift | ||
// | ||
// Created by Corey Baker on 4/1/23. | ||
// Copyright © 2023 Network Reconnaissance Lab. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// A protocol that allows a type to be a Parse operation. | ||
public protocol ParseOperationable: Codable, | ||
CustomDebugStringConvertible, | ||
CustomStringConvertible { | ||
/// The operation command for this operation. | ||
var __op: ParseOperationCommand { get } // swiftlint:disable:this identifier_name | ||
} | ||
|
||
// MARK: CustomDebugStringConvertible | ||
public extension ParseOperationable { | ||
var debugDescription: String { | ||
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), | ||
let descriptionString = String(data: descriptionData, encoding: .utf8) else { | ||
return "()" | ||
} | ||
|
||
return "\(descriptionString)" | ||
} | ||
} | ||
|
||
// MARK: CustomStringConvertible | ||
public extension ParseOperationable { | ||
var description: String { | ||
debugDescription | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Sources/ParseSwift/Protocols/ParseRelationOperationable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// ParseRelationOperationable.swift | ||
// ParseSwift | ||
// | ||
// Created by Corey Baker on 4/1/23. | ||
// Copyright © 2023 Network Reconnaissance Lab. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol ParseRelationOperationable: ParseOperationable { | ||
associatedtype Object: ParseObject | ||
var __op: ParseOperationCommand { get set } // swiftlint:disable:this identifier_name | ||
var objects: [Pointer<Object>] { get set } | ||
} |
26 changes: 26 additions & 0 deletions
26
Sources/ParseSwift/Types/Operations/ParseOperationAdd.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// ParseOperationAdd.swift | ||
// Parse | ||
// | ||
// Created by Florent Vilmart on 17-07-24. | ||
// Copyright © 2017 Parse. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/** | ||
An operation that adds new objects to an array field. | ||
*/ | ||
public struct ParseOperationAdd<T>: ParseOperationable where T: Codable { | ||
public var __op: ParseOperationCommand = .add // swiftlint:disable:this identifier_name | ||
/// The array of objects related to the operation. | ||
public var objects: [T] | ||
|
||
/** | ||
Create an instance with an array of objects. | ||
- parameter objects: The array of objects to add | ||
*/ | ||
public init(objects: [T]) { | ||
self.objects = objects | ||
} | ||
} |
Oops, something went wrong.