Skip to content

stndrs/pg_value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg_value

test Package Version Hex Docs

import pg_value as value

pub fn main() -> Nil {
  let int4_type_info = get_type_info("int4")

  // Encode an integer as int4
  let assert Ok(encoded) = value.encode(value.int(10), int4_type_info)

  // Decode a bit array as an int4 into a dynamic value
  let assert Ok(int_dynamic) = value.decode(encoded, int4_type_info)

  // Create a list of `pg_value.Value`s
  let params = [value.int(10), value.null, value.text("text")]
}

Further documentation can be found at https://hexdocs.pm/pg_value.

Installation

gleam add pg_value

Development

gleam run   # Run the project
gleam test  # Run the tests

Acknowledgements

Much thanks to pg_types for encoding and decoding logic.

About

Postgres types in gleam

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages