gorm

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

DefaultTypes contains a list of internal types that need to be migrated by default

Functions

func NewStorage

func NewStorage(opts ...StorageOption) (s persistence.Storage, err error)

NewStorage creates a new storage using GORM (which DB to use depends on the StorageOption)

Types

type StorageOption

type StorageOption func(*storage)

StorageOption is a functional option type to configure the GORM storage. E.g. WithInMemory or WithPostgres

func WithAdditionalAutoMigration added in v1.4.11

func WithAdditionalAutoMigration(types ...any) StorageOption

WithAdditionalAutoMigration is an option to add additional types to GORM's auto-migration.

func WithInMemory

func WithInMemory() StorageOption

WithInMemory is an option to configure Storage to use an in memory DB

func WithLogger added in v1.4.9

func WithLogger(logger logger.Interface) StorageOption

WithLogger is an option to configure Storage to use a Logger

func WithMaxOpenConns added in v1.4.12

func WithMaxOpenConns(max int) StorageOption

WithMaxOpenConns is an option to configure the maximum number of open connections

func WithPostgres

func WithPostgres(host string, port int16, user string, pw string, db string) StorageOption

WithPostgres is an option to configure Storage to use a Postgres DB

Jump to

Keyboard shortcuts

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