# go-fiber-gorm-sqlite-poc **Repository Path**: gitwbbin/go-fiber-gorm-sqlite-poc ## Basic Information - **Project Name**: go-fiber-gorm-sqlite-poc - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-05-24 - **Last Updated**: 2021-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # example of Fiber + GORM + Go-Sqlite ## Fiber ```bash go get github.com/gofiber/fiber ``` ## Gorm ```bash go get github.com/go-gorm/gorm ``` ## Go-Sqlite > Download GCC first before install go-sqlite3: https://github.com/jmeubank/tdm-gcc/releases/download/v9.2.0-tdm64-1/tdm64-gcc-9.2.0.exe ```bash go get github.com/mattn/go-sqlite3 ``` ## Test ### find all ```bash curl http://localhost:3000/api/v1/book ``` ### find by id ```bash curl http://localhost:3000/api/v1/book/2 ``` ### create ```bash curl -X POST -H "Content-Type:application/json" --data "{\"title\":\"t4\",\"author\":\"noman\",\"rating\":88}" http://localhost:3000/api/v1/book ``` ### delete ```bash curl -X DELETE http://localhost:3000/api/v1/book/5 ``` ### use jq format result ```bash curl -H "Content-Type:application/json" http://localhost:3000/api/v1/book | jq ".[]|{id:.ID,title:.title,author:.author,rating:.rating,create_dt:.CreatedAt,update_dt:.UpdatedAt,delete_dt:.DeletedAt}" ``` result: ```json { "id": 1, "title": "t1", "author": "mike", "rating": 96, "create_dt": "2020-10-11T21:18:55.7168527+08:00", "update_dt": "2020-10-11T21:18:55.7168527+08:00", "delete_dt": { "Time": "0001-01-01T00:00:00Z", "Valid": false } } { "id": 2, "title": "t2", "author": "jane", "rating": 92, "create_dt": "2020-10-11T21:19:28.397027+08:00", "update_dt": "2020-10-11T21:19:28.397027+08:00", "delete_dt": { "Time": "0001-01-01T00:00:00Z", "Valid": false } } ```