File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,30 @@ func (q *Query) ExcludeColumn(columns ...string) *Query {
360360 return q
361361}
362362
363+ // AppendColumn appends column to the list of default columns if they weren't set,
364+ // while Column method overrides defaults
365+ func (q * Query ) AppendColumn (columns ... string ) * Query {
366+ t := q .tableModel .Table ()
367+ if q .columns == nil {
368+ for _ , f := range t .Fields {
369+ q .columns = append (q .columns , SafeQuery ("?.?" , t .Alias , f .Column ))
370+ }
371+ }
372+ return q .Column (columns ... )
373+ }
374+
375+ // AppendColumnExpr appends column expression to the list of default columns if they weren't set,
376+ // while ColumnExpr method overrides defaults
377+ func (q * Query ) AppendColumnExpr (expr string , params ... interface {}) * Query {
378+ t := q .tableModel .Table ()
379+ if q .columns == nil {
380+ for _ , f := range t .Fields {
381+ q .columns = append (q .columns , SafeQuery ("?.?" , t .Alias , f .Column ))
382+ }
383+ }
384+ return q .ColumnExpr (expr , params ... )
385+ }
386+
363387func (q * Query ) excludeColumn (column string ) bool {
364388 for i := 0 ; i < len (q .columns ); i ++ {
365389 app , ok := q .columns [i ].(fieldAppender )
You can’t perform that action at this time.
0 commit comments