Socket
Socket
Sign inDemoInstall

@weipadev/gql-linq-like-builder

Package Overview
Dependencies
0
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @weipadev/gql-linq-like-builder

GraphQL Link-like-Builder


Version published
Maintainers
2
Created

Readme

Source

GraphQL Linq-like-Builder

Angular library to generate GraphQL queries through the builder design pattern.

downloads

Install

npm install @weipadev/gql-linq-like-builder --save

Usage

import { QueryBuilder } from "@weipadev/gql-linq-like-builder";

let queryBuilder: QueryBuilder = new QueryBuilder(operation: string, isCollection: boolean);

Examples

  1. Query
  2. Query (with variables)
  3. Query (with nested fields selection)
Query:
import { QueryBuilder } from "@weipadev/gql-linq-like-builder";

let queryBuilder: QueryBuilder = new QueryBuilder("user");

queryBuilder.AddColumn("id")
    .AddColumn("name")
    .AddColumn("surname");

let query: Query = queryBuilder.GetQuery();

console.log(query.ToString());

// Output
{
    user
    {
        items {
            id, 
            name, 
            surname
        }
    }
}

↑ all examples

Query (with variables):
import { QueryBuilder } from "@weipadev/gql-linq-like-builder";

let queryBuilder: QueryBuilder = new QueryBuilder("user");
queryBuilder.CreateFilter().AddCondition("id", MatchTypeEnum.EQUALS, 1);

queryBuilder.AddColumn("id")
    .AddColumn("name")
    .AddColumn("surname");

let query: Query = queryBuilder.GetQuery();

console.log(query.ToString());

// Output
{
    user(where: {id: {
        eq: 1
    }})
    {
        items {
            id, 
            name, 
            surname
        }, 
    }
}

↑ all examples

Query (with nested fields selection):
import { QueryBuilder } from "@weipadev/gql-linq-like-builder";

let queryBuilder: QueryBuilder = new QueryBuilder("user");

queryBuilder.AddColumn("id")
    .AddColumn("name")
    .AddColumn("surname")
    .AddEntity("profile")
        .AddColumn("id")
        .AddColumn("description");

let query: Query = queryBuilder.GetQuery();

console.log(query.ToString());
// Output
{
    user
    {
        items {
        id, 
        name, 
        surname, 
        profile {
            id, 
            description
        }
        }, 
    }
}

Author

  • Weipa Automation & Systems - GitHub

Contributors

If you are interested in actively maintaining / enhancing this project, get in touch.

  • André Weiss - GitHub
  • [YOUR NAME HERE] - Feel free to contribute to the codebase by resolving any open issues, refactoring, adding new features, writing test cases or any other way to make the project better and helpful to the community. Feel free to fork and send pull requests.

License

Copyright (c) 2023 Weipa https://weipa.com.br

The MIT License (http://www.opensource.org/licenses/mit-license.php)

Keywords

FAQs

Last updated on 19 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc