mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-20 09:20:11 +00:00
Rename 'MapDS' to 'JsonDS'; Added some docs
This commit is contained in:
34
internal/datastore/json_datastore/map_datastore.go
Normal file
34
internal/datastore/json_datastore/map_datastore.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package jsondatastore
|
||||
|
||||
import "github.com/pikami/cosmium/internal/datastore"
|
||||
|
||||
type JsonDataStore struct {
|
||||
storeState State
|
||||
|
||||
initialDataFilePath string
|
||||
persistDataFilePath string
|
||||
}
|
||||
|
||||
type JsonDataStoreOptions struct {
|
||||
InitialDataFilePath string
|
||||
PersistDataFilePath string
|
||||
}
|
||||
|
||||
func NewJsonDataStore(options JsonDataStoreOptions) *JsonDataStore {
|
||||
dataStore := &JsonDataStore{
|
||||
storeState: State{
|
||||
Databases: make(map[string]datastore.Database),
|
||||
Collections: make(map[string]map[string]datastore.Collection),
|
||||
Documents: make(map[string]map[string]map[string]datastore.Document),
|
||||
Triggers: make(map[string]map[string]map[string]datastore.Trigger),
|
||||
StoredProcedures: make(map[string]map[string]map[string]datastore.StoredProcedure),
|
||||
UserDefinedFunctions: make(map[string]map[string]map[string]datastore.UserDefinedFunction),
|
||||
},
|
||||
initialDataFilePath: options.InitialDataFilePath,
|
||||
persistDataFilePath: options.PersistDataFilePath,
|
||||
}
|
||||
|
||||
dataStore.InitializeDataStore()
|
||||
|
||||
return dataStore
|
||||
}
|
||||
Reference in New Issue
Block a user