src/snorlogue/urlUtils

Source   Edit  

Utility procs related to generating URLs to the various pages that Snorlogue provides.

Types

Page = enum
  CREATE = "create", DELETE = "delete", DETAIL = "detail", LIST = "list",
  OVERVIEW = "overview", BACKEND, SQL = "sql", CONFIG = "config"
Source   Edit  

Procs

proc generateUrlStub(urlPrefix: static string; action: Page; modelName: string): string
Generates a URL to the specified Page. These URLs are incomplete for CREATE, DELETE and DETAIL pages, as they do not provide any URL parameters that may be necessary to select a specific model entry from the database. This only generates the core URL and should only be used within this package. Source   Edit  
proc generateUrlStub[T: Model](urlPrefix: static string; action: Page;
                               model: typedesc[T]): string

Helper proc for generateUrlStub. Generates a URL to a specified Page for a given model. Pages to use this with are only model-specific ones such as BACKEND, CREATE, DELETE, DETAIL and LIST.

These URLs are incomplete for CREATE, DELETE and DETAIL pages, as they do not provide any URL parameters that may be necessary to select a specific model entry from the database. This only generates the core URL and should only be used within this package.

Source   Edit