Giter Site home page Giter Site logo

rust-postgres-array's Introduction

rust-postgres-array's People

Contributors

benesch avatar jkosh44 avatar jonhoo avatar plafue avatar sfackler avatar zr40 avatar zsiciarz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rust-postgres-array's Issues

not working with latest rust

postgres_array-0.1.1/src/impls/mod.rs:13:8: 13:21 error: `$expected:pat` is followed by `|`, which is not allowed for `pat` fragments
postgres_array-0.1.1/src/impls/mod.rs:13     ($($expected:pat)|+, $actual:ident) => (

postgres_array-0.1.1/src/impls/mod.rs:22:8: 22:16 error: `$oid:pat` is followed by `|`, which is not allowed for `pat` fragments
postgres_array-0.1.1/src/impls/mod.rs:22     ($($oid:pat)|+, $t:ty) => {

postgres_array-0.1.1/src/impls/mod.rs:48:8: 48:16 error: `$oid:pat` is followed by `|`, which is not allowed for `pat` fragments
postgres_array-0.1.1/src/impls/mod.rs:48     ($($oid:pat)|+, $t:ty) => {

Empty rows

I think the following behaviour is unintended.

let _ = conn.execute("ALTER TABLE table ADD COLUMN column int4[] DEFAULT '{}'",&[]);
let stmt = conn.prepare("SELECT column FROM table").unwrap();
for row in stmt.query(&[]).unwrap() {
     //row.result_descriptions() is &[(column, Int4Array)]
    let _:ArrayBase<Option<i32>> =row.get(0u); // panics at error retrieving column 0: end of file', src/lib.rs:1552
}

Array of Uuid Values

Seemingly this does not currently support an array of Uuid values is that correct?

Usage documentation

Please write a couple of lines of documentation & examples, it's not very clear how to use the library.

How to parse from string?

Is there a way to use this crate to parse the string result back into an array of values?

I'm currently using the sqlparser crate to do it but wondering if there is an easier way.

fn hs_decode(val: &str) -> Option<HashSet<String>> {
    let ast = sqlparser::tokenizer::Tokenizer::new(&GenericDialect, val)
        .tokenize()
        .ok()?;

    let results = sqlparser::parser::Parser::new(ast, &GenericDialect)
        .parse_identifiers()
        .ok()?;

    Some(results.iter().map(|x| x.value.clone()).collect())
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.