repository

package
v0.0.0-...-e01f8af Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package repository provides a postgres implementation of the GIF repo interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	DB *gorm.DB
}

Repo provides access to the database through an abstraction that allows for swapping out the datastore and not breaking application logic

func New

func New(orm *gorm.DB) (*Repo, error)

New initializes the repo with the ORM

func (*Repo) InitDB

func (r *Repo) InitDB() error

InitDB provides hooks to ensure tables and migrations are performed

func (*Repo) Insert

func (r *Repo) Insert(g *models.GIF) error

Insert will add a gif into the database

func (*Repo) Last

func (r *Repo) Last() (*models.GIF, error)

Last gets the latest entry from the database

func (*Repo) Update

func (r *Repo) Update(g *models.GIF) error

Update performs updates to a record

Jump to

Keyboard shortcuts

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