Remove unused snappy compression package

This commit is contained in:
Tobie Morgan Hitchcock 2018-04-04 19:27:46 +01:00
parent 0dc9ad339c
commit 6c3ae600f8
3 changed files with 0 additions and 97 deletions

View file

@ -21,7 +21,6 @@ import:
- package: github.com/abcum/rixxdb
- package: github.com/asaskevich/govalidator
version: ^8.0.0
- package: github.com/cznic/zappy
- package: github.com/dgrijalva/jwt-go
version: ^3.1.0
- package: github.com/elithrar/simple-scrypt

View file

@ -1,39 +0,0 @@
// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package snap
import (
"github.com/cznic/zappy"
)
func Encode(src []byte) (dst []byte, err error) {
if len(src) == 0 {
return src, nil
}
return zappy.Encode(nil, src)
}
func Decode(src []byte) (dst []byte, err error) {
if len(src) == 0 {
return src, nil
}
return zappy.Decode(nil, src)
}

View file

@ -1,57 +0,0 @@
// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package snap
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestEmpty(t *testing.T) {
dec := []byte("")
enc := []byte{}
Convey("Encoding should fail", t, func() {
Convey("Should encode", func() {
res, _ := Encode(dec)
So(res, ShouldResemble, enc)
})
Convey("Should decode", func() {
res, _ := Decode(enc)
So(res, ShouldResemble, dec)
})
})
}
func TestEncoding(t *testing.T) {
dec := []byte("Hello World")
enc := []byte{11, 20, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100}
Convey("String should encode and decode", t, func() {
Convey("Should encode", func() {
res, _ := Encode(dec)
So(res, ShouldResemble, enc)
})
Convey("Should decode", func() {
res, _ := Decode(enc)
So(res, ShouldResemble, dec)
})
})
}