This file contains hidden or 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
| module github.com/oxlb/GoLangPostgresHelloWorld | |
| go 1.14 | |
| require ( | |
| github.com/jinzhu/gorm v1.9.16 | |
| github.com/labstack/echo/v4 v4.1.17 | |
| gorm.io/gorm v1.20.2 // indirect | |
| ) |
This file contains hidden or 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
| package model | |
| type Students struct { | |
| Id string `json:"id"` | |
| Name string `json:"name"` | |
| } |
This file contains hidden or 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
| package storage | |
| import ( | |
| "log" | |
| "github.com/jinzhu/gorm" | |
| _ "github.com/jinzhu/gorm/dialects/postgres" | |
| config "github.com/oxlb/GoLangPostgresHelloWorld/config" | |
| ) |
This file contains hidden or 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
| package controller | |
| import ( | |
| "net/http" | |
| "github.com/labstack/echo/v4" | |
| "github.com/oxlb/GoLangPostgresHelloWorld/model" | |
| "github.com/oxlb/GoLangPostgresHelloWorld/storage" | |
| ) |
This file contains hidden or 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
| package main | |
| import ( | |
| "net/http" | |
| "github.com/labstack/echo/v4" | |
| "github.com/labstack/echo/v4/middleware" | |
| "github.com/oxlb/GoLangPostgresHelloWorld/controller" | |
| "github.com/oxlb/GoLangPostgresHelloWorld/storage" | |
| ) |
This file contains hidden or 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
| [ | |
| { | |
| "id": "1", | |
| "name": "A" | |
| }, | |
| { | |
| "id": "2", | |
| "name": "B" | |
| }, | |
| { |
This file contains hidden or 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
| <script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="onexlab" data-color="#FFDD00" data-emoji="" data-font="Cookie" data-text="Buy us a coffee" data-outline-color="#000" data-font-color="#000" data-coffee-color="#fff" ></script> |
This file contains hidden or 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
| version: '3.6' | |
| services: | |
| db: | |
| image: mysql | |
| command: --default-authentication-plugin=mysql_native_password | |
| restart: always | |
| environment: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: mydb |
This file contains hidden or 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
| CREATE TABLE student ( | |
| id int, | |
| name VARCHAR(255) | |
| ); | |
| INSERT INTO student(id, name) VALUES | |
| (1,'A'), | |
| (2,'B'), | |
| (3,'C'); |
This file contains hidden or 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
| 'use strict'; | |
| module.exports.hello = async event => { | |
| return { | |
| statusCode: 200, | |
| body: JSON.stringify( | |
| { | |
| message: 'Go Serverless v1.0! Your function executed successfully!', | |
| input: event, | |
| }, |