Interface SGModelStatic

Hierarchy

  • SGModelStatic

Properties

clearCache: (() => Promise<void>)

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

findByPkForGraphQL: (<M>(this: SGModelCtrl<M>, id: string | number, options: FindOptions<any>, context: SGResolveContext, info: GraphQLResolveInfo, path?: string) => Promise<M | null>)

Type declaration

    • <M>(this: SGModelCtrl<M>, id: string | number, options: FindOptions<any>, context: SGResolveContext, info: GraphQLResolveInfo, path?: string): Promise<M | null>
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • id: string | number
      • options: FindOptions<any>
      • context: SGResolveContext
      • info: GraphQLResolveInfo
      • Optional path: string

      Returns Promise<M | null>

findOneForGraphQL: (<M>(this: SGModelCtrl<M>, options: FindOptions<any>, context: any, info: GraphQLResolveInfo, path?: string) => Promise<M | null>)

Type declaration

    • <M>(this: SGModelCtrl<M>, options: FindOptions<any>, context: any, info: GraphQLResolveInfo, path?: string): Promise<M | null>
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • options: FindOptions<any>
      • context: any
      • info: GraphQLResolveInfo
      • Optional path: string

      Returns Promise<M | null>

getSGContext: (() => SGContext)

Type declaration

hasSelection: (<M>(this: SGModelCtrl<M>, args: {
    info?: GraphQLResolveInfo;
    path: string;
}) => boolean)

Type declaration

    • <M>(this: SGModelCtrl<M>, args: {
          info?: GraphQLResolveInfo;
          path: string;
      }): boolean
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • args: {
            info?: GraphQLResolveInfo;
            path: string;
        }
        • Optional info?: GraphQLResolveInfo
        • path: string

      Returns boolean

parseAttributes: (<M>(this: SGModelCtrl<M>, args: {
    attributes: string[];
    selections?: Selection[];
}) => {
    additionSelections: Selection[];
    attributes: string[];
})

Type declaration

    • <M>(this: SGModelCtrl<M>, args: {
          attributes: string[];
          selections?: Selection[];
      }): {
          additionSelections: Selection[];
          attributes: string[];
      }
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • args: {
            attributes: string[];
            selections?: Selection[];
        }
        • attributes: string[]
        • Optional selections?: Selection[]

      Returns {
          additionSelections: Selection[];
          attributes: string[];
      }

      • additionSelections: Selection[]
      • attributes: string[]
parseSelections: ((fragments: {
    [key: string]: FragmentDefinitionNode;
}, selections?: readonly SelectionNode[], base?: {
    namedType: string;
}) => Selection[])

Type declaration

    • (fragments: {
          [key: string]: FragmentDefinitionNode;
      }, selections?: readonly SelectionNode[], base?: {
          namedType: string;
      }): Selection[]
    • Parameters

      • fragments: {
            [key: string]: FragmentDefinitionNode;
        }
        • [key: string]: FragmentDefinitionNode
      • Optional selections: readonly SelectionNode[]
      • Optional base: {
            namedType: string;
        }
        • namedType: string

      Returns Selection[]

resolveQueryOption: (<M>(this: SGModelCtrl<M>, args: {
    attributes?: string[];
    eagerHasMany?: boolean;
    include?: Includeable | Includeable[];
    info?: GraphQLResolveInfo;
    order?: Order;
    path?: string;
}) => {
    attributes: string[];
    include: Includeable | Includeable[];
    order: OrderItem[];
})

Type declaration

    • <M>(this: SGModelCtrl<M>, args: {
          attributes?: string[];
          eagerHasMany?: boolean;
          include?: Includeable | Includeable[];
          info?: GraphQLResolveInfo;
          order?: Order;
          path?: string;
      }): {
          attributes: string[];
          include: Includeable | Includeable[];
          order: OrderItem[];
      }
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • args: {
            attributes?: string[];
            eagerHasMany?: boolean;
            include?: Includeable | Includeable[];
            info?: GraphQLResolveInfo;
            order?: Order;
            path?: string;
        }
        • Optional attributes?: string[]
        • Optional eagerHasMany?: boolean
        • Optional include?: Includeable | Includeable[]
        • Optional info?: GraphQLResolveInfo
        • Optional order?: Order
        • Optional path?: string

      Returns {
          attributes: string[];
          include: Includeable | Includeable[];
          order: OrderItem[];
      }

      • attributes: string[]
      • include: Includeable | Includeable[]
      • order: OrderItem[]
