Installation - payfazz/tango GitHub Wiki

Requirements

Currently we support deploying tango services using following version of:

  • Unix based OS
  • Go 1.13
  • Database using PostgreSQL
  • In Memory Cache using Redis
  • GRPC using proto3 language

Creating Tango Services

  1. Set GO111MODULE=on in your startup shell script
  2. Get tango from github using $ go get github.com/payfazz/tango
  3. Create service directory using $ tango init <project-name>
  4. (Optional) After your service directory is created you can generate your basic CRUD service using $ tango make <path_to_structure; default: ./make/structure.yaml>

Sample of generator structure:

const:
  idTypes:
    uuid: &UUID "Uuid"
    autoIncrement: &AUTO_INCREMENT "AutoIncrement"
    plain: &PLAIN "Plain"
  dataTypes:
    bool: &BOOL "bool"
    int: &INT "int"
    int64: &INT64 "int64"
    string: &STRING "string"
    float32: &FLOAT32 "float32"
    float64: &FLOAT64 "float64"
    interface: &INTERFACE "interface{}"
    time: &TIME "*time.Time"
    boolptr: &BOOL_PTR "*bool"
    intptr: &INT_PTR "*int"
    int64ptr: &INT64_PTR "*int64"
    stringptr: &STRING_PTR "*string"
    float32ptr: &FLOAT32_PTR "*float32"
    float64ptr: &FLOAT64_PTR "*float64"
structures:
  - domain: Inventory # domain must be in PascalCase
    models:
    - name: Book # model must be in PascalCase
      table: books # Exact table name in database
      idType: *UUID
      idDataType: *STRING
      timestamps: true # true | false
      softDeletes: false # true | false
      fields: # name must be in snake_case
        - name: author_id
          type: *INT64_PTR
        - name: name
          type: *STRING
        - name: published_at
          type: *TIME
      action:
        create: true
        read: true
        find: true
        update: true
        delete: true
    - name: Publisher
      table: publishers
      idType: *UUID
      idDataType: *STRING
      timestamps: true
      softDeletes: true
      fields:
        - name: book_id
          type: *STRING_PTR
        - name: name
          type: *STRING
        - name: founded_at
          type: *TIME
      action:
        create: false
        read: false
        find: false
        update: true
        delete: false
    - name: Author
      table: authors
      idType: *AUTO_INCREMENT
      idDataType: *INT64
      timestamps: true
      softDeletes: true
      fields:
        - name: name
          type: *STRING
        - name: country
          type: *STRING
        - name: age
          type: *INT
        - name: address
          type: *STRING
        - name: publisher_name
          type: *STRING
      action:
        create: true
        read: true
        find: true
        update: false
        delete: false