From 76538434cf13478c1e52d991f5d707430bdb6828 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Tue, 27 Aug 2019 21:13:45 -0500 Subject: [PATCH] MarshalJSON should be defined on T not *T Otherwise "%v" format would be used by json.Marshal(T). --- backend_key_data.go | 2 +- bind.go | 2 +- bind_complete.go | 2 +- close.go | 2 +- close_complete.go | 2 +- command_complete.go | 2 +- copy_both_response.go | 2 +- copy_data.go | 2 +- copy_done.go | 2 +- copy_fail.go | 2 +- copy_in_response.go | 2 +- copy_out_response.go | 2 +- data_row.go | 2 +- describe.go | 2 +- empty_query_response.go | 2 +- execute.go | 2 +- flush.go | 2 +- function_call_response.go | 2 +- no_data.go | 2 +- notification_response.go | 2 +- parameter_description.go | 2 +- parameter_status.go | 2 +- parse.go | 2 +- parse_complete.go | 2 +- password_message.go | 2 +- portal_suspended.go | 2 +- query.go | 2 +- ready_for_query.go | 2 +- row_description.go | 2 +- sasl_initial_response.go | 2 +- sasl_response.go | 2 +- startup_message.go | 2 +- sync.go | 2 +- terminate.go | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/backend_key_data.go b/backend_key_data.go index b775d689..ca20dd25 100644 --- a/backend_key_data.go +++ b/backend_key_data.go @@ -38,7 +38,7 @@ func (src *BackendKeyData) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *BackendKeyData) MarshalJSON() ([]byte, error) { +func (src BackendKeyData) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ProcessID uint32 diff --git a/bind.go b/bind.go index 67d20b5d..65b4c1d6 100644 --- a/bind.go +++ b/bind.go @@ -144,7 +144,7 @@ func (src *Bind) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Bind) MarshalJSON() ([]byte, error) { +func (src Bind) MarshalJSON() ([]byte, error) { formattedParameters := make([]map[string]string, len(src.Parameters)) for i, p := range src.Parameters { if p == nil { diff --git a/bind_complete.go b/bind_complete.go index fc9d317a..3be256c8 100644 --- a/bind_complete.go +++ b/bind_complete.go @@ -25,7 +25,7 @@ func (src *BindComplete) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *BindComplete) MarshalJSON() ([]byte, error) { +func (src BindComplete) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/close.go b/close.go index 349a319d..38296909 100644 --- a/close.go +++ b/close.go @@ -51,7 +51,7 @@ func (src *Close) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Close) MarshalJSON() ([]byte, error) { +func (src Close) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ObjectType string diff --git a/close_complete.go b/close_complete.go index b4982207..1d7b8f08 100644 --- a/close_complete.go +++ b/close_complete.go @@ -25,7 +25,7 @@ func (src *CloseComplete) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CloseComplete) MarshalJSON() ([]byte, error) { +func (src CloseComplete) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/command_complete.go b/command_complete.go index 87fcddf6..b5106fda 100644 --- a/command_complete.go +++ b/command_complete.go @@ -42,7 +42,7 @@ func (src *CommandComplete) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CommandComplete) MarshalJSON() ([]byte, error) { +func (src CommandComplete) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string CommandTag string diff --git a/copy_both_response.go b/copy_both_response.go index b037a197..2d58f820 100644 --- a/copy_both_response.go +++ b/copy_both_response.go @@ -59,7 +59,7 @@ func (src *CopyBothResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyBothResponse) MarshalJSON() ([]byte, error) { +func (src CopyBothResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ColumnFormatCodes []uint16 diff --git a/copy_data.go b/copy_data.go index 317710ac..7d6002fe 100644 --- a/copy_data.go +++ b/copy_data.go @@ -33,7 +33,7 @@ func (src *CopyData) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyData) MarshalJSON() ([]byte, error) { +func (src CopyData) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Data string diff --git a/copy_done.go b/copy_done.go index 7612350a..d8b6e5d7 100644 --- a/copy_done.go +++ b/copy_done.go @@ -26,7 +26,7 @@ func (src *CopyDone) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyDone) MarshalJSON() ([]byte, error) { +func (src CopyDone) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/copy_fail.go b/copy_fail.go index b12d7ba0..78ff0b30 100644 --- a/copy_fail.go +++ b/copy_fail.go @@ -42,7 +42,7 @@ func (src *CopyFail) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyFail) MarshalJSON() ([]byte, error) { +func (src CopyFail) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Message string diff --git a/copy_in_response.go b/copy_in_response.go index d28baa33..4439a032 100644 --- a/copy_in_response.go +++ b/copy_in_response.go @@ -59,7 +59,7 @@ func (src *CopyInResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyInResponse) MarshalJSON() ([]byte, error) { +func (src CopyInResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ColumnFormatCodes []uint16 diff --git a/copy_out_response.go b/copy_out_response.go index 1d3c2364..8538dfc7 100644 --- a/copy_out_response.go +++ b/copy_out_response.go @@ -60,7 +60,7 @@ func (src *CopyOutResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *CopyOutResponse) MarshalJSON() ([]byte, error) { +func (src CopyOutResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ColumnFormatCodes []uint16 diff --git a/data_row.go b/data_row.go index 9d6a9f1f..d908e7b2 100644 --- a/data_row.go +++ b/data_row.go @@ -85,7 +85,7 @@ func (src *DataRow) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *DataRow) MarshalJSON() ([]byte, error) { +func (src DataRow) MarshalJSON() ([]byte, error) { formattedValues := make([]map[string]string, len(src.Values)) for i, v := range src.Values { if v == nil { diff --git a/describe.go b/describe.go index d3fb5b09..308f582e 100644 --- a/describe.go +++ b/describe.go @@ -51,7 +51,7 @@ func (src *Describe) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Describe) MarshalJSON() ([]byte, error) { +func (src Describe) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ObjectType string diff --git a/empty_query_response.go b/empty_query_response.go index 1bec52e2..2b85e744 100644 --- a/empty_query_response.go +++ b/empty_query_response.go @@ -25,7 +25,7 @@ func (src *EmptyQueryResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *EmptyQueryResponse) MarshalJSON() ([]byte, error) { +func (src EmptyQueryResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/execute.go b/execute.go index 32269857..8bae6133 100644 --- a/execute.go +++ b/execute.go @@ -52,7 +52,7 @@ func (src *Execute) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Execute) MarshalJSON() ([]byte, error) { +func (src Execute) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Portal string diff --git a/flush.go b/flush.go index e7bc7e43..2725f689 100644 --- a/flush.go +++ b/flush.go @@ -25,7 +25,7 @@ func (src *Flush) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Flush) MarshalJSON() ([]byte, error) { +func (src Flush) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/function_call_response.go b/function_call_response.go index 72bb907c..5cc2d4d2 100644 --- a/function_call_response.go +++ b/function_call_response.go @@ -57,7 +57,7 @@ func (src *FunctionCallResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *FunctionCallResponse) MarshalJSON() ([]byte, error) { +func (src FunctionCallResponse) MarshalJSON() ([]byte, error) { var formattedValue map[string]string var hasNonPrintable bool for _, b := range src.Result { diff --git a/no_data.go b/no_data.go index 172d0dc1..d8f85d38 100644 --- a/no_data.go +++ b/no_data.go @@ -25,7 +25,7 @@ func (src *NoData) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *NoData) MarshalJSON() ([]byte, error) { +func (src NoData) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/notification_response.go b/notification_response.go index 33170f66..cd83c5ba 100644 --- a/notification_response.go +++ b/notification_response.go @@ -57,7 +57,7 @@ func (src *NotificationResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *NotificationResponse) MarshalJSON() ([]byte, error) { +func (src NotificationResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string PID uint32 diff --git a/parameter_description.go b/parameter_description.go index a43e802e..e28965c8 100644 --- a/parameter_description.go +++ b/parameter_description.go @@ -55,7 +55,7 @@ func (src *ParameterDescription) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *ParameterDescription) MarshalJSON() ([]byte, error) { +func (src ParameterDescription) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ParameterOIDs []uint32 diff --git a/parameter_status.go b/parameter_status.go index 4385fe99..c4021d92 100644 --- a/parameter_status.go +++ b/parameter_status.go @@ -53,7 +53,7 @@ func (src *ParameterStatus) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (ps *ParameterStatus) MarshalJSON() ([]byte, error) { +func (ps ParameterStatus) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Name string diff --git a/parse.go b/parse.go index d0bbf865..723885d4 100644 --- a/parse.go +++ b/parse.go @@ -73,7 +73,7 @@ func (src *Parse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Parse) MarshalJSON() ([]byte, error) { +func (src Parse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Name string diff --git a/parse_complete.go b/parse_complete.go index c2d3a34d..92c9498b 100644 --- a/parse_complete.go +++ b/parse_complete.go @@ -25,7 +25,7 @@ func (src *ParseComplete) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *ParseComplete) MarshalJSON() ([]byte, error) { +func (src ParseComplete) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/password_message.go b/password_message.go index b01316e9..4b68b31a 100644 --- a/password_message.go +++ b/password_message.go @@ -40,7 +40,7 @@ func (src *PasswordMessage) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *PasswordMessage) MarshalJSON() ([]byte, error) { +func (src PasswordMessage) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Password string diff --git a/portal_suspended.go b/portal_suspended.go index 5603d95e..1a9e7bfb 100644 --- a/portal_suspended.go +++ b/portal_suspended.go @@ -25,7 +25,7 @@ func (src *PortalSuspended) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *PortalSuspended) MarshalJSON() ([]byte, error) { +func (src PortalSuspended) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/query.go b/query.go index 17377dfb..41c93b4a 100644 --- a/query.go +++ b/query.go @@ -39,7 +39,7 @@ func (src *Query) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Query) MarshalJSON() ([]byte, error) { +func (src Query) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string String string diff --git a/ready_for_query.go b/ready_for_query.go index 65f7d8c1..879afe39 100644 --- a/ready_for_query.go +++ b/ready_for_query.go @@ -29,7 +29,7 @@ func (src *ReadyForQuery) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *ReadyForQuery) MarshalJSON() ([]byte, error) { +func (src ReadyForQuery) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string TxStatus string diff --git a/row_description.go b/row_description.go index 87479188..2745fa43 100644 --- a/row_description.go +++ b/row_description.go @@ -102,7 +102,7 @@ func (src *RowDescription) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *RowDescription) MarshalJSON() ([]byte, error) { +func (src RowDescription) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Fields []FieldDescription diff --git a/sasl_initial_response.go b/sasl_initial_response.go index b9459e16..0bf8a9e5 100644 --- a/sasl_initial_response.go +++ b/sasl_initial_response.go @@ -56,7 +56,7 @@ func (src *SASLInitialResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *SASLInitialResponse) MarshalJSON() ([]byte, error) { +func (src SASLInitialResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string AuthMechanism string diff --git a/sasl_response.go b/sasl_response.go index ef893437..21be6d75 100644 --- a/sasl_response.go +++ b/sasl_response.go @@ -32,7 +32,7 @@ func (src *SASLResponse) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *SASLResponse) MarshalJSON() ([]byte, error) { +func (src SASLResponse) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string Data string diff --git a/startup_message.go b/startup_message.go index d9f04d17..0c5c961d 100644 --- a/startup_message.go +++ b/startup_message.go @@ -89,7 +89,7 @@ func (src *StartupMessage) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *StartupMessage) MarshalJSON() ([]byte, error) { +func (src StartupMessage) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string ProtocolVersion uint32 diff --git a/sync.go b/sync.go index a058e8c9..5db8e07a 100644 --- a/sync.go +++ b/sync.go @@ -25,7 +25,7 @@ func (src *Sync) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Sync) MarshalJSON() ([]byte, error) { +func (src Sync) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{ diff --git a/terminate.go b/terminate.go index 6c9d5b1a..135191ea 100644 --- a/terminate.go +++ b/terminate.go @@ -25,7 +25,7 @@ func (src *Terminate) Encode(dst []byte) []byte { } // MarshalJSON implements encoding/json.Marshaler. -func (src *Terminate) MarshalJSON() ([]byte, error) { +func (src Terminate) MarshalJSON() ([]byte, error) { return json.Marshal(struct { Type string }{