-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from itishrishikesh/postgres
I wrote biolerplate code for gofeed, ground work for setting up postg…
- Loading branch information
Showing
8 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
|
||
"github.com/itishrishikesh/gofeed/constants" | ||
) | ||
|
||
func errorHandler(writer http.ResponseWriter, request *http.Request) { | ||
log.Println("D#1ONS9C - Request received:", request) | ||
respondWithError(writer, constants.HTTP_BAD_REQUEST, "Something went wrong!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
|
||
"github.com/itishrishikesh/gofeed/constants" | ||
) | ||
|
||
func handlerReadiness(writer http.ResponseWriter, request *http.Request) { | ||
func healthCheckHandler(writer http.ResponseWriter, request *http.Request) { | ||
log.Println("D#1ONRAR - Request received:", request) | ||
respondWithJSON(writer, constants.HTTP_SUCCESS, struct{}{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- name: CreateUser :one | ||
INSERT INTO users (id, created_at, updated_at, name) | ||
VALUES ($1, $2, $3, $4) | ||
RETURNING *; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- +goose Up | ||
CREATE TABLE users ( | ||
id UUID PRIMARY KEY, | ||
created_at TIMESTAMP NOT NULL, | ||
updated_at TIMESTAMP NOT NULL, | ||
name TEXT NOT NULL | ||
); | ||
|
||
-- +goose Down | ||
DROP TABLE users; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: "2" | ||
sql: | ||
- schema: "sql/schema" | ||
queries: "sql/queries" | ||
engine: "postgresql" | ||
gen: | ||
go: | ||
out: "internal/database" |