resolveRelayConnection: (<M>(this: SGModelCtrl<M>, args: {
    attributes?: string[];
    bind?: BindOrReplacements;
    include?: Includeable | Includeable[];
    order?: OrderItem[];
    pagination?: {
        after?: string;
        before?: string;
        first?: number;
        last?: number;
    };
    selectionInfo?: GraphQLResolveInfo;
    subQuery?: boolean;
    where?: WhereOptions<any>;
}) => Promise<{
    count: number;
    edges: {
        cursor: string | number;
        node: M;
    }[];
    pageInfo: {
        endCursor: string | number;
        hasNextPage: boolean;
        hasPreviousPage: boolean;
        startCursor: string | number;
    };
}>)

Type declaration

    • <M>(this: SGModelCtrl<M>, args: {
          attributes?: string[];
          bind?: BindOrReplacements;
          include?: Includeable | Includeable[];
          order?: OrderItem[];
          pagination?: {
              after?: string;
              before?: string;
              first?: number;
              last?: number;
          };
          selectionInfo?: GraphQLResolveInfo;
          subQuery?: boolean;
          where?: WhereOptions<any>;
      }): Promise<{
          count: number;
          edges: {
              cursor: string | number;
              node: M;
          }[];
          pageInfo: {
              endCursor: string | number;
              hasNextPage: boolean;
              hasPreviousPage: boolean;
              startCursor: string | number;
          };
      }>
    • Type Parameters

      Parameters

      • this: SGModelCtrl<M>
      • args: {
            attributes?: string[];
            bind?: BindOrReplacements;
            include?: Includeable | Includeable[];
            order?: OrderItem[];
            pagination?: {
                after?: string;
                before?: string;
                first?: number;
                last?: number;
            };
            selectionInfo?: GraphQLResolveInfo;
            subQuery?: boolean;
            where?: WhereOptions<any>;
        }
        • Optional attributes?: string[]
        • Optional bind?: BindOrReplacements
        • Optional include?: Includeable | Includeable[]
        • Optional order?: OrderItem[]
        • Optional pagination?: {
              after?: string;
              before?: string;
              first?: number;
              last?: number;
          }
          • Optional after?: string
          • Optional before?: string
          • Optional first?: number
          • Optional last?: number
        • Optional selectionInfo?: GraphQLResolveInfo
        • Optional subQuery?: boolean
        • Optional where?: WhereOptions<any>

      Returns Promise<{
          count: number;
          edges: {
              cursor: string | number;
              node: M;
          }[];
          pageInfo: {
              endCursor: string | number;
              hasNextPage: boolean;
              hasPreviousPage: boolean;
              startCursor: string | number;
          };
      }>

sgSchema: SGSchema
withCache: (<T, M>(this: (new () => M) & typeof Model) => {
    count: ((options?: CountOptions<any>) => Promise<number>);
    findAll: ((options?: FindOptions<any>) => Promise<M[]>);
    findOne: ((options?: FindOptions<any>) => Promise<null | M>);
})

Type declaration

    • <T, M>(this: (new () => M) & typeof Model): {
          count: ((options?: CountOptions<any>) => Promise<number>);
          findAll: ((options?: FindOptions<any>) => Promise<M[]>);
          findOne: ((options?: FindOptions<any>) => Promise<null | M>);
      }
    • Type Parameters

      • T extends {}

      • M extends SGModel<T, M>

      Parameters

      • this: (new () => M) & typeof Model

      Returns {
          count: ((options?: CountOptions<any>) => Promise<number>);
          findAll: ((options?: FindOptions<any>) => Promise<M[]>);
          findOne: ((options?: FindOptions<any>) => Promise<null | M>);
      }

      • count: ((options?: CountOptions<any>) => Promise<number>)
          • (options?: CountOptions<any>): Promise<number>
          • Parameters

            • Optional options: CountOptions<any>

            Returns Promise<number>

      • findAll: ((options?: FindOptions<any>) => Promise<M[]>)
          • (options?: FindOptions<any>): Promise<M[]>
          • Parameters

            • Optional options: FindOptions<any>

            Returns Promise<M[]>

      • findOne: ((options?: FindOptions<any>) => Promise<null | M>)
          • (options?: FindOptions<any>): Promise<null | M>
          • Parameters

            • Optional options: FindOptions<any>

            Returns Promise<null | M>

Generated using TypeDoc