db

package module
v0.0.0-...-05712f8 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPassword

func AddPassword(pass *Password) error

method used for inserting a new password into the database

func GeneratePassword

func GeneratePassword(length int) (string, error)

method used for generating a password of given length

func InitBase

func InitBase() error

method used for creating directories and a DB file on the first run of PM

func RemovePassword

func RemovePassword(id int) error

method used for removing a password from the database

Types

type DB

type DB struct {
	Conn *sql.DB
	Path string
}

Database struct holds a path to the base and an open connection

type Password

type Password struct {
	Id       int
	Name     string
	Resource string
	Password string
	Username string
	Comment  string
	Group    string
}

Password struct holds every database field

func SelectAll

func SelectAll() ([]*Password, error)

method used for fetching all passwords stored in the DB

func SelectByGroup

func SelectByGroup(name string) ([]*Password, error)

method used for selecting passwords when the -g flag is provided

func SelectByGroupAndName

func SelectByGroupAndName(name string, group string) ([]*Password, error)

method used for selecting passwords when both -n and -g flags are provided

func SelectByName

func SelectByName(name string) ([]*Password, error)

method used for selecting passwords when the -n flag is provided

Jump to

Keyboard shortcuts

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