Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType = string
type NabiaDB ¶
func NabiaDBFromFile ¶
func NewNabiaDB ¶
func (*NabiaDB) Destroy ¶
Destroy takes a key and removes it from the map. This method doesn't have existence-checking logic. It is safe to use on empty data, it simply doesn't do anything if the record doesn't exist. -1 size if the key exists +1 write
func (*NabiaDB) Exists ¶
Exists checks if the key name provided exists in the Nabia map. It locks to read and unlocks immediately after. +1 read
func (*NabiaDB) Read ¶
func (ns *NabiaDB) Read(key string) (NabiaRecord, error)
Read takes a key name and attempts to pull the data from the Nabia DB map. Returns a NabiaRecord (if found) and an error (if not found). Callers must always check the error returned in the second parameter, as the result cannot be used if the "error" field is not nil. This function is safe to call even with empty data, because the method applies a mutex. +1 read
func (*NabiaDB) Write ¶
func (ns *NabiaDB) Write(key string, value NabiaRecord) error
Write takes the key and a value of NabiaRecord datatype and places it on the database, potentially overwriting whatever was there before, because Write has no data safety features preventing the overwriting of data. +1 write when validation passes +1 size if the key is new
type NabiaRecord ¶
type NabiaRecord struct { RawData []byte ContentType ContentType // "Content-Type" https://datatracker.ietf.org/doc/html/rfc2616/#section-14.17 }
func NewNabiaRecord ¶
func NewNabiaRecord(data []byte, ct ContentType) *NabiaRecord
func NewNabiaString ¶
func NewNabiaString(s string) *NabiaRecord