Skip to content

Commit

Permalink
feat: update qor to casdoor (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
leo220yuyaodog authored May 3, 2022
1 parent 506fb36 commit 515bf5e
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 37 deletions.
2 changes: 1 addition & 1 deletion aliyun/aliyun.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"time"

aliyun "github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/qor/oss"
"github.com/casdoor/oss"
)

// Client Aliyun storage
Expand Down
4 changes: 2 additions & 2 deletions aliyun/aliyun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"

aliyunoss "github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/casdoor/oss/aliyun"
"github.com/casdoor/oss/tests"
"github.com/jinzhu/configor"
"github.com/qor/oss/aliyun"
"github.com/qor/oss/tests"
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion azureblob/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"time"

"github.com/Azure/azure-storage-blob-go/azblob"
"github.com/qor/oss"
"github.com/casdoor/oss"
)

// Client azure blob storage
Expand Down
2 changes: 1 addition & 1 deletion azureblob/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"io/ioutil"
"testing"

"github.com/qor/oss/tests"
"github.com/casdoor/oss/tests"
)

var client *Client
Expand Down
2 changes: 1 addition & 1 deletion filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"

"github.com/qor/oss"
"github.com/casdoor/oss"
)

// FileSystem file system storage
Expand Down
2 changes: 1 addition & 1 deletion filesystem/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filesystem
import (
"testing"

"github.com/qor/oss/tests"
"github.com/casdoor/oss/tests"
)

func TestAll(t *testing.T) {
Expand Down
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible
github.com/aws/aws-sdk-go v1.44.4
github.com/jinzhu/configor v1.2.1
github.com/qor/oss v0.0.0-20210412121326-3c5583a62015
github.com/qiniu/go-sdk/v7 v7.12.1
)

require (
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
Expand Down
6 changes: 3 additions & 3 deletions qiniu/qiniu.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"strings"
"time"

"github.com/qiniu/api.v7/auth/qbox"
"github.com/qiniu/api.v7/storage"
"github.com/qor/oss"
"github.com/casdoor/oss"
"github.com/qiniu/go-sdk/v7/auth/qbox"
"github.com/qiniu/go-sdk/v7/storage"
)

// Client Qiniu storage
Expand Down
4 changes: 2 additions & 2 deletions qiniu/qiniu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package qiniu_test
import (
"testing"

"github.com/casdoor/oss/qiniu"
"github.com/casdoor/oss/tests"
"github.com/jinzhu/configor"
"github.com/qor/oss/qiniu"
"github.com/qor/oss/tests"
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/qor/oss"
"github.com/casdoor/oss"
)

// Client S3 storage
Expand Down
6 changes: 3 additions & 3 deletions s3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"

awss3 "github.com/aws/aws-sdk-go/service/s3"
"github.com/casdoor/oss/s3"
"github.com/casdoor/oss/tests"
"github.com/jinzhu/configor"
"github.com/qor/oss/s3"
"github.com/qor/oss/tests"
)

type Config struct {
Expand Down Expand Up @@ -48,7 +48,7 @@ func TestToRelativePath(t *testing.T) {
"https://qor-example.com/myobject.ext": "/myobject.ext",
"//mybucket.s3.amazonaws.com/myobject.ext": "/myobject.ext",
"http://mybucket.s3.amazonaws.com/myobject.ext": "/myobject.ext",
"myobject.ext": "/myobject.ext",
"myobject.ext": "/myobject.ext",
}

for url, path := range urlMap {
Expand Down
19 changes: 10 additions & 9 deletions tencent/tencent.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package tencent

import (
"os"
"github.com/qor/oss"
"io"
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"time"
"errors"
"strings"
"bytes"
"regexp"
"net/url"
"strings"
"time"

"github.com/casdoor/oss"
)

var _ oss.StorageInterface = (*Client)(nil)
Expand Down Expand Up @@ -73,7 +74,7 @@ func (client Client) GetStream(path string) (io.ReadCloser, error) {
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil,errors.New("get file fail")
return nil, errors.New("get file fail")
}
return resp.Body, nil
}
Expand Down
11 changes: 5 additions & 6 deletions tencent/tencent_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package tencent

import (
"testing"
"bytes"
"io/ioutil"
"fmt"
"github.com/qor/oss/tests"
"io/ioutil"
"testing"

"github.com/casdoor/oss/tests"
)

func TestClient_Get(t *testing.T) {
Expand All @@ -26,7 +27,6 @@ func init() {
})
}


func TestClient_Put(t *testing.T) {
f, err := ioutil.ReadFile("/home/owen/Downloads/2.png")
if err != nil {
Expand All @@ -37,9 +37,8 @@ func TestClient_Put(t *testing.T) {
client.Put("test.png", bytes.NewReader(f))
}


func TestClient_Put2(t *testing.T) {
tests.TestAll(client,t)
tests.TestAll(client, t)
}

func TestClient_Delete(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/qor/oss"
"github.com/casdoor/oss"
)

func TestAll(storage oss.StorageInterface, t *testing.T) {
Expand Down

0 comments on commit 515bf5e

Please sign in to comment.