postgres

package
v0.0.0-...-be55266 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("postgres: record not found in the table")
	ErrAlreadyExists = errors.New("postgres: record already exists in the table")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	URI string `env:"URI"`
}

type CreateUserOpts

type CreateUserOpts struct {
	Email    string
	Name     string
	Password string
}

type Service

type Service interface {
	Ping(context.Context) error
	Close()
}

func NewService

func NewService(ctx context.Context, cfg Config) (Service, error)

type User

type User struct {
	Id        int64
	Email     string
	Name      string
	Password  string
	CreatedAt time.Time
}

type UserService

type UserService interface {
	GetById(context.Context, int64) (User, error)
	GetByEmail(context.Context, string) (User, error)
	Create(context.Context, CreateUserOpts) (int64, time.Time, error)
	EditEmail(context.Context, int64, string) error
	EditName(context.Context, int64, string) error
	EditPassword(context.Context, int64, string) error
	Delete(context.Context, int64) error
}

func NewUserService

func NewUserService(ctx context.Context, svc Service) (UserService, error)

Jump to

Keyboard shortcuts

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