Initial cloud-services repo - gateway service + pkg modules
This commit is contained in:
48
pkg/db/queries/mocks/filekeys.go
Normal file
48
pkg/db/queries/mocks/filekeys.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"fiskerinc.com/modules/common"
|
||||
"fiskerinc.com/modules/validator"
|
||||
|
||||
"github.com/go-pg/pg/v10/orm"
|
||||
)
|
||||
|
||||
type MockFileKeys struct {
|
||||
GetResponse *common.FileKey
|
||||
GetMultiResponse []common.FileKey
|
||||
DBMockHelper
|
||||
}
|
||||
|
||||
func (fk *MockFileKeys) Delete(fileID string) (orm.Result, error) {
|
||||
if fileID == "" {
|
||||
return nil, &validator.FieldError{
|
||||
ErrorMsg: "FileID required",
|
||||
}
|
||||
}
|
||||
|
||||
return fk.ORMResponse, fk.Error
|
||||
}
|
||||
|
||||
func (fk *MockFileKeys) Insert(filekey common.FileKey) (orm.Result, error) {
|
||||
err := validator.ValidateStruct(filekey)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return fk.ORMResponse, fk.Error
|
||||
}
|
||||
|
||||
func (fk *MockFileKeys) Get(fileID string) (*common.FileKey, error) {
|
||||
if fileID == "" {
|
||||
return nil, &validator.FieldError{
|
||||
ErrorMsg: "FileID required",
|
||||
}
|
||||
}
|
||||
|
||||
return fk.GetResponse, fk.Error
|
||||
}
|
||||
|
||||
func (fk *MockFileKeys) GetMulti(fileIDs []string) ([]common.FileKey, error) {
|
||||
return fk.GetMultiResponse, fk.Error
|
||||
}
|
||||
Reference in New Issue
Block a user