Grounds
    Preparing search index...

    Function RArray

    • Creates a schema for homogeneous arrays with elements of type T.

      All array elements must be the same type. The wire format encodes element type (1 byte), then all elements in sequence with a length prefix.

      Type Parameters

      • T extends TSchema

      Parameters

      • elementSchema: T

        Schema defining the type of all array elements

      Returns TRArray<T>

      A Relish schema for arrays of type T

      import { RArray, RU32, createCodec, type Static } from '@grounds/schema';

      const schema = RArray(RU32());
      type Numbers = Static<typeof schema>;
      const codec = createCodec(schema);

      codec.encode([1, 2, 3]).match(
      (bytes) => console.log('Array encoded:', bytes),
      (error) => console.error(error)
      );
      • RMap for heterogeneous key-value pairs
      • RStruct for fixed fields with different types