watcher-ts/packages/graph-node/test/subgraph/example1/generated/schema.ts
prathamesh0 94e9182dd3 Handle BigNumber event params and customize Decimal (#63)
* Handle BigNumber event params in watchers

* Customize decimal according to limits of IEEE-754 decimal128

* Add definition for custom scalar BigDecimal
2021-12-28 16:08:05 +05:30

255 lines
5.8 KiB
TypeScript

// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
TypedMap,
Entity,
Value,
ValueKind,
store,
Address,
Bytes,
BigInt,
BigDecimal
} from "@graphprotocol/graph-ts";
export class Blog extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
this.set("kind", Value.fromString(""));
this.set("isActive", Value.fromBoolean(false));
this.set("reviews", Value.fromBigIntArray(new Array(0)));
this.set("author", Value.fromString(""));
this.set("categories", Value.fromStringArray(new Array(0)));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Blog entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
"Cannot save Blog entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
);
store.set("Blog", id.toString(), this);
}
}
static load(id: string): Blog | null {
return changetype<Blog | null>(store.get("Blog", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get kind(): string {
let value = this.get("kind");
return value!.toString();
}
set kind(value: string) {
this.set("kind", Value.fromString(value));
}
get isActive(): boolean {
let value = this.get("isActive");
return value!.toBoolean();
}
set isActive(value: boolean) {
this.set("isActive", Value.fromBoolean(value));
}
get reviews(): Array<BigInt> {
let value = this.get("reviews");
return value!.toBigIntArray();
}
set reviews(value: Array<BigInt>) {
this.set("reviews", Value.fromBigIntArray(value));
}
get author(): string {
let value = this.get("author");
return value!.toString();
}
set author(value: string) {
this.set("author", Value.fromString(value));
}
get categories(): Array<string> {
let value = this.get("categories");
return value!.toStringArray();
}
set categories(value: Array<string>) {
this.set("categories", Value.fromStringArray(value));
}
}
export class Author extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
this.set("blogCount", Value.fromBigInt(BigInt.zero()));
this.set("name", Value.fromString(""));
this.set("rating", Value.fromBigDecimal(BigDecimal.zero()));
this.set("paramInt", Value.fromI32(0));
this.set("paramBigInt", Value.fromBigInt(BigInt.zero()));
this.set("paramBytes", Value.fromBytes(Bytes.empty()));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Author entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
"Cannot save Author entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
);
store.set("Author", id.toString(), this);
}
}
static load(id: string): Author | null {
return changetype<Author | null>(store.get("Author", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get blogCount(): BigInt {
let value = this.get("blogCount");
return value!.toBigInt();
}
set blogCount(value: BigInt) {
this.set("blogCount", Value.fromBigInt(value));
}
get name(): string {
let value = this.get("name");
return value!.toString();
}
set name(value: string) {
this.set("name", Value.fromString(value));
}
get rating(): BigDecimal {
let value = this.get("rating");
return value!.toBigDecimal();
}
set rating(value: BigDecimal) {
this.set("rating", Value.fromBigDecimal(value));
}
get paramInt(): i32 {
let value = this.get("paramInt");
return value!.toI32();
}
set paramInt(value: i32) {
this.set("paramInt", Value.fromI32(value));
}
get paramBigInt(): BigInt {
let value = this.get("paramBigInt");
return value!.toBigInt();
}
set paramBigInt(value: BigInt) {
this.set("paramBigInt", Value.fromBigInt(value));
}
get paramBytes(): Bytes {
let value = this.get("paramBytes");
return value!.toBytes();
}
set paramBytes(value: Bytes) {
this.set("paramBytes", Value.fromBytes(value));
}
get blogs(): Array<string> {
let value = this.get("blogs");
return value!.toStringArray();
}
set blogs(value: Array<string>) {
this.set("blogs", Value.fromStringArray(value));
}
}
export class Category extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
this.set("name", Value.fromString(""));
this.set("count", Value.fromBigInt(BigInt.zero()));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Category entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
"Cannot save Category entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
);
store.set("Category", id.toString(), this);
}
}
static load(id: string): Category | null {
return changetype<Category | null>(store.get("Category", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get name(): string {
let value = this.get("name");
return value!.toString();
}
set name(value: string) {
this.set("name", Value.fromString(value));
}
get count(): BigInt {
let value = this.get("count");
return value!.toBigInt();
}
set count(value: BigInt) {
this.set("count", Value.fromBigInt(value));
}
}