Triplex v1.3.0 Triplex.Plug View Source

This module have some basic functions for our triplex plugs.

The plugs we have for now are:

Link to this section Summary

Functions

Ensure the tenant is loaded, and if not, halts the conn

Puts the given tenant as an assign on the given conn, but only if the tenant is not reserved

Link to this section Functions

Link to this function ensure_tenant(conn, config) View Source

Ensure the tenant is loaded, and if not, halts the conn.

The config map/struct must have:

  • assign: the name of the assign where we must save the tenant.
Link to this function put_tenant(conn, tenant, config) View Source

Puts the given tenant as an assign on the given conn, but only if the tenant is not reserved.

The config map/struct must have:

  • tenant_handler: function to handle the tenant param. Its return will be used as the tenant.
  • assign: the name of the assign where we must save the tenant.