orm

package
v0.0.0-...-2e80e89 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 13 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

func ParseFilters

func ParseFilters(db *gorm.DB, filters []*models.QueryFilter) (*gorm.DB, error)

ParseFilters parses the filter and adds the where condition to the transaction

Types

type ORM

type ORM struct {
	DB *gorm.DB
}

ORM struct to holds the gorm pointer to db

func Factory

func Factory(cfg *utils.ServerConfig) (*ORM, error)

Factory creates a db connection with the selected dialect and connection string

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(input *goth.User) (*models.User, error)

UpsertUserProfile saves the user if doesn't exists and adds the OAuth profile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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