// New construct new event store
// dbname - a path to sqlite database on disk
// enc - a specific encoder implementation (see bundled JsonEncoder)
New construct new event store
dbname - a path to sqlite database on disk
enc - a specific encoder implementation
// New construct new event store // dbname - a path to sqlite database on disk // enc - a specific encoder implementation ( see bundled JsonEncoder )
func New(dial gorm.Dialector, enc Encoder) (*EventStore, error) {
	if enc == nil {
		return nil, fmt.Errorf("encoder implementation must be provided")
	}
	db, err := gorm.Open(dial, &gorm.Config{})
	if err != nil {
		return nil, err
	}
	db.AutoMigrate(&gormEvent{})
	return &EventStore{
		db:  db,
		enc: enc,
	}, nil
}
func New ( dial gorm . Dialector , enc Encoder ) ( * EventStore , error ) { if enc == nil { return nil , fmt . Errorf ( " " ) } db , err := gorm . Open ( dial , & gorm . Config { } ) if err != nil { return nil , err } db . AutoMigrate ( & gormEvent { } ) return & EventStore { db : db , enc : enc , } , nil }
New construct new event store
dbname - a path to sqlite database on disk
enc - a specific encoder implementation
New construct new event store dbname - a path to sqlite database on disk enc - a specific encoder implementation