forked from viant/toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object.go
35 lines (30 loc) · 760 Bytes
/
object.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package scp
import (
"github.com/viant/toolbox/storage"
"os"
)
type object struct {
*storage.AbstractObject
source interface{}
permission string
}
//Wrap wraps source storage object
func (i *object) Wrap(source interface{}) {
i.source = source
}
//Unwrap unwraps source storage object into provided target.
func (i *object) Unwrap(target interface{}) error {
if result, ok := target.(**object); ok {
*result = i
}
return nil
}
//newObject creates a new gc storage object
func newStorageObject(URL string, source interface{}, fileInfo os.FileInfo) storage.Object {
abstract := storage.NewAbstractStorageObject(URL, source, fileInfo)
result := &object{
AbstractObject: abstract,
}
result.AbstractObject.Object = result
return result
}