dal

package
v0.0.0-...-31f8248 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRequestStats

func ValidateRequestStats(req RequestStats) bool

ValidateRequestStats checks that the data in this request object is valid to be inserted in DB

Types

type CassandraDBClient

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

CassandraDBClient an implementation for DBClient wrapping cassandra DB client

func (*CassandraDBClient) BulkInsert

func (cdbc *CassandraDBClient) BulkInsert(insertQueries []string) error

BulkInsert does a bulk/batch insert of records into the DB

func (*CassandraDBClient) InitSession

func (cdbc *CassandraDBClient) InitSession() error

InitSession starts a new db session and returns a flag for the status of the operation

type DBClient

type DBClient interface {
	// InitSession starts a new db session and returns a flag for
	// the status of the operation
	InitSession() error
	// BulkInsert does a bulk/batch insert of records into the DB
	BulkInsert([]string) error
}

DBClient Contract defining the required functionalities that need to be avaiable in any DB client to work with other components using the DB

type RequestModel

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

RequestModel structure holding an orm like wrapper around RequestStats table

func (*RequestModel) CreateRequestStats

func (rm *RequestModel) CreateRequestStats(requests []RequestStats) bool

CreateRequestStats batch based insertion method to create new request state objects in DB

func (*RequestModel) IntializeDBSession

func (rm *RequestModel) IntializeDBSession(dbClient *DBClient)

IntializeDBSession starts a new session with cassendra DB

type RequestStats

type RequestStats struct {
	URL                string `json:"url"`
	Method             string `json:"http_method"`
	TimeInMilliseconds int    `json:"response_time"`
	Service            string `json:"service_name"`
	Status             uint16 `json:"status_code"`
	CreatedAt          string `json:"created_at"`
}

RequestStats structure holding data for the request stats table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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