Skip to content

haruelrovix/gocsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gocsv

A CSV Writer API for goventory

Prerequisite

  1. Follow How to Run section on goventory first ‼️
  2. Go
$ go version
go version go1.10 darwin/amd64
  1. SQLite
$ sqlite3 version
SQLite version 3.16.0 2016-11-04 19:09:39
  1. curl
$ curl --version
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

How to Run

  1. Clone this repository
$ git clone https://github.com/haruelrovix/gocsv.git && cd gocsv
  1. Execute gocsv.sh
$ ./gocsv.sh
  1. If it asks to accept incoming network connections, allow it.

Accept incoming network connections

  1. gocsv listening on port 4000
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /nilaibarang              --> gocsv/api.ExportItemReport (3 handlers)
[GIN-debug] GET    /penjualan                --> gocsv/api.ExportSalesReport (3 handlers)
[GIN-debug] Environment variable PORT="4000"
[GIN-debug] Listening and serving HTTP on :4000

Test the API

Have you heard about REST Client for VS Code ?

  1. Laporan Nilai Barang: http://0.0.0.0:4000/nilaibarang

  1. Laporan Penjualan: http://0.0.0.0:4000/penjualan?startdate=2017-12-01&enddate=2017-12-31

image

For the default, Harga is in integer format. If you want to put Rp in front of it, add rupiah=true on the request.

http://0.0.0.0:4000/penjualan?startdate=2017-12-01&enddate=2017-12-31&rupiah=true

image

Another optional parameter is prettifydate. In Toko Ijah alternate universe, there is no timezone. So it just removes T and Z from the timestamp.

http://0.0.0.0:8080/penjualan?startdate=2017-12-01&enddate=2017-12-01&prettifydate=true

Debugging

VS Code and Delve, a debugger for the Go programming language.

Debugging

About

Export data report in CSV format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published