Antano » Antano Server API » Entity
Antano® will be released very soon. This is an announcement text

Contents

Search

Entity

class entities.Entity(_params, _service)

Bases: object

Basic class for entity with basic functions for all entities such as Client, Message etc

Parameters:
  • {Dict<String, obj>} -- current Params dict (_params) –
  • {Service obj} -- current service (_service) –

Methods Summary

extract_entity(_message, _service, _address, …) extract an entity out of the message
get_entity_prefix() get current entity prefix
get_entity_table() gets current table
get_sql_string(_value) Mini helper for getting sql converted string
get_sql_variables() Little helper for getting sql conform variables
get_vars(_prefix) Gets all variables for an entity
pass_through(_message, _service) passes through a message to an entity
post_process() PostProcessing like sending an created message via entity
process_message(_message, _service, …) Processes the message and creates a new entity of a specific type like Client, Message etc
rollback() simple function for rollback current db transitions
save() Base save call for each entity
save_base_entity([_update]) saves the base entity
save_sub_entity(_table, _inserts, _values, …) saves any sub entity with given params
select_from(_table, _columns[, _condition]) Simple select from helper db
update_sub_entity(_table, _updates, _condition) Updates each sub entity like custom_fields etc

Methods Documentation

static extract_entity(_message, _service, _address, _sock_stream)

extract an entity out of the message

Parameters:
  • {Dict<String,obj>} -- current message (_message) –
  • {Service obj} -- current _service (_service) –
  • {Sring} -- current _ip host address (_address) –
Returns:

_entity{Entity obj} – specific entity

static get_entity_prefix()

get current entity prefix

Returns:String – current prefix
static get_entity_table()

gets current table

Returns:String – entity table contant
static get_sql_string(_value)

Mini helper for getting sql converted string

Parameters:{mixed} -- a value (_value) –
Returns:String – sql conform string
get_sql_variables()

Little helper for getting sql conform variables

Returns:String – result of sql variabls
get_vars(_prefix)

Gets all variables for an entity

Returns:Array<String> – all vars
static pass_through(_message, _service)

passes through a message to an entity

Parameters:
  • {Dict<String, obj>} -- common message dict (_message) –
  • {Service obj} -- current service (_service) –
post_process()

PostProcessing like sending an created message via entity

static process_message(_message, _service, _address, _sock_stream)

Processes the message and creates a new entity of a specific type like Client, Message etc

Parameters:
  • {bytes[]} -- current message data (_message) –
  • {Service obj} -- current _service (_service) –
  • {Sring} -- current _ip host address (_address) –
Returns:

(entity{Entity obj},response{Dict<String,obj>}) – tuple of entity and response

rollback()

simple function for rollback current db transitions

save()

Base save call for each entity

Raises:e – DB Exception
save_base_entity(_update=False)

saves the base entity

Keyword Arguments:
 {bool} -- [wether update or insert] (default (_update) – {False})
save_sub_entity(_table, _inserts, _values, _returning, _multi=False)

saves any sub entity with given params

Parameters:
  • {String} -- table name (_table) –
  • {String} -- comma separated insert columns (_inserts) –
  • {String} -- comma separated values (_values) –
  • {String} -- field to return (_returning) –
Keyword Arguments:
 

{bool} -- wether multi or single values (default (_multi) – {False})

Returns:

Array – fetch on returning id/s

select_from(_table, _columns, _condition=None)

Simple select from helper db

Parameters:
  • {String} -- From Table select (_table) –
  • {String} -- Columns to select (_columns) –
Keyword Arguments:
 

{String} -- optinal condition to add (default (_condition) – {None})

Returns:

Array db – current select fetch from db

update_sub_entity(_table, _updates, _condition)

Updates each sub entity like custom_fields etc

Parameters:
  • {String} -- table string (_table) –
  • {String} -- Update-conform string for sql (_updates) –
  • {String} -- condition clause (_condition) –
Last update: 10/08/2020 3:43 a.m. (CET)