lxdTest

command module
v0.0.0-...-f6f9965 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

Cli commands for Server:

  • Serve: serves the books api over http
  • Migrate: creates database tables

Cli commands for client:

  • Create:

    • Collection:
      • Flags:
        • --collection / required
        • --help / help for command
      • Example:
        • Go run main.go create collection --collection=’{“name”:”Fiction”}’
    • Book
      • Flags:
        • --book/ required
        • --collection / optional
        • --help / help for command
      • Example:
        • Go run main.go create book --book=’{“title”:”harryPotter”,”author”:”J.K Rowling”, “description”:”book about magic”}’ --collection=fiction
  • Update:

    • Collection
    • Book
  • ###. Help
  • List:

    • Books:
      • Flags:
        • --author / optional
        • --title / optional
        • --fromDate / optional
        • --toDate / optional
      • Example:
        • Go run main.go list books --author=David --title=harry Potter
    • Collections:
      • Flags:
        • --name
      • Examples:
        • Go run main.go list collections --name=Fiction
    • --help

REST API:

ROUTES:

/1.0

Version 1 of the api

/1.0/books

GET
  • Description: books in the database
  • Return: list of books

/1.0/book

POST
  • Description: adds book to database
  • Return: returns book that was added to database

/1.0/book/{id}

GET
  • Description: book with specified id
  • Return: book with specified id

/1.0/collections

GET
  • Description: collections in the database
  • Return: list of collections

/1.0/collection

PUT
  • Description: adds collection to database
  • Return: collection that was added to the database

/1.0/collection/{id}

GET
  • Description: collection with specific id and other query parameters
  • Return: a collection with the id and other query parameters

Database Structure:

Book

Field data type
id int8 PRIMARY_KEY
author varchar
description varchar
title varchar
createdAt timestamp
updatedAt timestamp

Collection

Field data type
id int8 PRIMARY_KEY
name varchar
createdAt timestamp
updatedAt timestamp

collection_books - join table

Field data type
collection_id int8 FOREIGN_KEY
book_id int8 FOREIGN_KEY

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
ent
pkg
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL