dao

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(user string, pwd string) auth

Auth creates the authentication options for persistance service nolint: revive

func NewConnection added in v0.0.3

func NewConnection(s server, a auth) (driver.Conn, error)

New Clickhouse connection nolint: revive

func Opts

func Opts(prefix string) *opts

Opts creates the options for persistance service nolint: revive

func Server

func Server(host string, port int16, db string) server

Server creates the datastore (click house) options nolint: revive

Types

type DAO

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

DAO is data access object for clickhouse database

func New

func New(conn clickhouse.Conn, opts *opts) *DAO

New creates persistance service nolint: revive

func (*DAO) Close added in v0.0.3

func (p *DAO) Close() error

Close the clickhouse connection

func (*DAO) DeleteOwnerHostname added in v0.0.3

func (p *DAO) DeleteOwnerHostname(hostname, username string) error

DeleteOwnerHostname deletes the hostname

func (*DAO) GetSubscription added in v0.0.3

func (p *DAO) GetSubscription(id string) (*types.SubscriptionWithHostname, error)

GetSubscription gets subscription by id

func (*DAO) GetSubscriptions added in v0.0.3

func (p *DAO) GetSubscriptions() (map[string]*types.SubscriptionWithHostname, error)

GetSubscriptions gets all subscriptions

func (*DAO) InsertOwnerHostname added in v0.0.3

func (p *DAO) InsertOwnerHostname(item types.OwnerHostname) error

InsertOwnerHostname inserts a new hostname

func (*DAO) Save

func (p *DAO) Save(rumEvent beacon.RumEvent) error

Save stores data into table in clickhouse database

func (*DAO) SaveHost added in v0.0.3

func (p *DAO) SaveHost(event beacon.HostnameEvent) error

SaveHost stores hostname data into table in clickhouse database

type IDAO added in v0.0.3

type IDAO interface {
	Close() error
	Save(rumEvent beacon.RumEvent) error
	SaveHost(event beacon.HostnameEvent) error
	InsertOwnerHostname(item types.OwnerHostname) error
	DeleteOwnerHostname(hostname, username string) error
	GetSubscriptions() (map[string]*types.SubscriptionWithHostname, error)
	GetSubscription(id string) (*types.SubscriptionWithHostname, error)
}

IDAO is data access object inteface

type MigrationDAO added in v0.0.3

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

MigrationDAO is data access object for clickhouse database

func NewMigrationDAO added in v0.0.3

func NewMigrationDAO(s server, a auth, opts *opts) *MigrationDAO

New creates persistance service nolint: revive

func (*MigrationDAO) Migrate added in v0.0.3

func (p *MigrationDAO) Migrate() error

Migrate applies all pending database migrations

Directories

Path Synopsis
Package daomocks is a generated GoMock package.
Package daomocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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