• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

codenotary / immudb / 6783902372

07 Nov 2023 11:34AM UTC coverage: 89.548% (-0.02%) from 89.571%
6783902372

push

gh-ci

jeroiraz
test(pkg/pgsql): unit testing for deallocate stmt

Signed-off-by: Jeronimo Irazabal <jeronimo.irazabal@gmail.com>

33645 of 37572 relevant lines covered (89.55%)

146027.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/pkg/pgsql/server/bmessages/error_response.go
1
/*
2
Copyright 2022 Codenotary Inc. All rights reserved.
3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
        http//www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
package bmessages
18

19
import (
20
        "bytes"
21
        "encoding/binary"
22
        "fmt"
23
)
24

25
type errorResp struct {
26
        fields map[byte]string
27
}
28

29
type ErrorResp interface {
30
        Encode() []byte
31
        ToString() string
32
}
33

34
func ErrorResponse(setters ...Option) *errorResp {
31✔
35
        er := &errorResp{
31✔
36
                fields: make(map[byte]string),
31✔
37
        }
31✔
38
        for _, setter := range setters {
130✔
39
                setter(er)
99✔
40
        }
99✔
41

42
        return er
31✔
43
}
44

45
//Encode encode in binary
46
func (er *errorResp) Encode() []byte {
25✔
47
        messageType := []byte(`E`)
25✔
48
        messageLength := make([]byte, 4)
25✔
49
        body := make([]byte, 0)
25✔
50
        for code, value := range er.fields {
89✔
51
                body = append(body, bytes.Join([][]byte{{code}, []byte(value), {0}}, nil)...)
64✔
52
        }
64✔
53

54
        binary.BigEndian.PutUint32(messageLength, uint32(len(body)+4+1))
25✔
55

25✔
56
        return bytes.Join([][]byte{messageType, messageLength, body, {0}}, nil)
25✔
57
}
58

59
func (er *errorResp) ToString() string {
×
60
        return fmt.Sprintf("Map: %v", er.fields)
×
61
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc