# @pimeys/connection-string

> A parser for ADO.net and JDBC connection strings

Latest version **0.1.14** (published 2022-02-04) · MIT OR Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @pimeys/connection-string
pnpm add @pimeys/connection-string
yarn add @pimeys/connection-string
bun add @pimeys/connection-string
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.14 |
| Published | 2022-02-04 |
| First published | 2020-12-07 |
| Weekly downloads | 0 |
| License | MIT OR Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 117.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Prisma |
| Maintainers | pimeys |

## Links

- npm: https://www.npmjs.com/package/@pimeys/connection-string
- Repository: https://github.com/prisma/connection-string
- Issues: https://github.com/prisma/connection-string/issues
- npm.io page: https://npm.io/package/@pimeys/connection-string

## Recent versions

- 0.1.14 (latest) — 2022-02-04
- 0.1.12 — 2021-01-25
- 0.1.11 — 2021-01-05
- 0.1.10 — 2020-12-07

## README

<h1 align="center">connection-string</h1>
<div align="center">
  <strong>
    Connection string parsing in Rust
  </strong>
</div>

<br />

<div align="center">
  <!-- Crates version -->
  <a href="https://crates.io/crates/connection-string">
    <img src="https://img.shields.io/crates/v/connection-string.svg?style=flat-square"
    alt="Crates.io version" />
  </a>
  <!-- Downloads -->
  <a href="https://crates.io/crates/connection-string">
    <img src="https://img.shields.io/crates/d/connection-string.svg?style=flat-square"
      alt="Download" />
  </a>
  <!-- docs.rs docs -->
  <a href="https://docs.rs/connection-string">
    <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
      alt="docs.rs docs" />
  </a>
</div>

<div align="center">
  <h3>
    <a href="https://docs.rs/connection-string">
      API Docs
    </a>
    <span> | </span>
    <a href="https://github.com/prisma/connection-string/releases">
      Releases
    </a>
    <span> | </span>
    <a href="https://github.com/prisma/connection-string/blob/main.github/CONTRIBUTING.md">
      Contributing
    </a>
  </h3>
</div>

## Installation for Rust
```sh
$ cargo add connection-string
```

## Usage for JavaScript
The crate is available in npm as `@pimeys/connection-string`. Usage patters try
to follow the Rust version as close as possible. Please see the [Rust
docs](https://docs.rs/connection-string) for more information.

JDBC:

``` javascript
const j = new JdbcString("jdbc:sqlserver://localhost\\INSTANCE:1433;database=master;user=SA;password={my_password;123}");

console.log(j.server_name()); // "localhost"
console.log(j.port()); // 1433
console.log(j.instance_name()); // "INSTANCE"
console.log(j.get("database")); // "master"
console.log(j.get("password")); // "my_password;123" (see escaping)
console.log(j.keys()); // ["database", "user", "password"]
console.log(j.set("password", "a;;new;;password")); // "my_password;123" (returns the old value, if available)

// "jdbc:sqlserver://localhost\INSTANCE:1433;user=SA;database=master;password=a{;;}new{;;}password"
console.log(j.to_string())
```

ADO.net:

``` javascript
const a = new AdoNetString("server=tcp:localhost,1433;user=SA;password=a{;;}new{;;}password");

console.log(a.get("password")); // a;;new;;password
console.log(a.set("user", "john")); // "SA" (returns the old value, if available)

// "server=tcp:localhost,1433;user=john;password=a{;;}new{;;}password"
console.log(j.to_string())
```

## Safety
This crate uses ``#![deny(unsafe_code)]`` to ensure everything is implemented in
100% Safe Rust.

## Contributing
Want to join us? Check out our ["Contributing" guide][contributing] and take a
look at some of these issues:

- [Issues labeled "good first issue"][good-first-issue]
- [Issues labeled "help wanted"][help-wanted]

[contributing]: https://github.com/prisma/connection-string/blob/master.github/CONTRIBUTING.md
[good-first-issue]: https://github.com/prisma/connection-string/labels/good%20first%20issue
[help-wanted]: https://github.com/prisma/connection-string/labels/help%20wanted

## License

<sup>
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>

<br/>

<sub>
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.
</sub>

---
_Source: https://npm.io/package/@pimeys/connection-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
