File system abstraction with access management This is the DataBase adapter for the core interface
API provides common file operations for file info stored in a database. Any operations outside for not owned files will be blocked. Also, it possible to configure a custom policy for read/write operations.
Can be used as backend for Webix File Manager https://webix.com/filemanager
import (
"github.com/xbsoftware/wfs"
db "github.com/xbsoftware/wfs-db"
_ "github.com/go-sql-driver/mysql""github.com/jmoiron/sqlx"
)
conn, err:=sqlx.Connect("mysql", "root:1@(localhost:3306)/files?parseTime=true")
// connection, temp folder, table name, root item, drive configfs, err:=db.NewDBDrive(conn, "/tmp", "entity", 0, nil)createtablefiles.entity
(
id int auto_increment primary key,
name varchar(255) not null,
folder intnot null,
content varchar(32) default ''not null,
type tinyint not null,
modified datetime not null,
size int default 0not null,
tree intnot null,
pathvarchar(2048) not null
);
createindexentity_path_indexonfiles.entity (path);
MIT