Refactor rdbms-dal code and unify store-ident logic
This commit is contained in:
@@ -314,9 +314,6 @@ func (d *model) Aggregate(f filter.Filter, groupBy []dal.AggregateAttr, aggrExpr
|
||||
return
|
||||
}
|
||||
|
||||
i.src = Model(srcModel, d.conn, d.dialect)
|
||||
i.dst = Model(dstModel, d.conn, d.dialect)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func NewSingleValueColumn(d Dialect, a *dal.Attribute) *SingleValueColumn {
|
||||
return &SingleValueColumn{
|
||||
typ: d.TypeWrap(a.Type),
|
||||
attr: a,
|
||||
name: attrColumnIdent(a),
|
||||
name: a.StoreIdent(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ func NewTableCodec(m *dal.Model, d Dialect) *GenericTableCodec {
|
||||
|
||||
for a := range m.Attributes {
|
||||
attr = m.Attributes[a]
|
||||
colIdent = attrColumnIdent(attr)
|
||||
colIdent = attr.StoreIdent()
|
||||
|
||||
if done[colIdent] {
|
||||
continue
|
||||
@@ -148,19 +148,6 @@ func (t *GenericTableCodec) AttributeExpression(ident string) (exp.Expression, e
|
||||
return exp.NewLiteralExpression("?", exp.NewIdentifierExpression("", t.model.Ident, ident)), nil
|
||||
}
|
||||
|
||||
func attrColumnIdent(att *dal.Attribute) string {
|
||||
switch ss := att.Store.(type) {
|
||||
case *dal.CodecRecordValueSetJSON:
|
||||
return ss.Ident
|
||||
|
||||
case *dal.CodecAlias:
|
||||
return ss.Ident
|
||||
|
||||
default:
|
||||
return att.Ident
|
||||
}
|
||||
}
|
||||
|
||||
func collectStdRecordValueJSONColumns(ident string, aa ...*dal.Attribute) []*dal.Attribute {
|
||||
filtered := make([]*dal.Attribute, 0)
|
||||
for _, a := range aa {
|
||||
|
||||
Reference in New Issue
Block a user