postgres

package
v0.0.0-...-dae980f Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnString

func ConnString(host string, port int, user string, dbName string) string

ConnString returns a connection string based on the parameters it's given This would normally also contain the password, however we're not using one

Types

type Db

type Db struct {
	*sql.DB
}

Db is our database struct used for interacting with the database

func New

func New(connString string) (*Db, error)

New makes a new database using the connection string and returns it, otherwise returns the error

func (*Db) GetUsersByName

func (d *Db) GetUsersByName(name string) []User

GetUsersByName is called within our user query for graphql

type User

type User struct {
	ID         int
	Name       string
	Age        int
	Profession string
	Friendly   bool
}

User shape

Jump to

Keyboard shortcuts

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