database

package
v0.0.0-...-9789351 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Paths    DatabasePaths
	Users    []User
	Channels []Channel
)

Functions

func AddToChannel

func AddToChannel(channelName string, username string) error

func BackwardFileRead

func BackwardFileRead(path string, count int) []string

func CreateChannel

func CreateChannel(channelName string) error

func CreateUser

func CreateUser(username string, password string) error

func DeleteChannel

func DeleteChannel(channelName string) error

func DeleteUser

func DeleteUser(username string) error

func GetChannelMessages

func GetChannelMessages(channelName string, amount int) ([]string, error)

func OpenDatabase

func OpenDatabase(rootPath string)

func RemoveFromChannel

func RemoveFromChannel(channelName string, username string) error

func SaveMessage

func SaveMessage(channelName string, message string)

Types

type Channel

type Channel struct {
	Name    string
	Members []*User
}

func GetChannel

func GetChannel(name string) (*Channel, error)

type DatabasePaths

type DatabasePaths struct {
	Root     string
	Etc      string
	Chat     string
	Users    string
	Channels string
	Key      string
}

type User

type User struct {
	Name         string
	PasswordHash string
}

func GetUser

func GetUser(name string) (*User, error)

Jump to

Keyboard shortcuts

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