logs

package
v0.0.0-...-936ad11 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package logs contains the sqlite database schema

Index

Constants

This section is empty.

Variables

View Source
var MasterSchema string

MasterSchema is the schema for the main database

Functions

This section is empty.

Types

type DeleteLogByIdParams

type DeleteLogByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteLogLevelByIdParams

type DeleteLogLevelByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteNotificationByIdParams

type DeleteNotificationByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteRequestByIdParams

type DeleteRequestByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteResponseByIdParams

type DeleteResponseByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type ErrWrite

type ErrWrite struct {
	Message string
}

ErrWrite is an error for when the write fails

func (ErrWrite) Error

func (e ErrWrite) Error() string

Error implements the error interface

type GetLogByIdParams

type GetLogByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetLogLevelByNameParams

type GetLogLevelByNameParams struct {
	Name string `db:"name" json:"name"`
}

type GetLogsByNotificationIdParams

type GetLogsByNotificationIdParams struct {
	NotificationID *int64 `db:"notification_id" json:"notification_id"`
}

type GetLogsByRequestIdParams

type GetLogsByRequestIdParams struct {
	RequestID *int64 `db:"request_id" json:"request_id"`
}

type GetLogsByResponseIdParams

type GetLogsByResponseIdParams struct {
	ResponseID *int64 `db:"response_id" json:"response_id"`
}

type GetNotificationByIdParams

type GetNotificationByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetNotificationsByMethodParams

type GetNotificationsByMethodParams struct {
	Method string `db:"method" json:"method"`
}

type GetRequestByIdParams

type GetRequestByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetRequestsByMethodParams

type GetRequestsByMethodParams struct {
	RpcMethod string `db:"rpc_method" json:"rpc_method"`
}

type GetResponseByIdParams

type GetResponseByIdParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetResponsesByRpcIdParams

type GetResponsesByRpcIdParams struct {
	RpcID int64 `db:"rpc_id" json:"rpc_id"`
}

type InsertLogLevelParams

type InsertLogLevelParams struct {
	Name string `db:"name" json:"name"`
}

type InsertLogParams

type InsertLogParams struct {
	Value          string `db:"value" json:"value"`
	RequestID      *int64 `db:"request_id" json:"request_id"`
	ResponseID     *int64 `db:"response_id" json:"response_id"`
	NotificationID *int64 `db:"notification_id" json:"notification_id"`
}

type InsertNotificationParams

type InsertNotificationParams struct {
	Method string `db:"method" json:"method"`
}

type InsertRequestParams

type InsertRequestParams struct {
	RpcMethod string `db:"rpc_method" json:"rpc_method"`
	RpcID     int64  `db:"rpc_id" json:"rpc_id"`
}

type InsertResponseParams

type InsertResponseParams struct {
	Rpc    string  `db:"rpc" json:"rpc"`
	RpcID  int64   `db:"rpc_id" json:"rpc_id"`
	Result *string `db:"result" json:"result"`
	Error  *string `db:"error" json:"error"`
}

type Log

type Log struct {
	ID             int64      `db:"id" json:"id"`
	Value          string     `db:"value" json:"value"`
	CreatedAt      *time.Time `db:"created_at" json:"created_at"`
	RequestID      *int64     `db:"request_id" json:"request_id"`
	ResponseID     *int64     `db:"response_id" json:"response_id"`
	NotificationID *int64     `db:"notification_id" json:"notification_id"`
}

type LogLevel

type LogLevel struct {
	ID   int64  `db:"id" json:"id"`
	Name string `db:"name" json:"name"`
}

type Notification

