PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/g17khqpukees4237dtn3astzapmp462vjhsz6st4/datasource

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
datasource
Namespace
g17khqpukees4237dtn3astzapmp462vjhsz6st4
Files
6 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/g17khqpukees4237dtn3astzapmp462vjhsz6st4/datasource
gno
0.9

Files (6)

  • README.mdmarkdown
  • gnomod.tomltoml
  • datasource.gnogno
  • fields.gnogno
  • iterator.gnogno
  • query.gnogno
query.gnogno
1package datasource23import "gno.land/p/nt/avl/v0"45// DefaultQueryRecords defines the default number of records returned by queries.6const DefaultQueryRecords = 5078type (9	// QueryOption configures datasource queries.10	QueryOption func(*Query)1112	// Query contains datasource query options.13	Query struct {14		// Offset of the first record to return during iteration.15		Offset int1617		// Count contains the number to records that query should return.18		Count int1920		// Tag contains a tag to use as filter for the records.21		Tag string2223		// Filters contains optional query filters by field value.24		Filters avl.Tree25	}26)2728// WithOffset configures query to return records starting from an offset.29func WithOffset(offset int) QueryOption {30	return func(q *Query) {31		q.Offset = offset32	}33}3435// WithCount configures the number of records that query returns.36func WithCount(count int) QueryOption {37	return func(q *Query) {38		if count < 1 {39			count = DefaultQueryRecords40		}41		q.Count = count42	}43}4445// ByTag configures query to filter by tag.46func ByTag(tag string) QueryOption {47	return func(q *Query) {48		q.Tag = tag49	}50}5152// WithFilter assigns a new filter argument to a query.53// This option can be used multiple times if more than one54// filter has to be given to the query.55func WithFilter(field string, value any) QueryOption {56	return func(q *Query) {57		q.Filters.Set(field, value)58	}59}6061// NewQuery creates a new datasource query.62func NewQuery(options ...QueryOption) Query {63	// Construct a fresh Query in the caller's realm; copying from a64	// package-level default would propagate the /p/-readonly taint65	// and break the apply(&q) options below.66	q := Query{Count: DefaultQueryRecords}67	for _, apply := range options {68		apply(&q)69	}70	return q71}72

Functions

not supported for pure packages by the node (vm/qfuncs)

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.