postgres

package
v0.0.0-...-0b10b3f Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetectorModel

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

func (*DetectorModel) Create

func (m *DetectorModel) Create(ctx context.Context, detector *echosight.Detector) error

func (*DetectorModel) DeleteByID

func (m *DetectorModel) DeleteByID(ctx context.Context, id uuid.UUID) (*echosight.Detector, error)

func (*DetectorModel) GetByID

func (m *DetectorModel) GetByID(ctx context.Context, id uuid.UUID) (*echosight.Detector, error)

func (*DetectorModel) GetByName

func (m *DetectorModel) GetByName(ctx context.Context, name string) (*echosight.Detector, error)

func (*DetectorModel) List

func (m *DetectorModel) List(ctx context.Context, detectorFilter *filter.DetectorFilter) ([]*echosight.Detector, error)

func (*DetectorModel) Update

func (m *DetectorModel) Update(ctx context.Context, detector *echosight.Detector) error

type HostModel

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

func (*HostModel) Create

func (m *HostModel) Create(ctx context.Context, host *echosight.Host) error

func (*HostModel) DeleteByID

func (m *HostModel) DeleteByID(ctx context.Context, id uuid.UUID) (*echosight.Host, error)

func (*HostModel) GetByID

func (m *HostModel) GetByID(ctx context.Context, id uuid.UUID) (*echosight.Host, error)

func (*HostModel) GetByName

func (m *HostModel) GetByName(ctx context.Context, name string) (*echosight.Host, error)

func (*HostModel) List

func (m *HostModel) List(ctx context.Context, hostFilter *filter.HostFilter) ([]*echosight.Host, error)

func (*HostModel) Update

func (m *HostModel) Update(ctx context.Context, host *echosight.Host) error

type PostgresDB

type PostgresDB struct {
	Users       UserModel
	Hosts       HostModel
	Detectors   DetectorModel
	Recipients  RecipientModel
	Preferences PreferenceModel
	Sessions    SessionModel
	// contains filtered or unexported fields
}

func New

func New(dsn string) (*PostgresDB, error)

func (*PostgresDB) Bun

func (db *PostgresDB) Bun() *bun.DB

func (*PostgresDB) Close

func (db *PostgresDB) Close() error

type PreferenceModel

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

func (*PreferenceModel) AllPreferences

func (p *PreferenceModel) AllPreferences(ctx context.Context) (*es.Preferences, error)

func (*PreferenceModel) DeleteByName

func (p *PreferenceModel) DeleteByName(ctx context.Context, name string) error

func (*PreferenceModel) GetByName

func (p *PreferenceModel) GetByName(ctx context.Context, name string) (*es.Preference, error)

func (*PreferenceModel) List

func (p *PreferenceModel) List(ctx context.Context, prefFilter *filter.PreferenceFilter) (*es.Preferences, error)

func (*PreferenceModel) Set

func (p *PreferenceModel) Set(ctx context.Context, pref *es.Preference) error

Set sets the preference by name. If a pref exists with the given name, it will be overwritten.

func (*PreferenceModel) SetAll

func (p *PreferenceModel) SetAll(ctx context.Context, prefs *es.Preferences) error

func (*PreferenceModel) Update

func (p *PreferenceModel) Update(ctx context.Context, pref *es.Preference) error

type RecipientModel

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

func (*RecipientModel) Create

func (m *RecipientModel) Create(ctx context.Context, recipient *es.Recipient) error

func (*RecipientModel) DeleteByID

func (m *RecipientModel) DeleteByID(ctx context.Context, id uuid.UUID) (*es.Recipient, error)

func (*RecipientModel) GetByEmail

func (m *RecipientModel) GetByEmail(ctx context.Context, email string) (*es.Recipient, error)

func (*RecipientModel) GetByID

func (m *RecipientModel) GetByID(ctx context.Context, id uuid.UUID) (*es.Recipient, error)

func (*RecipientModel) List

func (m *RecipientModel) List(ctx context.Context, rcptFilter *filter.RecipientFilter) ([]*es.Recipient, error)

func (*RecipientModel) Update

func (m *RecipientModel) Update(ctx context.Context, rcpt *es.Recipient) error

type SessionModel

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

func (*SessionModel) Delete

func (m *SessionModel) Delete(ctx context.Context, token string) error

func (*SessionModel) Get

func (m *SessionModel) Get(ctx context.Context, token string) (*es.Session, bool, error)

func (*SessionModel) Put

func (m *SessionModel) Put(ctx context.Context, session *es.Session) error

func (*SessionModel) StartCleanup

func (m *SessionModel) StartCleanup(interval time.Duration)

func (*SessionModel) StopCleanup

func (m *SessionModel) StopCleanup()

type UserModel

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

func (*UserModel) Create

func (m *UserModel) Create(ctx context.Context, user *echosight.User) error

func (*UserModel) DeleteByID

func (m *UserModel) DeleteByID(ctx context.Context, id uuid.UUID) (*echosight.User, error)

func (*UserModel) GetByEmail

func (m *UserModel) GetByEmail(ctx context.Context, email string) (*echosight.User, error)

func (*UserModel) GetByID

func (m *UserModel) GetByID(ctx context.Context, id uuid.UUID) (*echosight.User, error)

func (*UserModel) List

func (m *UserModel) List(ctx context.Context, userFilter *filter.UserFilter) ([]*echosight.User, error)

func (*UserModel) Update

func (m *UserModel) Update(ctx context.Context, user *echosight.User) error

Jump to

Keyboard shortcuts

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