repository

package
v0.0.0-...-9e73b81 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(ctx context.Context, cfg Config) (*sqlx.DB, error)

Types

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
	SSLMode  string
}

type Connection

type Connection interface {
	GetLastConnectionPortCount(ctx context.Context) (*entity.ConnectionPortCount, error)
	CreateConnection(ctx context.Context, connection *entity.Connection) (int, error)
	GetConnectionsByUserId(ctx context.Context, id int64) ([]entity.Connection, error)
	GetConnectionById(ctx context.Context, id int) (*entity.Connection, error)
	GetConnectionByServerId(ctx context.Context, id int) (*entity.Connection, error)
	SaveConnection(ctx context.Context, conn *entity.Connection) error
}

type ConnectionRepository

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

func NewConnectionRepository

func NewConnectionRepository(db *sqlx.DB, log logger.Logger) *ConnectionRepository

func (*ConnectionRepository) CreateConnection

func (c *ConnectionRepository) CreateConnection(ctx context.Context, conn *entity.Connection) (int, error)

func (*ConnectionRepository) GetConnectionById

func (c *ConnectionRepository) GetConnectionById(ctx context.Context, id int) (*entity.Connection, error)

func (*ConnectionRepository) GetConnectionByServerId

func (c *ConnectionRepository) GetConnectionByServerId(ctx context.Context, id int) (*entity.Connection, error)

func (*ConnectionRepository) GetConnectionsByUserId

func (c *ConnectionRepository) GetConnectionsByUserId(ctx context.Context, id int64) ([]entity.Connection, error)

func (*ConnectionRepository) GetLastConnectionPortCount

func (c *ConnectionRepository) GetLastConnectionPortCount(ctx context.Context) (*entity.ConnectionPortCount, error)

func (*ConnectionRepository) SaveConnection

func (c *ConnectionRepository) SaveConnection(ctx context.Context, conn *entity.Connection) error

type Repo

type Repo struct {
}

type Repository

type Repository struct {
	Connection
}

func NewRepository

func NewRepository(db *sqlx.DB, log logger.Logger) *Repository

Jump to

Keyboard shortcuts

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