Skip to content

Commit

Permalink
Merge pull request #195 from vapor/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
loganwright committed Feb 24, 2017
2 parents bdc4579 + 355c6d4 commit 8ce3359
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 49 deletions.
6 changes: 3 additions & 3 deletions Sources/Fluent/Pivot/Pivot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public final class Pivot<
}

public init(node: Node, in context: Context) throws {
leftId = try node.extract(Left.foreignIdKey)
rightId = try node.extract(Right.foreignIdKey)
leftId = try node.get(Left.foreignIdKey)
rightId = try node.get(Right.foreignIdKey)

id = try node.extract(idKey)
id = try node.get(idKey)
}

public func makeNode(context: Context) throws -> Node {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Fluent/Preparation/Migration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ final class Migration: Entity {
}

init(node: Node, in context: Context) throws {
name = try node.extract("name")
id = try node.extract(idKey)
name = try node.get("name")
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
6 changes: 5 additions & 1 deletion Sources/Fluent/Utilities/Fluent+Node.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
@_exported import Node
#if COCOAPODS
@_exported import NodeCocoapods
#else
@_exported import Node
#endif

public final class DatabaseContext: Context {
public let database: Database
Expand Down
10 changes: 4 additions & 6 deletions Sources/FluentTester/Atom.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

public final class Atom: Entity {
public var name: String
public var protons: Int
Expand All @@ -15,11 +13,11 @@ public final class Atom: Entity {
}

public init(node: Node, in context: Context) throws {
name = try node.extract("name")
protons = try node.extract("protons")
weight = try node.extract("weight")
name = try node.get("name")
protons = try node.get("protons")
weight = try node.get("weight")

id = try node.extract(idKey)
id = try node.get(idKey)
}

public func makeNode(context: Context) throws -> Node {
Expand Down
6 changes: 2 additions & 4 deletions Sources/FluentTester/Compound.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

public final class Compound: Entity {
public var name: String
public let storage = Storage()
Expand All @@ -10,8 +8,8 @@ public final class Compound: Entity {
}

public init(node: Node, in context: Context) throws {
name = try node.extract("name")
id = try node.extract(idKey)
name = try node.get("name")
id = try node.get(idKey)
}

public func makeNode(context: Context) throws -> Node {
Expand Down
14 changes: 6 additions & 8 deletions Sources/FluentTester/Student.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

final class Student: Entity {
var name: String
var age: Int
Expand All @@ -18,13 +16,13 @@ final class Student: Entity {
}

init(node: Node, in context: Context) throws {
name = try node.extract("name")
age = try node.extract("age")
ssn = try node.extract("ssn")
donor = try node.extract("donor")
meta = try node.extract("meta")
name = try node.get("name")
age = try node.get("age")
ssn = try node.get("ssn")
donor = try node.get("donor")
meta = try node.get("meta")

id = try node.extract(idKey)
id = try node.get(idKey)
}

func makeNode(context: Context) throws -> Node {
Expand Down
2 changes: 0 additions & 2 deletions Sources/FluentTester/Tester+InsertAndFind.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

extension Tester {
public func testInsertAndFind() throws {
Atom.database = database
Expand Down
2 changes: 0 additions & 2 deletions Sources/FluentTester/Tester+PivotsAndRelations.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

extension Tester {
func setup() {
Atom.database = database
Expand Down
2 changes: 0 additions & 2 deletions Sources/FluentTester/Tester+Schema.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

extension Tester {
public func testSchema() throws {
Student.database = database
Expand Down
2 changes: 0 additions & 2 deletions Sources/FluentTester/Tester+Utilities.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Fluent

extension Tester {
public func test(_ f: () throws -> (), _ name: String) throws {
do {
Expand Down
4 changes: 3 additions & 1 deletion Sources/FluentTester/Tester.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Fluent
#if !COCOAPODS
@_exported import Fluent
#endif

public final class Tester {
public let database: Database
Expand Down
2 changes: 1 addition & 1 deletion Tests/FluentTests/ModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ModelTests: XCTestCase {

init() {}
init(node: Node, in context: Context) throws {
id = try node.extract(idKey)
id = try node.get(idKey)
}
func makeNode(context: Context) throws -> Node {
return try Node(node: [idKey: id])
Expand Down
6 changes: 3 additions & 3 deletions Tests/FluentTests/PreparationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ final class TestModel: Entity {
let storage = Storage()

init(node: Node, in context: Context) throws {
name = try node.extract("name")
age = try node.extract("age")
id = try node.extract(idKey)
name = try node.get("name")
age = try node.get("age")
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
6 changes: 3 additions & 3 deletions Tests/FluentTests/Utilities/Atom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ final class Atom: Entity {
}

init(node: Node, in context: Context) throws {
name = try node.extract("name")
groupId = try node.extract("group_id")
name = try node.get("name")
groupId = try node.get("group_id")

id = try node.extract(idKey)
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
4 changes: 2 additions & 2 deletions Tests/FluentTests/Utilities/Compound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ final class Compound: Entity {
}

init(node: Node, in context: Context) throws {
name = try node.extract("name")
id = try node.extract(idKey)
name = try node.get("name")
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
4 changes: 2 additions & 2 deletions Tests/FluentTests/Utilities/CustomIdKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ final class CustomIdKey: Entity {
}

init(node: Node, in context: Context) throws {
label = try node.extract("label")
id = try node.extract(idKey)
label = try node.get("label")
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
2 changes: 1 addition & 1 deletion Tests/FluentTests/Utilities/CustomIdentifiedThing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class CustomIdentifiedThing: Entity {
static let idKey = "#id"

init(node: Node, in context: Context) throws {
id = try node.extract(idKey)
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
2 changes: 1 addition & 1 deletion Tests/FluentTests/Utilities/StringIdentifiedThing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class StringIdentifiedThing: Entity {
let storage = Storage()

init(node: Node, in context: Context) throws {
id = try node.extract(idKey)
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down
6 changes: 3 additions & 3 deletions Tests/FluentTests/Utilities/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ final class User: Entity {
}

init(node: Node, in context: Context) throws {
name = try node.extract("name")
email = try node.extract("email")
id = try node.extract(idKey)
name = try node.get("name")
email = try node.get("email")
id = try node.get(idKey)
}

func makeNode(context: Context = EmptyNode) throws -> Node {
Expand Down

0 comments on commit 8ce3359

Please sign in to comment.