Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jackc/pgmock

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jackc/pgmock

  • v0.0.0-20230307004727-75151f31e7bc
  • Source
  • Go
  • Socket score

Version published
Created
Source

pgmock

pgmock provides the ability to mock a PostgreSQL server.

See pgmock_test.go for example usage.

pgmockproxy

pgmockproxy is a PostgreSQL proxy that logs the messages back and forth between the PostgreSQL client and server. This can aid in building a mocking script by running commands against a real server to observe the results. It can also be used to debug applications that speak the PostgreSQL wire protocol without needing to use a tool like Wireshark.

Example usage:

$ pgmockproxy -remote "/private/tmp/.s.PGSQL.5432"
F {"Type":"StartupMessage","ProtocolVersion":196608,"Parameters":{"application_name":"psql","client_encoding":"UTF8","database":"jack","user":"jack"}}
B {"Type":0,"Salt":[0,0,0,0],"SASLAuthMechanisms":null,"SASLData":null}
B {"Type":"ParameterStatus","Name":"application_name","Value":"psql"}
B {"Type":"ParameterStatus","Name":"client_encoding","Value":"UTF8"}
B {"Type":"ParameterStatus","Name":"DateStyle","Value":"ISO, MDY"}
B {"Type":"ParameterStatus","Name":"integer_datetimes","Value":"on"}
B {"Type":"ParameterStatus","Name":"IntervalStyle","Value":"postgres"}
B {"Type":"ParameterStatus","Name":"is_superuser","Value":"on"}
B {"Type":"ParameterStatus","Name":"server_encoding","Value":"UTF8"}
B {"Type":"ParameterStatus","Name":"server_version","Value":"11.5"}
B {"Type":"ParameterStatus","Name":"session_authorization","Value":"jack"}
B {"Type":"ParameterStatus","Name":"standard_conforming_strings","Value":"on"}
B {"Type":"ParameterStatus","Name":"TimeZone","Value":"US/Central"}
B {"Type":"BackendKeyData","ProcessID":31007,"SecretKey":1013083042}
B {"Type":"ReadyForQuery","TxStatus":"I"}
F {"Type":"Query","String":"select generate_series(1,5);"}
B {"Type":"RowDescription","Fields":[{"Name":"generate_series","TableOID":0,"TableAttributeNumber":0,"DataTypeOID":23,"DataTypeSize":4,"TypeModifier":-1,"Format":0}]}
B {"Type":"DataRow","Values":[{"text":"1"}]}
B {"Type":"DataRow","Values":[{"text":"2"}]}
B {"Type":"DataRow","Values":[{"text":"3"}]}
B {"Type":"DataRow","Values":[{"text":"4"}]}
B {"Type":"DataRow","Values":[{"text":"5"}]}
B {"Type":"CommandComplete","CommandTag":"SELECT 5"}
B {"Type":"ReadyForQuery","TxStatus":"I"}
F {"Type":"Terminate"}

FAQs

Package last updated on 07 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc