...
1 package sqlcon
2
3
4 func HelpMessage() string {
5 return `- DATABASE_URL: A DSN to a persistent backend. Various backends are supported:
6
7 - Changes are lost on process death (ephemeral storage):
8
9 - Memory: If DATABASE_URL is "memory", data will be written to memory and is lost when you restart this instance.
10 Example: DATABASE_URL=memory
11
12 - Changes are kept after process death (persistent storage):
13
14 - SQL Databases: Officially, PostgreSQL, MySQL and CockroachDB are supported. This project works best with PostgreSQL.
15
16 - PostgreSQL: If DATABASE_URL is a DSN starting with postgres://, PostgreSQL will be used as storage backend.
17 Example: DATABASE_URL=postgres://user:password@host:123/database
18
19 Additionally, the following query/DSN parameters are supported:
20
21 * max_conns (number): Sets the maximum number of open connections to the database. Defaults to the number of CPU cores times 2.
22 * max_idle_conns (number): Sets the maximum number of connections in the idle. Defaults to the number of CPU cores.
23 * max_conn_lifetime (duratino): Sets the maximum amount of time ("ms", "s", "m", "h") a connection may be reused.
24 Defaults to 0s (disabled).
25 * sslmode (string): Whether or not to use SSL (default is require)
26 * disable - No SSL
27 * require - Always SSL (skip verification)
28 * verify-ca - Always SSL (verify that the certificate presented by the
29 server was signed by a trusted CA)
30 * verify-full - Always SSL (verify that the certification presented by
31 the server was signed by a trusted CA and the server host name
32 matches the one in the certificate)
33 * fallback_application_name (string): An application_name to fall back to if one isn't provided.
34 * connect_timeout (number): Maximum wait for connection, in seconds. Zero or
35 not specified means wait indefinitely.
36 * sslcert (string): Cert file location. The file must contain PEM encoded data.
37 * sslkey (string): Key file location. The file must contain PEM encoded data.
38 * sslrootcert (string): The location of the root certificate file. The file
39 must contain PEM encoded data.
40 Example: DATABASE_URL=postgres://user:password@host:123/database?sslmode=verify-full
41
42 - MySQL: If DATABASE_URL is a DSN starting with mysql:// MySQL will be used as storage backend.
43 Be aware that the ?parseTime=true parameter is mandatory, or timestamps will not work.
44 Example: DATABASE_URL=mysql://user:password@tcp(host:123)/database?parseTime=true
45
46 Additionally, the following query/DSN parameters are supported:
47 * collation (string): Sets the collation used for client-server interaction on connection. In contrast to charset,
48 collation does not issue additional queries. If the specified collation is unavailable on the target server,
49 the connection will fail.
50 * loc (string): Sets the location for time.Time values. Note that this sets the location for time.Time values
51 but does not change MySQL's time_zone setting. For that set the time_zone DSN parameter. Please keep in mind,
52 that param values must be url.QueryEscape'ed. Alternatively you can manually replace the / with %2F.
53 For example US/Pacific would be loc=US%2FPacific.
54 * maxAllowedPacket (number): Max packet size allowed in bytes. The default value is 4 MiB and should be
55 adjusted to match the server settings. maxAllowedPacket=0 can be used to automatically fetch the max_allowed_packet variable from server on every connection.
56 * readTimeout (duration): I/O read timeout. The value must be a decimal number with a unit suffix
57 ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s".
58 * timeout (duration): Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix
59 ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s".
60 * tls (bool / string): tls=true enables TLS / SSL encrypted connection to the server. Use skip-verify if
61 you want to use a self-signed or invalid certificate (server side).
62 * writeTimeout (duration): I/O write timeout. The value must be a decimal number with a unit suffix
63 ("ms", "s", "m", "h"), such as "30s", "0.5m" or "1m30s".
64 Example: DATABASE_URL=mysql://user:password@tcp(host:123)/database?parseTime=true&writeTimeout=123s
65
66 - CockroachDB: If DATABASE_URL is a DSN starting with cockroach://, CockroachDB will be used as storage backend.
67 Example: DATABASE_URL=cockroach://user:password@host:123/database
68
69 Additionally, the following query/DSN parameters are supported:
70 * sslmode (string): Whether or not to use SSL (default is require)
71 * disable - No SSL
72 * require - Always SSL (skip verification)
73 * verify-ca - Always SSL (verify that the certificate presented by the
74 server was signed by a trusted CA)
75 * verify-full - Always SSL (verify that the certification presented by
76 the server was signed by a trusted CA and the server host name
77 matches the one in the certificate)
78 * application_name (string): An initial value for the application_name session variable.
79 * sslcert (string): Cert file location. The file must contain PEM encoded data.
80 * sslkey (string): Key file location. The file must contain PEM encoded data.
81 * sslrootcert (string): The location of the root certificate file. The file
82 must contain PEM encoded data.
83 Example: DATABASE_URL=cockroach://user:password@host:123/database?sslmode=verify-full`
84 }
85
View as plain text