orm

package
v0.0.0-...-e10842c Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package orm provides `GORM` helpers for the creation, migration and access on the project's database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ORM

type ORM struct {
	DB *gorm.DB
}

ORM struct to holds the gorm pointer to db

func Init

func Init(c *cfg.DB) (*ORM, error)

Init creates a db connection with the selected dialect and connection along with running all the db migrations

func (*ORM) FindUserByAPIKey

func (o *ORM) FindUserByAPIKey(apiKey string) (*models.User, error)

FindUserByAPIKey finds the user that is related to the API key

func (*ORM) FindUserByJWT

func (o *ORM) FindUserByJWT(email string, provider string, userID string) (*models.User, error)

FindUserByJWT finds the user that is related to the APIKey token

func (*ORM) UpsertUserProfile

func (o *ORM) UpsertUserProfile(gu *goth.User) (*models.User, error)

UpsertUserProfile saves the user if doesn't exists and adds the OAuth profile and updates existing user info if record exist in db

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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