diff --git a/field.go b/field.go index c30ef665..3624c45c 100644 --- a/field.go +++ b/field.go @@ -53,7 +53,7 @@ func (f *Field) sqlTag() (str string) { } } - typ, addational_typ, size := parseSqlTag(f.structField.Tag.Get(tagIdentifier)) + typ, addational_typ, size := parseSqlTag(f.structField.Tag.Get(f.model.do.db.tagIdentifier)) if typ == "-" { return @@ -61,9 +61,9 @@ func (f *Field) sqlTag() (str string) { if len(typ) == 0 { if f.isPrimaryKey { - typ = f.model.do.chain.d.dialect.PrimaryKeyTag(value, size) + typ = f.model.do.db.dialect.PrimaryKeyTag(value, size) } else { - typ = f.model.do.chain.d.dialect.SqlTag(value, size) + typ = f.model.do.db.dialect.SqlTag(value, size) } } diff --git a/model.go b/model.go index 0003bd04..71f17429 100644 --- a/model.go +++ b/model.go @@ -191,7 +191,7 @@ func (m *Model) tableName() (str string) { str = toSnake(m.typeName()) - if !singularTableName { + if !m.do.db.singularTable { pluralMap := map[string]string{"ch": "ches", "ss": "sses", "sh": "shes", "day": "days", "y": "ies", "x": "xes", "s?": "s"} for key, value := range pluralMap { reg := regexp.MustCompile(key + "$") @@ -205,7 +205,7 @@ func (m *Model) tableName() (str string) { } func (m *Model) callMethod(method string) { - if m.data == nil || m.do.chain.hasError() { + if m.data == nil || m.do.db.hasError() { return }