/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
  5. package psql_constants
  6. // MessageType specifies the type of message sent/recieved
  7. // (B) indicates this is sent by the Postgres backend
  8. // (F) indicated this is sent by the Postgres frontend
  9. // (F & B) indicates it can be sent by both
  10. type MessageType string
  11. const (
  12. Authentication = "R"; //(B) Specifies the type of authentication to use.
  13. BackendKeyData = "K"; //(B) Identifies the message as cancellation key data. Frontend must save these values in order to issue CancelRequest messages later.
  14. Bind = "B"; //(F) Identifies the message as a Bind command.
  15. BindComplete = "2"; //(B) Identifies the message as a Bind-complete indicator.
  16. Close = "C"; //(F) Identifies the message as a Close command.
  17. CloseComplete = "3"; //(B) Identifies the message as a Close-complete indicator.
  18. CommandComplete = "C"; //(B) Identifies the message as a command-completed response.
  19. CopyData = "d"; //(F & B) Identifies the message as COPY data.
  20. CopyDone = "c"; //(F & B) Identifies the message as a COPY-complete indicator.
  21. CopyFail = "f"; //(F) Identifies the message as a COPY-failure indicator.
  22. 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).
  23. CopyOutResponse = "H"; //(B) Identifies the message as a Start Copy Out response. This message will be followed by copy-out data.
  24. DataRow = "D"; //(B) Identifies the message as a data row.
  25. Describe = "D"; //(F) Identifies the message as a Describe command.
  26. EmptyQueryResponse = "I"; //(B) Identifies the message as a response to an empty query string. (This substitutes for CommandComplete.)
  27. ErrorResponse = "E"; //(B) Identifies the message as an error.
  28. Execute = "E"; //(F) Identifies the message as an Execute command.
  29. Flush = "H"; //(F) Identifies the message as a Flush command.
  30. FunctionCall = "F"; //(F) Identifies the message as a function call.
  31. FunctionCallResponse = "V"; //(B) Identifies the message as a function call result.
  32. NoData = "n"; //(B) Identifies the message as a no-data indicator.
  33. NoticeResponse = "N"; //(B) Identifies the message as a notice.
  34. NotificationResponse = "A"; //(B) Identifies the message as a notification response.
  35. ParameterDescription = "t"; //(B) Identifies the message as a parameter description.
  36. ParameterStatus = "S"; //(B) Identifies the message as a run-time parameter status report.
  37. Parse = "P"; //(F) Identifies the message as a Parse command.
  38. ParseComplete = "1"; //(B) Identifies the message as a Parse-complete indicator.
  39. 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).
  40. 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.
  41. Query = "Q"; //(F) Identifies the message as a simple query.
  42. ReadyForQuery = "Z"; //(B) Identifies the message type. ReadyForQuery is sent whenever the backend is ready for a new query cycle.
  43. RowDescription = "T"; //(B) Identifies the message as a row description.
  44. Sync = "S"; //(F) Identifies the message as a Sync command.
  45. Terminate = "X"; //(F) Identifies the message as a termination.
  46. )
  47. // AuthenticationType specifies the type of authentication to use
  48. type AuthenticationType int
  49. const (
  50. AuthenticationOK = 0; //Specifies that the authentication was successful.
  51. AuthenticationKerberosV5 = 2; //Specifies that Kerberos V5 authentication is required.
  52. AuthenticationCleartextPassword = 3; //Specifies that a clear-text password is required.
  53. AuthenticationMD5Password = 5; //Specifies that an MD5-encrypted password is required.
  54. AuthenticationSCMCredential = 6; //Specifies that an SCM credentials message is required.
  55. AuthenticationGSS = 7; //Specifies that GSSAPI authentication is required.
  56. AuthenticationGSSContinue = 8; //Specifies that this message contains GSSAPI or SSPI data.
  57. AuthenticationSSPI = 9; //Specifies that SSPI authentication is required.
  58. )