gopostgres

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: MIT Imports: 2 Imported by: 0

README

Gopostgres

A simple way to use migrations and postgres with go.

Usage

Create this fields in your .env file:

POSTGRES_USER=your_user
POSTGRES_PASSWORD=your_password
POSTGRES_DB=your_database_name
POSTGRES_HOST=your_host
POSTGRES_PORT=your_port

After that call the GetDatabase function in your main function:

import "github.com/johnazedo/gopostgres"

func main() {
    db, err := gopostgres.GetDatabase()
    if err != nil {
        panic(err)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabase added in v0.0.2

func GetDatabase() (*gorm.DB, error)

Types

type Migration

type Migration struct {
	ID       string
	Migrate  func(*gorm.DB) error
	RollBack func(*gorm.DB) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL