PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/psql_constants.go

http://github.com/machinaut/go-play
Go | 62 lines | 49 code | 4 blank | 9 comment | 0 complexity | cddce798570eef502b16fb218659c2c4 MD5 | raw file
 1// This package has the values used by postgres
 2// Based off of the PostgreSQL 8.4.1 Documentation
 3// Chapter 45. Frontend/Backend Protocol
 4// http://www.postgresql.org/docs/8.4/interactive/protocol-message-formats.html
 5package psql_constants
 6
 7// MessageType specifies the type of message sent/recieved
 8// (B) indicates this is sent by the Postgres backend
 9// (F) indicated this is sent by the Postgres frontend
10// (F & B) indicates it can be sent by both
11type MessageType string
12
13const (
14    Authentication       = "R"; //(B) Specifies the type of authentication to use.
15    BackendKeyData       = "K"; //(B) Identifies the message as cancellation key data. Frontend must save these values in order to issue CancelRequest messages later.
16    Bind                 = "B"; //(F) Identifies the message as a Bind command.
17    BindComplete         = "2"; //(B) Identifies the message as a Bind-complete indicator.
18    Close                = "C"; //(F) Identifies the message as a Close command.
19    CloseComplete        = "3"; //(B) Identifies the message as a Close-complete indicator.
20    CommandComplete      = "C"; //(B) Identifies the message as a command-completed response.
21    CopyData             = "d"; //(F & B) Identifies the message as COPY data.
22    CopyDone             = "c"; //(F & B) Identifies the message as a COPY-complete indicator.
23    CopyFail             = "f"; //(F) Identifies the message as a COPY-failure indicator.
24    CopyInResponse       = "G"; //(B) Identifies the message as a Start Copy In response. Frontend must now send copy-in data (if not prepared to do so, send a CopyFail message).
25    CopyOutResponse      = "H"; //(B) Identifies the message as a Start Copy Out response. This message will be followed by copy-out data.
26    DataRow              = "D"; //(B) Identifies the message as a data row.
27    Describe             = "D"; //(F) Identifies the message as a Describe command.
28    EmptyQueryResponse   = "I"; //(B) Identifies the message as a response to an empty query string. (This substitutes for CommandComplete.)
29    ErrorResponse        = "E"; //(B) Identifies the message as an error.
30    Execute              = "E"; //(F) Identifies the message as an Execute command.
31    Flush                = "H"; //(F) Identifies the message as a Flush command.
32    FunctionCall         = "F"; //(F) Identifies the message as a function call.
33    FunctionCallResponse = "V"; //(B) Identifies the message as a function call result.
34    NoData               = "n"; //(B) Identifies the message as a no-data indicator.
35    NoticeResponse       = "N"; //(B) Identifies the message as a notice.
36    NotificationResponse = "A"; //(B) Identifies the message as a notification response.
37    ParameterDescription = "t"; //(B) Identifies the message as a parameter description.
38    ParameterStatus      = "S"; //(B) Identifies the message as a run-time parameter status report.
39    Parse                = "P"; //(F) Identifies the message as a Parse command.
40    ParseComplete        = "1"; //(B) Identifies the message as a Parse-complete indicator.
41    PasswordMessage      = "p"; //(F) Identifies the message as a password response. Note that this is also used for GSSAPI and SSPI response messages (which is really a design error, since the contained data is not a null-terminated string in that case, but can be arbitrary binary data).
42    PortalSuspended      = "s"; //(B) Identifies the message as a portal-suspended indicator. Note this only appears if an Execute message's row-count limit was reached.
43    Query                = "Q"; //(F) Identifies the message as a simple query.
44    ReadyForQuery        = "Z"; //(B) Identifies the message type. ReadyForQuery is sent whenever the backend is ready for a new query cycle.
45    RowDescription       = "T"; //(B) Identifies the message as a row description.
46    Sync                 = "S"; //(F) Identifies the message as a Sync command.
47    Terminate            = "X"; //(F) Identifies the message as a termination.
48)
49
50// AuthenticationType specifies the type of authentication to use
51type AuthenticationType int
52
53const (
54    AuthenticationOK                = 0; //Specifies that the authentication was successful.
55    AuthenticationKerberosV5        = 2; //Specifies that Kerberos V5 authentication is required.
56    AuthenticationCleartextPassword = 3; //Specifies that a clear-text password is required.
57    AuthenticationMD5Password       = 5; //Specifies that an MD5-encrypted password is required.
58    AuthenticationSCMCredential     = 6; //Specifies that an SCM credentials message is required.
59    AuthenticationGSS               = 7; //Specifies that GSSAPI authentication is required.
60    AuthenticationGSSContinue       = 8; //Specifies that this message contains GSSAPI or SSPI data.
61    AuthenticationSSPI              = 9; //Specifies that SSPI authentication is required.
62)