Skip to content

ximmanuel/Gyad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gyad - Get Your API Data

Overview

A lightweight backend system built in Go designed to simplify the management and access to data through APIs.

Features

  • Database Migrations: Easily create, manage, and rollback database migrations using simple command-line operations.
  • ORM: A simple ORM that allows you to interact with the database using Go structs (XORM).
  • API Controllers: Facilitate and manage RESTful APIs that enable clients to interact with the backend.

Example model

import "time"

type Bober struct {
	ID        string    `xorm:"pk uuid 'id'"`
	Name      string    `xorm:"varchar(255) 'name'"`
	Age       int       `xorm:"int 'age'"`
	CreatedAt time.Time `xorm:"created"`
	UpdatedAt time.Time `xorm:"updated"`
}

Prerequisites

  • Go (version 1.22 or higher)
  • A PostgreSQL Database

Installation

Step 1: Clone the repository

git clone git@github.com:ximmanuel/Gyad.git

Step 2: Run postgres docker container

docker run --name postgresql -p 5432:5432 -e POSTGRES_PASSWORD=changeMe -d postgres

Step 3: Rename the .env.example file to .env and adjust the values

cp .env.example .env

Step 4: Run the application

go run cmd/main.go

Migration

Create Migration

./migration create bober

Run all migrations:

./migration migrate all

Migrations are executed one after the other based on the timestamps.

Run specific migratrion:

./migration migrate bober

Rollback specific migration:

./migration rollback bober

Releases

No releases published

Packages

No packages published

Languages