#lang scheme/base
(require scheme/class
scheme/contract)
(require "../generic/connection.ss"
"../generic/database.ss"
"database.ss")
(define (make-database
#:server [server "localhost"]
#:port [port 5432]
#:database database
#:username username
#:password [password #f]
#:ssl [ssl 'optional]
#:ssl-encrypt [ssl-encrypt 'sslv2-or-v3])
(new database%
[server server]
[port port]
[database database]
[username username]
[password password]
[ssl ssl]
[ssl-encrypt ssl-encrypt]))
(define ssl/c
(symbols 'yes 'no 'optional))
(define ssl-encrypt/c
(symbols 'sslv2-or-v3 'sslv2 'sslv3 'tls))
(provide (struct-out connection)
database%)
(provide/contract
[make-database (->* (#:database string? #:username string?)
(#:server string? #:port integer? #:password (or/c string? false/c) #:ssl ssl/c #:ssl-encrypt ssl-encrypt/c)
(is-a?/c database<%>))])