database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func Init

func Init(dsn string, logger zerolog.Logger) (*Database, error)

func (*Database) AutoMigrate

func (d *Database) AutoMigrate() error

func (*Database) Close

func (d *Database) Close()

func (*Database) Create

func (d *Database) Create(user models.User) error

func (*Database) Fetch

func (d *Database) Fetch(email string) (models.User, error)

func (*Database) FetchByID

func (d *Database) FetchByID(id string) (models.User, error)

type MockupDatabase

type MockupDatabase struct {
	// contains filtered or unexported fields
}

func NewMockupDatabase

func NewMockupDatabase() *MockupDatabase

func (*MockupDatabase) AutoMigrate

func (m *MockupDatabase) AutoMigrate() error

func (*MockupDatabase) Close

func (m *MockupDatabase) Close()

func (*MockupDatabase) Create

func (m *MockupDatabase) Create(user models.User) error

func (*MockupDatabase) Fetch

func (m *MockupDatabase) Fetch(email string) (models.User, error)

func (*MockupDatabase) FetchByID

func (m *MockupDatabase) FetchByID(id string) (models.User, error)

type Repository

type Repository interface {
	AutoMigrate() error
	Create(user models.User) error
	Fetch(email string) (models.User, error)
	FetchByID(id string) (models.User, error)
	Close()
}

Jump to

Keyboard shortcuts

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