Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Chaves authored Oct 2, 2018
1 parent b41f18d commit c85d842
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Include jupitern/table in your project, by adding it to your composer.json file.
}
```

## Changelog

### v1.4.4
replaced pear package http_request2 by guzzle
added method to provide guzzle configuration

### v1.3.0
added support for parameterized queries


## Note

this package adds funccionalities to the package bellow so all funccionalities provided in base package are also available
Expand All @@ -22,35 +32,37 @@ https://github.com/cocteau666/AzureDocumentDB-PHP

```php

$conn = app()->resolve('DocDB');
$conn = new AzureCosmosDb('uri', 'key');
$conn->setHttpClientOptions(['verify' => false]);
$db = $conn->selectDB('database_name');

// insert a record
$rid = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->save(['id' => '1', 'name' => 'John Doe', 'age' => 22]);

echo "record inserted: $rid";

// insert a record
$rid = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->save(['id' => '2', 'name' => 'Jane doe', 'age' => 35]);

echo "record inserted: $rid";

// update a record
$res = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->save(["_rid" => $rid, 'id' => '2', 'name' => 'Jane Doe Something', 'age' => 36]);

echo "record updated: $rid";

// get one row as array
$res = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->select("Users.id, Users.name")
->where("Users.age > @age")
Expand All @@ -62,7 +74,7 @@ var_dump($res);

// get 5 rows as array
$res = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->select("Users.id, Users.username")
->where("Users.age > 20")
Expand All @@ -74,7 +86,7 @@ var_dump($res);

// delete one document that match criteria
$res = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->where("Users.age > 30")
->delete();
Expand All @@ -83,7 +95,7 @@ var_dump($res);

// delete all documents that match criteria
$res = \Jupitern\CosmosDb\QueryBuilder::instance()
->setConnection($conn)
->setConnection($db)
->collection("Users")
->where("Users.age > 20")
->deleteAll();
Expand Down

0 comments on commit c85d842

Please sign in to comment.