3
0

Refactor rdbms-dal code and unify store-ident logic

This commit is contained in:
Denis Arh
2022-11-14 07:40:57 +01:00
parent 5187b63771
commit 97fd780edf
3 changed files with 2 additions and 18 deletions
-3
View File
@@ -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
}
+1 -1
View File
@@ -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(),
}
}
+1 -14
View File
@@ -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 {