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

Contents

Search

Client

class entities.Client(_params, _service, _address, _sock_stream)

Bases: entities.Entity

Handles and inits all client assacioated activities

Parameters:
  • {Dict<String, obj>} -- current params dict (_params) –
  • {Service obj} -- current service (_service) –
  • {Sring} -- current _ip host address (_address) –

Methods Summary

check_base() Checks base for mismatches
check_customs() checks all custom_fields
check_services() checks all services in db
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_from_db() Get the current val from db
get_socket_stream(_service_id) Little helper for getting the current stream
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() save current entity in db
save_base_entity([_update]) saves the base entity
save_custom_fields(_custom_vals) aves a set of custom_fields in db
save_service(_services) Saves a specific service
save_sub_entity(_table, _inserts, _values, …) saves any sub entity with given params
select_from(_table, _columns[, _condition]) Simple select from helper db
send_message(_message[, _pass_through]) Sends a Message to another client or group
update(_part) Updates entity and sub-entities in case of a change
update_helper_sub_entity() Helper for updating a sub entity like custom fields
update_service_helper() Helper for updating each service
update_sub_entity(_table, _updates, _condition) Updates each sub entity like custom_fields etc

Methods Documentation

check_base()

Checks base for mismatches

Raises:
  • error – mismatch, not found
  • Exception – String
Returns:

bool – changed or not

check_customs()

checks all custom_fields

Returns:bool – changed or not
check_services()

checks all services in db

Returns:bool – changed or not
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
get_from_db()

Get the current val from db

get_socket_stream(_service_id)

Little helper for getting the current stream

Returns:Socket/Stream – current stream for the client
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()

save current entity in db

save_base_entity(_update=False)

saves the base entity

Keyword Arguments:
 {bool} -- [wether update or insert] (default (_update) – {False})
save_custom_fields(_custom_vals)

aves a set of custom_fields in db

Parameters:{Dict<String,obj>} -- custom_val dict (_custom_vals) –
save_service(_services)

Saves a specific service

Parameters:
  • {Int} -- current service_id (_service_id) –
  • {Int} -- current service dict index (_idx) –
  • {Int} -- current client port (_port) –
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

send_message(_message, _pass_through=False)

Sends a Message to another client or group

Parameters:{Message obj} -- complete message obj (_message) –
update(_part)

Updates entity and sub-entities in case of a change

Parameters:{String} -- entity part (_part) –
update_helper_sub_entity()

Helper for updating a sub entity like custom fields

update_service_helper()

Helper for updating each service

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)