hydra
v3
v3
  • Hydra
  • Hydra CLI
  • Hydra Indexer
  • Hydra Indexer Gateway
  • Hydra Processor
  • Hydra Typegen
  • Overview
    • Query Node Manifest
    • Graphql Queries
    • Pagination
    • Sorting
    • Mappings
      • Context interfaces
      • Mapping Filters
      • Mapping Types
    • Schema
      • The Goodies
      • Entities
      • Enums
      • Interfaces
      • Algebraic types
      • Full-text queries
      • Entity Relationships
      • Cross filtering
      • Variant relations
    • Architecture
  • Install Hydra
  • Migration to Hydra v2
  • What's new in Hydra v3
  • FAQ
  • Quickstart
Powered by GitBook
On this page
  • Primitive types
  • Modifiers and decorators
  • Example

Was this helpful?

  1. Overview
  2. Schema

Entities

Entities is the backbone of the data model and translate into the db schema

PreviousThe GoodiesNextEnums

Last updated 4 years ago

Was this helpful?

Entities are the top-level type definitions in the input schema marked with the @entity directive. Entity fields are normally built-in scalar types but can also be

  • an array of primitive types

  • an ,

  • an

  • an

All entities have an auto-generated ID field which is reserved and cannot be used in the input schema.

Primitive types

The following scalar types are supported:

  • Boolean

  • String

  • Int

  • Float

  • BigInt supports arbitrarily large numbers and is useful for representing e.g. large numbers uint256

  • Bytes

Arrays follow the GraphQL .

Modifiers and decorators

By default, each field is nullable. To indicate a no-null constraint mark the field with !

If a property must be unique across all entities of the given type, mark it with a built-in @unique directive

Schema comments are natively supported and are propagated to the output schema

Example

"It is just a boring nine-five person"
type Person @entity {
    name: String!
    married: Boolean
    age: Int
    "one person, one account, one life"
    account: Bytes! @unique
    salary: BigInt
    interests: [String]
}
enum
entity reference
algebraic type
spec