type Notification struct {
	ID        int64     `db:"id" json:"id"`
	Method    string    `db:"method" json:"method"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type Prime

type Prime struct {
	Log          Log          `json:"log"`
	LogLevel     LogLevel     `json:"log_level"`
	Notification Notification `json:"notification,omitempty"`
	Request      Request      `json:"request,omitempty"`
	Response     Response     `json:"response,omitempty"`
}

Prime is the prime for the logs table

type Queries

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

Queries is the object to use to interact with the database.

func New

func New(db generic.DBTX) *Queries

New creates a new queries type

func (*Queries) DeleteLogById

func (q *Queries) DeleteLogById(ctx context.Context, arg DeleteLogByIdParams) error

DeleteLogById

DELETE FROM logs
WHERE id = ?

func (*Queries) DeleteLogLevelById

func (q *Queries) DeleteLogLevelById(ctx context.Context, arg DeleteLogLevelByIdParams) error

DeleteLogLevelById

DELETE FROM log_levels
WHERE id = ?

func (*Queries) DeleteNotificationById

func (q *Queries) DeleteNotificationById(ctx context.Context, arg DeleteNotificationByIdParams) error

DeleteNotificationById

DELETE FROM notifications
WHERE id = ?

func (*Queries) DeleteRequestById

func (q *Queries) DeleteRequestById(ctx context.Context, arg DeleteRequestByIdParams) error

DeleteRequestById

DELETE FROM requests
WHERE id = ?

func (*Queries) DeleteResponseById

func (q *Queries) DeleteResponseById(ctx context.Context, arg DeleteResponseByIdParams) error

DeleteResponseById

DELETE FROM responses
WHERE id = ?

func (*Queries) GetLogById

func (q *Queries) GetLogById(ctx context.Context, arg GetLogByIdParams) (*Log, error)

****************************************************************************

SELECT id, value, created_at, request_id, response_id, notification_id
FROM logs
WHERE id = ?

func (*Queries) GetLogLevelByName

func (q *Queries) GetLogLevelByName(ctx context.Context, arg GetLogLevelByNameParams) (*LogLevel, error)

GetLogLevelByName

SELECT id, name
FROM log_levels
WHERE name = ?

func (*Queries) GetLogsByNotificationId

func (q *Queries) GetLogsByNotificationId(ctx context.Context, arg GetLogsByNotificationIdParams) ([]*Log, error)

GetLogsByNotificationId

SELECT id, value, created_at, request_id, response_id, notification_id
FROM logs
WHERE notification_id = ?

func (*Queries) GetLogsByRequestId

func (q *Queries) GetLogsByRequestId(ctx context.Context, arg GetLogsByRequestIdParams) ([]*Log, error)

GetLogsByRequestId

SELECT id, value, created_at, request_id, response_id, notification_id
FROM logs
WHERE request_id = ?

func (*Queries) GetLogsByResponseId

func (q *Queries) GetLogsByResponseId(ctx context.Context, arg GetLogsByResponseIdParams) ([]*Log, error)

GetLogsByResponseId

SELECT id, value, created_at, request_id, response_id, notification_id
FROM logs
WHERE response_id = ?

func (*Queries) GetNotificationById

func (q *Queries) GetNotificationById(ctx context.Context, arg GetNotificationByIdParams) (*Notification, error)

****************************************************************************

SELECT id, method, created_at, updated_at
FROM notifications
WHERE id = ?

func (*Queries) GetNotificationsByMethod

func (q *Queries) GetNotificationsByMethod(ctx context.Context, arg GetNotificationsByMethodParams) ([]*Notification, error)

GetNotificationsByMethod

SELECT id, method, created_at, updated_at
FROM notifications
WHERE method = ?

func (*Queries) GetRequestById

func (q *Queries) GetRequestById(ctx context.Context, arg GetRequestByIdParams) (*Request, error)

****************************************************************************

SELECT id, rpc_method, rpc_id
FROM requests
WHERE id = ?

func (*Queries) GetRequestsByMethod

func (q *Queries) GetRequestsByMethod(ctx context.Context, arg GetRequestsByMethodParams) ([]*Request, error)

GetRequestsByMethod

SELECT id, rpc_method, rpc_id
FROM requests
WHERE rpc_method = ?

func (*Queries) GetResponseById

func (q *Queries) GetResponseById(ctx context.Context, arg GetResponseByIdParams) (*Response, error)

****************************************************************************

SELECT id, rpc, rpc_id, result, error, created_at
FROM responses
WHERE id = ?

func (*Queries) GetResponsesByRpcId

func (q *Queries) GetResponsesByRpcId(ctx context.Context, arg GetResponsesByRpcIdParams) ([]*Response, error)

GetResponsesByRpcId

SELECT id, rpc, rpc_id, result, error, created_at
FROM responses
WHERE rpc_id = ?

func (*Queries) InsertLog

func (q *Queries) InsertLog(ctx context.Context, arg InsertLogParams) (*Log, error)

InsertLog

INSERT INTO logs (value, request_id, response_id, notification_id)
VALUES (?, ?, ?, ?) RETURNING id, value, created_at, request_id, response_id, notification_id

func (*Queries) InsertLogLevel

func (q *Queries) InsertLogLevel(ctx context.Context, arg InsertLogLevelParams) (*LogLevel, error)

InsertLogLevel

INSERT INTO log_levels (name)
VALUES (?) RETURNING id, name

func (*Queries) InsertNotification

func (q *Queries) InsertNotification(ctx context.Context, arg InsertNotificationParams) (*Notification, error)

InsertNotification

INSERT INTO notifications (method)
VALUES (?) RETURNING id, method, created_at, updated_at

func (*Queries) InsertRequest

func (q *Queries) InsertRequest(ctx context.Context, arg InsertRequestParams) (*Request, error)

InsertRequest

INSERT INTO requests (rpc_method, rpc_id)
VALUES (?, ?) RETURNING id, rpc_method, rpc_id

func (*Queries) InsertResponse

func (q *Queries) InsertResponse(ctx context.Context, arg InsertResponseParams) (*Response, error)

InsertResponse

INSERT INTO responses (rpc, rpc_id, result, error)
VALUES (?, ?, ?, ?) RETURNING id, rpc, rpc_id, result, error, created_at

func (*Queries) UpdateLogById

func (q *Queries) UpdateLogById(ctx context.Context, arg UpdateLogByIdParams) (*Log, error)

UpdateLogById

UPDATE logs
SET value = ?, request_id = ?, response_id = ?, notification_id = ?
WHERE id = ? RETURNING id, value, created_at, request_id, response_id, notification_id

func (*Queries) UpdateLogLevelById

func (q *Queries) UpdateLogLevelById(ctx context.Context, arg UpdateLogLevelByIdParams) (*LogLevel, error)

UpdateLogLevelById

UPDATE log_levels
SET name = ?
WHERE id = ?
RETURNING id, name

func (*Queries) UpdateNotificationById

func (q *Queries) UpdateNotificationById(ctx context.Context, arg UpdateNotificationByIdParams) (*Notification, error)

UpdateNotificationById

UPDATE notifications
SET method = ?, updated_at = CURRENT_TIMESTAMP
WHERE id = ? RETURNING id, method, created_at, updated_at

func (*Queries) UpdateRequestById

func (q *Queries) UpdateRequestById(ctx context.Context, arg UpdateRequestByIdParams) (*Request, error)

UpdateRequestById

UPDATE requests
SET rpc_method = ?, rpc_id = ?
WHERE id = ? RETURNING id, rpc_method, rpc_id

func (*Queries) UpdateResponseById

func (q *Queries) UpdateResponseById(ctx context.Context, arg UpdateResponseByIdParams) error

UpdateResponseById

UPDATE responses
SET rpc = ?, rpc_id = ?, result = ?, error = ?
WHERE id = ?

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

WithTx creates a new queries type with a transaction.

func (*Queries) Write

func (q *Queries) Write(p []byte) (n int, err error)

Write writes the given bytes to the database

type Request

type Request struct {
	ID        int64  `db:"id" json:"id"`
	RpcMethod string `db:"rpc_method" json:"rpc_method"`
	RpcID     int64  `db:"rpc_id" json:"rpc_id"`
}

type Response

type Response struct {
	ID        int64     `db:"id" json:"id"`
	Rpc       string    `db:"rpc" json:"rpc"`
	RpcID     int64     `db:"rpc_id" json:"rpc_id"`
	Result    *string   `db:"result" json:"result"`
	Error     *string   `db:"error" json:"error"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
}

