view

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package view provides a simple way of checking access to a table

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessInfo added in v1.1.8

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

AccessInfo holds a database and table name and information on whether the table is reachable

func NewAccessInfo added in v1.1.8

func NewAccessInfo(database, table string) AccessInfo

NewAccessInfo returns a new AccessInfo type

func (*AccessInfo) CheckSelectError added in v1.1.8

func (ta *AccessInfo) CheckSelectError(db *sql.DB) error

CheckSelectError returns whether SELECT works on the table

func (AccessInfo) Database added in v1.1.8

func (ta AccessInfo) Database() string

Database returns the database name

func (AccessInfo) Name added in v1.1.8

func (ta AccessInfo) Name() string

Name returns the fully qualified table name

func (AccessInfo) SelectError added in v1.1.8

func (ta AccessInfo) SelectError() error

SelectError returns the result of ta.selectError

func (AccessInfo) Table added in v1.1.8

func (ta AccessInfo) Table() string

Table returns the table name

type Code added in v0.6.0

type Code int

Code represents the type of information to view (as an int)

const (
	ViewNone    Code = iota // view nothing (should never be set)
	ViewLatency             // view the table latency information
	ViewOps                 // view the table information by number of operations
	ViewIO                  // view the file I/O information
	ViewLocks               // view lock information
	ViewUsers               // view user information
	ViewMutex               // view mutex information
	ViewStages              // view SQL stages information
	ViewMemory              // view memory usage (5.7+)
)

View* constants represent different views we can see

func (Code) String added in v0.6.0

func (s Code) String() string

type View

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

View holds the integer type of view (maybe need to fix this setup)

func SetupAndValidate added in v1.0.15

func SetupAndValidate(name string, db *sql.DB) View

SetupAndValidate setups the view configuration and validates if accesss to the p_s tables is permitted.

func (View) Get

func (v View) Get() Code

Get returns the Code version of the current view

func (View) Name added in v0.6.0

func (v View) Name() string

Name returns the string version of the current view

func (*View) Set

func (v *View) Set(viewCode Code)

Set sets the view to the given view (by Code)

func (*View) SetByName

func (v *View) SetByName(name string)

SetByName sets the view name to use based on its name. - If we provide an empty name then use the default. - If we don't provide a valid name then give an error

func (*View) SetNext

func (v *View) SetNext() Code

SetNext changes the current view to the next one

func (*View) SetPrev

func (v *View) SetPrev() Code

SetPrev changes the current view to the previous one

Jump to

Keyboard shortcuts

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