MCPcopy Create free account
hub / github.com/cloudwan/gohan / executeSelect

Method executeSelect

db/sql/sql.go:906–920  ·  view source on GitHub ↗
(ctx context.Context, sc *selectContext, sql string, args []interface{})

Source from the content-addressed store, hash-verified

904}
905
906func (tx *Transaction) executeSelect(ctx context.Context, sc *selectContext, sql string, args []interface{}) (list []*schema.Resource, total uint64, err error) {
907 tx.logQuery(sql, args...)
908 rows, err := tx.transaction.QueryxContext(ctx, sql, args...)
909 if err != nil {
910 return
911 }
912 defer rows.Close()
913
914 list, err = tx.decodeRows(sc.schema, rows, list, sc.fields != nil, sc.join)
915 if err != nil {
916 return nil, 0, err
917 }
918 total, err = tx.CountContext(ctx, sc.schema, sc.filter)
919 return
920}
921
922func (tx *Transaction) List(s *schema.Schema, filter transaction.Filter, options *transaction.ViewOptions, pg *pagination.Paginator) (list []*schema.Resource, total uint64, err error) {
923 return tx.ListContext(context.Background(), s, filter, options, pg)

Callers 2

ListContextMethod · 0.95
LockListContextMethod · 0.95

Calls 4

logQueryMethod · 0.95
decodeRowsMethod · 0.95
CountContextMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected