database

package
v0.0.0-...-b7f3801 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	CreatedAt     time.Time `json:"-"`              // "-" for not including in result
	PSSH          string    `json:"pssh,omitempty"` //PSSH
	DecryptionKey string    `json:"key,omitempty"`  //DecryptionKey
}

type Service

type Service interface {
	//Insert the pssh and key into db
	Insert(pssh, key string) error

	//Get returns the key associated with the pssh
	Get(pssh string) (*Key, error)

	//SudoSU add user to sudoers list
	SudoSU(passkey string, superUser, sudoer int) error

	//Sudoer check whether a user is super_user or sudoer
	Sudoer(passkey string) (super_user, sudoer int, err error)

	//Revoke revokes user access
	Revoke(passkey string) error

	// Close terminates the database connection.
	// It returns an error if the connection cannot be closed.
	Close() error
}

Service represents a service that interacts with a database.

func New

func New() Service

type Sudoer

type Sudoer struct {
	Passkey   string `json:"passkey"`
	SuperUser int    `json:"super_user"`
	Sudoer    int    `json:"sudoer"`
}

Jump to

Keyboard shortcuts

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