package webfilesystem import ( "github.com/mitchellh/mapstructure" "go.mongodb.org/mongo-driver/bson/primitive" ) type DirectoryData struct { Parent primitive.ObjectID `bson:"parent"` Children []primitive.ObjectID `bson:"children"` } // type Directory struct { // Header Header `bson:"header"` // Data DirectoryData `bson:"data"` // } // func (d *Directory) Get() interface{} { // return d // } func castToFile(raw *interface{}) *WebFSFile { var dirPtr interface{} = *raw return dirPtr.(*WebFSFile) } func castToDirectory(data interface{}) (*FolderData, error) { dirData := FolderData{} err := mapstructure.Decode(data.(primitive.D).Map(), &dirData) if err != nil { return nil, err } return &dirData, nil } // func List()