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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: my-deployment | |
namespace: my-namespace | |
labels: | |
app: my-deployment | |
spec: | |
replicas: 2 | |
selector: |
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
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: my-pod | |
namespace: my-namespace | |
spec: | |
containers: | |
- name: my-pod-container | |
image: go-chronicles-pod | |
imagePullPolicy: Never |
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
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: my-pod | |
namespace: my-namespace | |
spec: | |
containers: | |
- name: my-pod-container | |
image: go-chronicles-pod | |
imagePullPolicy: Never |
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
wget https://raw.githubusercontent.com/devtron-labs/devtron/main/manifests/install/devtron-operator-configs.yaml | |
kubectl create ns devtroncd | |
kubectl -n devtroncd apply -f https://raw.githubusercontent.com/devtron-labs/charts/main/charts/devtron/crds/crd-devtron.yaml | |
kubectl apply -n devtroncd -f https://raw.githubusercontent.com/devtron-labs/charts/main/charts/devtron/templates/install.yaml | |
kubectl apply -n devtroncd -f devtron-operator-configs.yaml | |
kubectl apply -n devtroncd -f https://raw.githubusercontent.com/devtron-labs/devtron/main/manifests/install/devtron-installer.yaml |
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
package rest | |
import ( | |
"encoding/json" | |
"net/http" | |
"net/http/httptest" | |
"strconv" | |
"strings" | |
"testing" |
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
package rest | |
import ( | |
"encoding/json" | |
"net/http" | |
"net/http/httptest" | |
"strconv" | |
"strings" | |
"testing" |
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
var imageDir string = "images" | |
func UploadPetImage(c echo.Context) error { | |
// Get id from Multipart form data | |
id, err := strconv.Atoi(c.FormValue("id")) | |
// get file form form data | |
file, err := c.FormFile("file") | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, "Couldn't read file from form value") | |
} |
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
//CreateCategory : create a new Category in DB | |
func (c *Category) CreateCategory() error { | |
// prepare the query | |
stmt, err := client.DbClient.Prepare("INSERT INTO category (category_name) values ($1);") | |
if err != nil { | |
return err | |
} | |
//closing the statement to prevent memory leaks | |
defer stmt.Close() |
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
//CreateCategory : create a new Category in DB | |
func (c *Category) CreateCategory() (int, error) { | |
//Create and execute the query | |
row := client.DbClient.QueryRow("INSERT INTO category (category_name) values ($1) RETURNING id;", c.CategoryName) | |
// save the data in an object | |
switch err := row.Scan(&c.ID); err { | |
// success, no errors | |
case nil: | |
return c.ID, nil | |
// In case of no output rows |
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
//GetAllCategory : Get all Categories from DB | |
func (c Category) GetAllCategory() ([]*models.Category, error) { | |
var categories []*models.Category // this will hold final result | |
//execute the query | |
rows, err := client.DbClient.Query("SELECT * from category") | |
defer rows.Close() | |
// iterate through rows | |
for rows.Next() { | |
// Bind to model | |
err = rows.Scan(&c.ID, &c.CategoryName) |
NewerOlder