sql fixes

This commit is contained in:
Asim Aslam 2020-04-30 23:53:54 +01:00
parent 359b8bc503
commit c76a5e608d

View File

@ -99,12 +99,12 @@ func (s *sqlStore) configure() error {
database := s.options.Database database := s.options.Database
if len(database) == 0 { if len(database) == 0 {
database = DefaultDatabase s.options.Database = DefaultDatabase
} }
table := s.options.Table table := s.options.Table
if len(table) == 0 { if len(table) == 0 {
table = DefaultTable s.options.Table = DefaultTable
} }
// store.namespace must only contain letters, numbers and underscores // store.namespace must only contain letters, numbers and underscores
@ -423,7 +423,11 @@ func (s *sqlStore) String() string {
// NewStore returns a new micro Store backed by sql // NewStore returns a new micro Store backed by sql
func NewStore(opts ...store.Option) store.Store { func NewStore(opts ...store.Option) store.Store {
var options store.Options options := store.Options{
Database: DefaultDatabase,
Table: DefaultTable,
}
for _, o := range opts { for _, o := range opts {
o(&options) o(&options)
} }