initial commit

This commit is contained in:
2025-02-03 12:48:59 +08:00
commit 3da9e929b5
7 changed files with 199 additions and 0 deletions

32
core/data-clip-builder.go Normal file
View File

@@ -0,0 +1,32 @@
package core
import (
"os"
"path/filepath"
"reflect"
)
type DataClipBuilder struct {
path string
type_ any
}
func (receiver *DataClipBuilder) InFile(filename string) {
wd, _ := os.Getwd()
receiver.path = filepath.Join(wd, filename)
}
func (receiver *DataClipBuilder) UnderDir(dirpath string, filename string) {
receiver.path = filepath.Join(dirpath, filename)
}
func (receiver *DataClipBuilder) RegisterType(data interface{}) {
receiver.type_ = reflect.New(reflect.TypeOf(data)).Interface()
}
func (receiver *DataClipBuilder) Build() DataClip {
return DataClip{
path: receiver.path,
type_: receiver.type_,
}
}