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/datastore

Package
Open in gnoweb ↗

Overview

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

Files (11)

  • README.mdmarkdown
  • gnomod.tomltoml
  • datastore.gnogno
  • index.gnogno
  • query_options.gnogno
  • query.gnogno
  • record.gnogno
  • schema_options.gnogno
  • schema.gnogno
  • storage_options.gnogno
  • storage.gnogno
  • schema_options.gnogno
    1package datastore23import "strings"45// StorageOption configures schemas.6type SchemaOption func(*Schema)78// WithField assign a new field to the schema definition.9func WithField(name string) SchemaOption {10	return func(s *Schema) {11		name = strings.TrimSpace(name)12		if name != "" {13			s.fields.Append(name)14		}15	}16}1718// WithDefaultField assign a new field with a default value to the schema definition.19// Default value is assigned to newly created records asociated to to schema.20func WithDefaultField(name string, value interface{}) SchemaOption {21	return func(s *Schema) {22		name = strings.TrimSpace(name)23		if name != "" {24			s.fields.Append(name)2526			key := castIntToKey(s.fields.Len() - 1)27			s.defaults.Set(key, value)28		}29	}30}3132// Strict configures the schema as a strict one.33// By default schemas should allow the creation of any user defined field,34// making them strict limits the allowed record fields to the ones pre-defined35// in the schema. Fields are pre-defined using `WithField`, `WithDefaultField`36// or by calling `Schema.AddField()`.37func Strict() SchemaOption {38	return func(s *Schema) {39		s.strict = true40	}41}42

    Functions

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

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