New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

tarsius

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tarsius

Tarsius CLI Development Tools

npmnpm
Version
0.1.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

tarsius-cli

Create project

Create new project

$ mkdir project-test
$ cd project-test

Create tarsius.yml for data modeling

tables :
  # Create table author
  author:
    id:
      type: serial
      notNull: true
      primaryKey: true
    name:
      type: varchar(100)
      notNull: true
    email:
      type: varchar(150)
      notNull: true
    created:
      type: timestamptz

  # Create table post
  post:
    id:
      type: serial
      notNull: true
      primaryKey: true
    title:
      type: varchar(100)
      notNull: true
    content:
      type: text
    authorid:
      type: authors.id
      notNull: true
    created:
      type: timestamptz

use anchor

tables :
  # Create table author
  author:
    id: &idAnchor
      type: serial
      notNull: true
      primaryKey: true
    name: &nameAnchor
      type: varchar(100)
      notNull: true
    email:
      <<: *nameAnchor
    created: &dateAnchor
      type: timestamptz

  # Create table post
  post:
    id:
      <<: *idAnchor
    title:
      <<: *nameAnchor
    content:
      type: text
    authorid:
      # Set joining to `authors` table
      type: authors.id
      notNull: true
    created:
      <<: *dateAnchor

SQL

Configuration

$ tarsius-cli sql config

Create table

$ tarsius-cli sql create

Initialize your project

$ tarsius-cli init
or
$ tarsius-cli init -s go -p ../project-directory

Run project

$ tarsius-cli run

access to http://localhost:8000

GraphQL

Query to get the all authors

query {
  authors {
    id
    name
    email
    created
  }
}

Query to get a specific author

query {
  author(id: 1) {
    id
    name
    email
  }
}

Create new author using mutation

mutation {
  createAuthor(name: "Ibnu Yahya", email: "ibnu@tarsius.id") {
    id
    name
    email
  }
}

Update an author using mutation

mutation {
  updateAuthor(id: 2, name: "ibnu Yahya", email: "ibnu@tarsius.id") {
    id
    name
    email
  }
}

Delete an author using mutation

mutation {
  deleteAuthor(id: 2) {
    id
  }
}

Query to get the posts with its relation author

query {
  posts {
    id
    title
    content
    author {
      id
      name
      email
    }
  }
}

FAQs

Package last updated on 04 Nov 2018

Related posts