Skip to content

Commit

Permalink
Merge pull request #1 from Kitura/master
Browse files Browse the repository at this point in the history
Update from upstream
  • Loading branch information
mbarnach authored Dec 3, 2021
2 parents 19e4619 + b9f5355 commit e6a4efa
Show file tree
Hide file tree
Showing 151 changed files with 11,576 additions and 11,391 deletions.
6 changes: 2 additions & 4 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module: SwiftKuery
author: IBM
github_url: https://github.com/IBM-Swift/Swift-Kuery/
author: IBM & Kitura project authors
github_url: https://github.com/Kitura/Swift-Kuery/

theme: fullwidth
clean: true
Expand All @@ -10,5 +10,3 @@ readme: README.md

skip_undocumented: false
hide_documentation_coverage: false

xcodebuild_arguments: [-project, SwiftKuery.xcodeproj, -target, SwiftKuery, LIBRARY_SEARCH_PATHS=.build/debug]
47 changes: 10 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,31 @@ matrix:
dist: xenial
sudo: required
services: docker
env: DOCKER_IMAGE=swift:4.0.3 SWIFT_SNAPSHOT=4.0.3
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu16.04:5.1.5
- os: linux
dist: xenial
sudo: required
services: docker
env: DOCKER_IMAGE=swift:4.1.3 SWIFT_SNAPSHOT=4.1.3
- os: linux
dist: xenial
sudo: required
services: docker
env: DOCKER_IMAGE=swift:4.2.4 SWIFT_SNAPSHOT=4.2.4
- os: linux
dist: xenial
sudo: required
services: docker
env: DOCKER_IMAGE=swift:5.0.3-xenial SWIFT_SNAPSHOT=5.0.3
- os: linux
dist: xenial
dist: bionic
sudo: required
services: docker
env: DOCKER_IMAGE=swift:5.1
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu18.04:5.4
- os: linux
dist: xenial
sudo: required
services: docker
env: DOCKER_IMAGE=swift:5.1 SWIFT_SNAPSHOT=$SWIFT_DEVELOPMENT_SNAPSHOT
- os: osx
osx_image: xcode9.2
sudo: required
env: SWIFT_SNAPSHOT=4.0.3
- os: osx
osx_image: xcode9.4
sudo: required
env: SWIFT_SNAPSHOT=4.1.2
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu18.04:latest USE_SWIFT_DEVELOPMENT_SNAPSHOT=1
- os: osx
osx_image: xcode10.1
osx_image: xcode11
sudo: required
env: SWIFT_SNAPSHOT=4.2.1
env: SWIFT_SNAPSHOT=5.1.5 JAZZY_ELIGIBLE=true
- os: osx
osx_image: xcode10.2
osx_image: xcode12.2
sudo: required
env: SWIFT_SNAPSHOT=5.0.1 JAZZY_ELIGIBLE=true
- os: osx
osx_image: xcode11
sudo: required
- os: osx
osx_image: xcode11
osx_image: xcode12.5
sudo: required
env: SWIFT_SNAPSHOT=$SWIFT_DEVELOPMENT_SNAPSHOT
env: USE_SWIFT_DEVELOPMENT_SNAPSHOT=1

before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
- git clone https://github.com/Kitura/Package-Builder.git

script:
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The swift-tools-version declares the minimum version of Swift required to build this package.

/**
* Copyright IBM Corporation 2016-2019
* Copyright IBM Corporation and the Kitura project authors 2016-2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "1.7.0"),
.package(url: "https://github.com/Kitura/LoggerAPI.git", from: "1.9.200"),
],
targets: [
// Targets are the basic building blocks of a package. A target defines a module or a test suite.
Expand Down
45 changes: 0 additions & 45 deletions [email protected]

This file was deleted.

28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<p align="center">
<a href="http://kitura.io/">
<img src="https://raw.githubusercontent.com/IBM-Swift/Kitura/master/Sources/Kitura/resources/kitura-bird.svg?sanitize=true" height="100" alt="Kitura">
<img src="https://raw.githubusercontent.com/Kitura/Kitura/master/Sources/Kitura/resources/kitura-bird.svg?sanitize=true" height="100" alt="Kitura">
</a>
</p>


<p align="center">
<a href="https://ibm-swift.github.io/Swift-Kuery/index.html">
<a href="https://kitura.github.io/Swift-Kuery/index.html">
<img src="https://img.shields.io/badge/apidoc-SwiftKuery-1FBCE4.svg?style=flat" alt="APIDoc">
</a>
<a href="https://travis-ci.org/IBM-Swift/Swift-Kuery">
<img src="https://travis-ci.org/IBM-Swift/Swift-Kuery.svg?branch=master" alt="Build Status - Master">
<a href="https://travis-ci.org/Kitura/Swift-Kuery">
<img src="https://travis-ci.org/Kitura/Swift-Kuery.svg?branch=master" alt="Build Status - Master">
</a>
<img src="https://img.shields.io/badge/os-macOS-green.svg?style=flat" alt="macOS">
<img src="https://img.shields.io/badge/os-linux-green.svg?style=flat" alt="Linux">
Expand All @@ -24,7 +24,7 @@

`Swift-Kuery` is a pluggable SQL database driver/SDK abstraction layer. Its main idea is to unify the APIs to the various relational databases, providing a Swifty yet SQL-like API. This allows easy switching between databases and forms the basis for an Object-Relational Mapping (ORM) framework.

[Swift-Kuery-ORM](https://github.com/IBM-Swift/Swift-Kuery-ORM) is an ORM, built on top of Swift-Kuery, which allows you to simplify the persistence of model objects with your server.
[Swift-Kuery-ORM](https://github.com/Kitura/Swift-Kuery-ORM) is an ORM, built on top of Swift-Kuery, which allows you to simplify the persistence of model objects with your server.

`Swift-Kuery` is an easy to learn, consumable framework that comes with a set of [implemented plugins](#list-of-plugins).

Expand All @@ -44,7 +44,7 @@
The latest version of Swift-Kuery requires **Swift 4.0** or newer. You can download this version of the Swift binaries by following this [link](https://swift.org/download/). Compatibility with other Swift versions is not guaranteed.

## Usage
This example demonstrates how to execute an SQL query using `Swift-Kuery` with the [Swift-Kuery-PostgreSQL](https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL) plugin.
This example demonstrates how to execute an SQL query using `Swift-Kuery` with the [Swift-Kuery-PostgreSQL](https://github.com/Kitura/Swift-Kuery-PostgreSQL) plugin.

The starting point for this example is an existing Swift package. If you don't have one already, create and enter a directory named e.g. `SwiftKueryExample`. Now run the swift package's init command, to create an executable type, by running `swift package init --type executable`.

Expand Down Expand Up @@ -72,14 +72,14 @@ The starting point for this example is an existing Swift package. If you don't h
```
### Update your Package.swift file
Add Swift-Kuery and your Kuery plugin, in this case Swift-Kuery-PostgreSQL, to the dependencies within your application's `Package.swift` file. Substitute `"x.x.x"` with the latest `Swift-Kuery` [release](https://github.com/IBM-Swift/Swift-Kuery/releases) and `"y.y.y"` with the latest plugin [release](https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL/releases).
Add Swift-Kuery and your Kuery plugin, in this case Swift-Kuery-PostgreSQL, to the dependencies within your application's `Package.swift` file. Substitute `"x.x.x"` with the latest `Swift-Kuery` [release](https://github.com/Kitura/Swift-Kuery/releases) and `"y.y.y"` with the latest plugin [release](https://github.com/Kitura/Swift-Kuery-PostgreSQL/releases).
```swift
dependencies: [
...
// Add this line
.package(url: "https://github.com/IBM-Swift/Swift-Kuery.git", from: "x.x.x"),
.package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", from: "y.y.y"),
.package(url: "https://github.com/Kitura/Swift-Kuery.git", from: "x.x.x"),
.package(url: "https://github.com/Kitura/Swift-Kuery-PostgreSQL.git", from: "y.y.y"),
],
targets: [
.target(
Expand Down Expand Up @@ -619,18 +619,18 @@ let query = Select(t2.c, from: t2)

## List of plugins

* [PostgreSQL](https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL)
* [PostgreSQL](https://github.com/Kitura/Swift-Kuery-PostgreSQL)

* [SQLite](https://github.com/IBM-Swift/Swift-Kuery-SQLite)
* [SQLite](https://github.com/Kitura/Swift-Kuery-SQLite)

* [MySQL](https://github.com/IBM-Swift/SwiftKueryMySQL)
* [MySQL](https://github.com/Kitura/SwiftKueryMySQL)

## API Documentation
For more information visit our [API reference](https://ibm-swift.github.io/Swift-Kuery/index.html).
For more information visit our [API reference](https://kitura.github.io/Swift-Kuery/index.html).

## Community

We love to talk server-side Swift, and Kitura. Join our [Slack](http://swift-at-ibm-slack.mybluemix.net/) to meet the team!

## License
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/IBM-Swift/Swift-Kuery/blob/master/LICENSE.txt).
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/Kitura/Swift-Kuery/blob/master/LICENSE.txt).
19 changes: 10 additions & 9 deletions Sources/SwiftKuery/Utils.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
Copyright IBM Corporation 2016, 2017

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -17,7 +17,7 @@
import Foundation

struct Utils {

static func packType(_ item: Any) -> String {
switch item {
case let val as String:
Expand All @@ -28,7 +28,7 @@ struct Utils {
return String(describing: item)
}
}

static func packType(_ item: Any, queryBuilder: QueryBuilder) throws -> String {
switch item {
case let val as String:
Expand All @@ -48,7 +48,7 @@ struct Utils {
return val == "nil" ? "NULL" : val
}
}

static func packName(_ name: String, queryBuilder: QueryBuilder) -> String {
var result = name
let identifierQuoteCharacter = queryBuilder.substitutions[QueryBuilder.QuerySubstitutionNames.identifierQuoteCharacter.rawValue]
Expand All @@ -57,7 +57,7 @@ struct Utils {
}
return result
}

static func updateParameterNumbers(query: String, queryBuilder: QueryBuilder) -> String {
let marker = queryBuilder.substitutions[QueryBuilder.QuerySubstitutionNames.numberedParameter.rawValue]
if !queryBuilder.addNumbersToParameters {
Expand All @@ -68,7 +68,8 @@ struct Utils {
var range = inputQuery.range(of: Parameter.numberedParameterMarker)
var index = 1
while let _range = range {
resultQuery += inputQuery[..<_range.lowerBound] + marker + "\(index)"
resultQuery += inputQuery[..<_range.lowerBound] + marker
resultQuery += "\(index)"
inputQuery = String(inputQuery[_range.upperBound...])

index += 1
Expand All @@ -78,7 +79,7 @@ struct Utils {
resultQuery += inputQuery
return resultQuery
}

static func convertNamedParametersToNumbered(query: String, queryBuilder: QueryBuilder) -> (String, [String:[Int]], Int) {
var resultQuery = ""
var nameToNumber = [String:[Int]]()
Expand Down
Loading

0 comments on commit e6a4efa

Please sign in to comment.