postgres-service

Crates.iopostgres-service
lib.rspostgres-service
version0.19.4
sourcesrc
created_at2017-04-21 19:59:32.169216
updated_at2024-02-20 18:01:13.453402
descriptionParse Postgres service configuration files
homepage
repositoryhttps://github.com/njaard/postgres-service
max_upload_size
id11460
size6,446
project-freta (github:microsoft:project-freta)

documentation

https://github.com/njaard/postgres-service/blob/master/Readme.md

README

Introduction

If you use postgres's service feature for configuring your connections, then this is the library for you.

This is for use with the Postgres crate.

Features

  • supports tokio-postgres (New in 0.19.2)
  • ... and regular postgres
  • search in ~/.pg_service.conf, $PGSYSCONFDIR/pg_service.conf, and /etc/postgresql-common/pg_service.conf
  • Simply generates a postgres::Config

Example

This example uses the service name mydb and overrides the user value, then makes the connection.

let conn = postgres_service::load_connect_params("mydb")
	.expect("unable to find configuration")
	.user("your_user_name")
	.connect(postgres::NoTls)
	.expect("unable to connect");
Commit count: 13

cargo fmt