internal

package
v0.0.0-...-6ed6190 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempDir

func CreateTempDir(user, dirName string) error

CreateTempDir creates a temporary directory for the user at `/tmp/<user>/<dirName>`.

func CreateTempFile

func CreateTempFile(user, dirName, filename, extension string) (string, error)

CreateTempFile creates a temporary file for the user at location `/tmp/<user>/<dirName>/<filename><extension>`.

func DeleteAll

func DeleteAll(user string) error

DeleteAll deletes all directories and files for the user at location `/tmp/<user>`.

func DeleteTempDir

func DeleteTempDir(user, dirName string) error

DeleteTempDir deletes the temporary directory for the user at location `/tmp/<user>/<dirName>`.

func ExecutableFile

func ExecutableFile(user, dirname, filename string) string

ExecutableFile returns the path to the executable file for the user.

func WriteToFile

func WriteToFile(filename, code string) error

WriteToFile writes the code to the file at the given path. If the file does not exist, it will be created. If the file exists, the code will be appended to the file.

Types

type Database

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

func NewDatabase

func NewDatabase() *Database

NewDatabase creates an empty database struct.

func (*Database) Connect

func (d *Database) Connect() error

Connect connects the database to `mongodb://database:27017` and sets up the client to this database. It also initializes the `client` in the database struct.

func (*Database) CreateCollection

func (d *Database) CreateCollection(collectionName string) error

CreateCollection creates a new collection in the database `kira`. It also sets the `db` database struct field. When the creation of the collection returns an error, it will return this error in this function.

func (*Database) Disconnect

func (d *Database) Disconnect()

Disconnect closes the connection to the database.

func (*Database) Insert

func (d *Database) Insert(log interface{}) (interface{}, error)

Insert inserts a specific log to the database. If something went wrong while inserting the entry into the database, it will return the error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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