core/types

Types

BadSecretKeyError = object of CatchableError
  Source Edit
EmptySecretKeyError = object of CatchableError
  Source Edit
BaseType = int | float | bool | string
  Source Edit
SecretKey = distinct string
  Source Edit
SecretUrl = distinct string
  Source Edit
Session = ref object
  data: StringTableRef
  newCreated*: bool
  modified*: bool
  accessed*: bool
  Source Edit
FlashLevel = enum
  Info = "info", Warning = "warning", Error = "error", Fault = "fault"
  Source Edit
FormPart = object
  data*: OrderedTableRef[string, tuple[params: StringTableRef, body: string]]
  Source Edit

Procs

proc `[]=`(formPart: FormPart; key: string; body: string) {...}{.inline, raises: [],
    tags: [].}
  Source Edit
proc loads(session: var Session; s: string) {...}{.inline, raises: [ValueError],
    tags: [].}
Loads session from strings.   Source Edit
proc dumps(session: Session): string {...}{.inline, raises: [], tags: [].}
Dumps session to strings.   Source Edit
proc messages(session: var Session): seq[string] {...}{.raises: [], tags: [].}
  Source Edit
proc messagesWithCategory(session: var Session): seq[(string, string)] {...}{.
    raises: [], tags: [].}
  Source Edit

Funcs

func initFormPart(): FormPart {...}{.raises: [], tags: [].}
  Source Edit
func `[]`(formPart: FormPart; key: string): tuple[params: StringTableRef,
    body: string] {...}{.inline, raises: [KeyError], tags: [].}
  Source Edit
func parseValue[T: BaseType](value: string; default: T): T {...}{.inline.}
  Source Edit
func len(secretKey: SecretKey): int {...}{.inline, raises: [], tags: [].}
  Source Edit
func `$`(secretKey: SecretKey): string {...}{.inline, raises: [], tags: [].}
Hide secretKey's value   Source Edit
func newSession(data: StringTableRef; newCreated = false; modified = false;
                accessed = false): Session {...}{.inline, raises: [], tags: [].}
Initializes a new session.   Source Edit
func `[]`(session: var Session; key: string): string {...}{.inline,
    raises: [KeyError], tags: [].}
Retrieves the value if key exists in session.   Source Edit
func `[]=`(session: var Session; key, value: string) {...}{.inline, raises: [],
    tags: [].}
sets the (key, value) pair.   Source Edit
func len(session: Session): int {...}{.inline, raises: [], tags: [].}
Gets the size of session.   Source Edit
func getOrDefault(session: var Session; key: string; default = ""): string {...}{.
    inline, raises: [KeyError], tags: [].}
Retrieves the value if key exists in session. Otherwise default will be returned.   Source Edit
func del(session: var Session; key: string) {...}{.inline, raises: [], tags: [].}
Deletes key from session.   Source Edit
func clear(session: var Session) {...}{.inline, raises: [], tags: [].}
Clears the data of session.   Source Edit
func `$`(session: Session): string {...}{.inline, raises: [], tags: [].}
  Source Edit
func parseStringTable(tabs: var StringTableRef; s: string) {...}{.raises: [],
    tags: [].}
  Source Edit
func flash(session: var Session; msgs: string; category = FlashLevel.Info) {...}{.
    inline, raises: [], tags: [].}
  Source Edit
func flash(session: var Session; msgs: string; category: string) {...}{.inline,
    raises: [], tags: [].}
  Source Edit
func getMessage(session: var Session; category: FlashLevel): Option[string] {...}{.
    inline, raises: [KeyError], tags: [].}
  Source Edit
func getMessage(session: var Session; category: string): Option[string] {...}{.
    inline, raises: [KeyError], tags: [].}
  Source Edit

Iterators

iterator pairs(session: Session): tuple[key, val: string] {...}{.raises: [], tags: [].}
  Source Edit