type UpdateLogByIdParams

type UpdateLogByIdParams struct {
	Value          string `db:"value" json:"value"`
	RequestID      *int64 `db:"request_id" json:"request_id"`
	ResponseID     *int64 `db:"response_id" json:"response_id"`
	NotificationID *int64 `db:"notification_id" json:"notification_id"`
	ID             int64  `db:"id" json:"id"`
}

type UpdateLogLevelByIdParams

type UpdateLogLevelByIdParams struct {
	Name string `db:"name" json:"name"`
	ID   int64  `db:"id" json:"id"`
}

type UpdateNotificationByIdParams

type UpdateNotificationByIdParams struct {
	Method string `db:"method" json:"method"`
	ID     int64  `db:"id" json:"id"`
}

type UpdateRequestByIdParams

type UpdateRequestByIdParams struct {
	RpcMethod string `db:"rpc_method" json:"rpc_method"`
	RpcID     int64  `db:"rpc_id" json:"rpc_id"`
	ID        int64  `db:"id" json:"id"`
}

type UpdateResponseByIdParams

type UpdateResponseByIdParams struct {
	Rpc    string  `db:"rpc" json:"rpc"`
	RpcID  int64   `db:"rpc_id" json:"rpc_id"`
	Result *string `db:"result" json:"result"`
	Error  *string `db:"error" json:"error"`
	ID     int64   `db:"id" json:"id"`
}

Jump to

Keyboard shortcuts

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