1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

added async_pg example

This commit is contained in:
dowwie
2020-01-15 19:19:15 -05:00
parent 94892d992d
commit e0c8f4533e
9 changed files with 185 additions and 0 deletions

View File

@ -0,0 +1,3 @@
INSERT INTO testing.users(email, first_name, last_name, username)
VALUES ($1, $2, $3, $4)
RETURNING $table_fields;

3
async_pg/sql/create_db.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
psql -U postgres -h 127.0.0.1 -f setup_db_and_user.sql

View File

@ -0,0 +1 @@
SELECT $table_fields FROM testing.users;

View File

@ -0,0 +1,20 @@
DROP DATABASE IF EXISTS testing_db;
CREATE USER test_user WITH PASSWORD 'testing';
CREATE DATABASE testing_db OWNER test_user;
\connect testing_db;
DROP SCHEMA IF EXISTS testing CASCADE;
CREATE SCHEMA testing;
CREATE TABLE testing.users (
id BIGSERIAL PRIMARY KEY,
email VARCHAR(200) NOT NULL,
first_name VARCHAR(200) NOT NULL,
last_name VARCHAR(200) NOT NULL,
username VARCHAR(50) UNIQUE NOT NULL,
UNIQUE (username)
);