src/prologue/core/types

Search:
Group by:
Source   Edit  

Types

BadSecretKeyError = object of CatchableError
Source   Edit  
BaseType = int | float | bool | string
Source   Edit  
EmptySecretKeyError = object of CatchableError
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  
SecretKey = distinct string
Source   Edit  
SecretUrl = distinct string
Source   Edit  
Session = ref object
  newCreated*: bool
  modified*: bool
  accessed*: bool
Source   Edit  

Procs

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

Iterators

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