Skip to content

Commit

Permalink
Rename method to serializedBytes (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasperav authored Nov 12, 2022
1 parent dc2c390 commit 937b932
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions GRDBPerformance/GRDBPerformance/Generated/DbUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha
public var bool: Bool
public private(set) var serializedInfo: Data
public func serializedInfoAutoConvert() -> SerializedInfo {
try! SerializedInfo(serializedData: serializedInfo)
try! SerializedInfo(serializedBytes: serializedInfo)
}

public mutating func serializedInfoAutoSet(serializedInfo: SerializedInfo) {
Expand All @@ -46,7 +46,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha
guard let serializedInfoNullable = serializedInfoNullable else {
return nil
}
return try! SerializedInfo(serializedData: serializedInfoNullable)
return try! SerializedInfo(serializedBytes: serializedInfoNullable)
}

public mutating func serializedInfoNullableAutoSet(serializedInfoNullable: SerializedInfo?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ public extension DbUser {
public var gen0: SerializedInfo
public var gen1: SerializedInfo?
public init(row: Row) {
gen0 = try! SerializedInfo(serializedData: row[0])
gen0 = try! SerializedInfo(serializedBytes: row[0])
gen1 = {
if row.hasNull(atIndex: 1) {
return nil
} else {
return try! SerializedInfo(serializedData: row[1])
return try! SerializedInfo(serializedBytes: row[1])
}
}()
}
Expand Down Expand Up @@ -426,12 +426,12 @@ public extension DbUser {
public var gen0: SerializedInfo
public var gen1: SerializedInfo?
public init(row: Row) {
gen0 = try! SerializedInfo(serializedData: row[0])
gen0 = try! SerializedInfo(serializedBytes: row[0])
gen1 = {
if row.hasNull(atIndex: 1) {
return nil
} else {
return try! SerializedInfo(serializedData: row[1])
return try! SerializedInfo(serializedBytes: row[1])
}
}()
}
Expand Down
4 changes: 2 additions & 2 deletions GRDBPerformance/GRDBPerformance/Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import GRDB
public enum SerializedInfo: Equatable {
case data(String)

public init(serializedData: Data) {
self = SerializedInfo.data(String(decoding: serializedData, as: UTF8.self))
public init(serializedBytes: Data) {
self = SerializedInfo.data(String(decoding: serializedBytes, as: UTF8.self))
}

public func serializedData() -> Data {
Expand Down
4 changes: 2 additions & 2 deletions Parser/generated/DbUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha
public var bool: Bool
public private(set) var serializedInfo: Data
public func serializedInfoAutoConvert() -> SerializedInfo {
try! SerializedInfo(serializedData: serializedInfo)
try! SerializedInfo(serializedBytes: serializedInfo)
}

public mutating func serializedInfoAutoSet(serializedInfo: SerializedInfo) {
Expand All @@ -46,7 +46,7 @@ public struct DbUser: FetchableRecord, PersistableRecord, Codable, Equatable, Ha
guard let serializedInfoNullable = serializedInfoNullable else {
return nil
}
return try! SerializedInfo(serializedData: serializedInfoNullable)
return try! SerializedInfo(serializedBytes: serializedInfoNullable)
}

public mutating func serializedInfoNullableAutoSet(serializedInfoNullable: SerializedInfo?) {
Expand Down
8 changes: 4 additions & 4 deletions Parser/generated/DynamicQueries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ public extension DbUser {
public var gen0: SerializedInfo
public var gen1: SerializedInfo?
public init(row: Row) {
gen0 = try! SerializedInfo(serializedData: row[0])
gen0 = try! SerializedInfo(serializedBytes: row[0])
gen1 = {
if row.hasNull(atIndex: 1) {
return nil
} else {
return try! SerializedInfo(serializedData: row[1])
return try! SerializedInfo(serializedBytes: row[1])
}
}()
}
Expand Down Expand Up @@ -426,12 +426,12 @@ public extension DbUser {
public var gen0: SerializedInfo
public var gen1: SerializedInfo?
public init(row: Row) {
gen0 = try! SerializedInfo(serializedData: row[0])
gen0 = try! SerializedInfo(serializedBytes: row[0])
gen1 = {
if row.hasNull(atIndex: 1) {
return nil
} else {
return try! SerializedInfo(serializedData: row[1])
return try! SerializedInfo(serializedBytes: row[1])
}
}()
}
Expand Down
2 changes: 1 addition & 1 deletion Parser/src/dynamic_queries/return_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a> ReturnType<'a> {
{
let row_index = create_row_index(&decoder.row_index());
let decode = format!(
"try! {}(serializedData: {})",
"try! {}(serializedBytes: {})",
swift_property.swift_type.type_name, row_index
);
let decode = wrap_null_check(
Expand Down
4 changes: 2 additions & 2 deletions Parser/src/format_swift_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn format_swift_code(config: &Config, safe_output_dir: &Path) {
let output = Command::new("swiftformat")
.current_dir(safe_output_dir)
// TODO Not sure how the --swiftversion flag works, can't get it to work
.args(&["."])
.args(["."])
.output()
.unwrap_or_else(|_| panic!("Problem formatting code in: {:#?}", safe_output_dir));

Expand All @@ -29,7 +29,7 @@ pub fn format_swift_code(config: &Config, safe_output_dir: &Path) {

let output = Command::new("swiftlint")
.current_dir(safe_output_dir)
.args(&["--fix"])
.args(["--fix"])
.output()
.unwrap();

Expand Down
6 changes: 3 additions & 3 deletions Parser/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ fn main() {
.collect::<Vec<_>>()
.join("\n");
let config = Config {
visibility: Visibility::from_str(&*properties::VISIBILITY),
visibility: Visibility::from_str(&properties::VISIBILITY),
output_dir: Path::new(&*properties::OUTPUT_DIR).to_owned(),
custom_mapping,
dynamic_queries,
suffix_swift_structs: &*properties::SUFFIX_SWIFT_STRUCTS,
prefix_swift_structs: &*properties::PREFIX_SWIFT_STRUCTS,
suffix_swift_structs: &properties::SUFFIX_SWIFT_STRUCTS,
prefix_swift_structs: &properties::PREFIX_SWIFT_STRUCTS,
use_swiftformat: *properties::USE_SWIFTFORMAT,
use_swiftlint: *properties::USE_SWIFTLINT,
sqlite_location: properties::SQLITE_LOCATION.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion Parser/src/swift_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl SwiftProperty {
prefix, self.swift_property_name, serialize_question_mark,
);
let deserialize = format!(
"{}try! {}(serializedData: {})",
"{}try! {}(serializedBytes: {})",
deserialize_return_if_nil,
self.swift_type.type_name.replace('?', ""),
self.swift_property_name
Expand Down
2 changes: 1 addition & 1 deletion new_version/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn main() {

// Run the swift tests
assert!(Command::new("xcodebuild")
.args(&[
.args([
"test",
"-project",
"GRDBPerformance.xcodeproj",
Expand Down

0 comments on commit 937b932

Please sign in to comment.