How to use the lark.redis.schemas.LarkSchemaNode function in lark

To help you get started, we’ve selected a few lark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github voidfiles / lark / lark / redis / schemas.py View on Github external
SetSchema = LarkSchemaNode(LarkMappingSchema())
node(SetSchema, name_ref_type, name='key')
node(SetSchema, value_type, name='value')
node(SetSchema, int_type, name='ex', missing=None)
node(SetSchema, int_type, name='px', missing=None)
node(SetSchema, bool_type, name='nx', missing=False)
node(SetSchema, bool_type, name='xx', missing=False)


KeyRangeSchema = LarkSchemaNode(LarkMappingSchema())
node(KeyRangeSchema, name_ref_type, name='key')
node(KeyRangeSchema, int_type, name='start')
node(KeyRangeSchema, int_type, name='end')


KeyRangeOptionalSchema = LarkSchemaNode(LarkMappingSchema())
node(KeyRangeOptionalSchema, name_ref_type, name='key')
node(KeyRangeOptionalSchema, int_type, name='start', missing=None)
node(KeyRangeOptionalSchema, int_type, name='end', missing=None)


NameRangeSchema = LarkSchemaNode(LarkMappingSchema())
node(NameRangeSchema, name_ref_type, name='name')
node(NameRangeSchema, int_type, name='start')
node(NameRangeSchema, int_type, name='end')


NameRangeEndOptionalSchema = LarkSchemaNode(LarkMappingSchema())
node(NameRangeEndOptionalSchema, name_ref_type, name='name')
node(NameRangeEndOptionalSchema, int_type, name='start')
node(NameRangeEndOptionalSchema, int_type, name='end', missing=-1)
github voidfiles / lark / lark / redis / schemas.py View on Github external
node(NameRangeEndOptionalSchema, int_type, name='start')
node(NameRangeEndOptionalSchema, int_type, name='end', missing=-1)


SrcDstSchema = LarkSchemaNode(LarkMappingSchema())
node(SrcDstSchema, name_ref_type, name='src')
node(SrcDstSchema, name_ref_type, name='dst')


SrcDstValueSchema = LarkSchemaNode(LarkMappingSchema())
node(SrcDstValueSchema, name_ref_type, name='src')
node(SrcDstValueSchema, name_ref_type, name='dst')
node(SrcDstValueSchema, value_type, name='value')


SrcDstTimeoutSchema = LarkSchemaNode(LarkMappingSchema())
node(SrcDstTimeoutSchema, name_ref_type, name='src')
node(SrcDstTimeoutSchema, name_ref_type, name='dst')
node(SrcDstTimeoutSchema, int_type, name='timeout', missing=0)


NameIndexSchema = LarkSchemaNode(LarkMappingSchema())
node(NameIndexSchema, name_ref_type, name='name')
node(NameIndexSchema, int_type, name='index')


NameNumValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameNumValueSchema, name_ref_type, name='name')
node(NameNumValueSchema, int_type, name='num', missing=0)
node(NameNumValueSchema, value_type, name='value')
github voidfiles / lark / lark / redis / schemas.py View on Github external
node(BitOpSchema, name_ref_type, name='destkey')
BitOpSchema.add(LarkSchemaNode(colander.Sequence(), LarkSchemaNode(name_ref_type), name='key'))


NameTtlValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameTtlValueSchema, name_ref_type, name='name')
node(NameTtlValueSchema, int_type, name='ttl')
node(NameTtlValueSchema, value_type, name='key')


NameNumberSchema = LarkSchemaNode(LarkMappingSchema())
node(NameNumberSchema, name_ref_type, name='name')
node(NameNumberSchema, lark_string, name='number', missing=None)


NameMinMaxSchema = LarkSchemaNode(LarkMappingSchema())
node(NameMinMaxSchema, name_ref_type, name='name')
node(NameMinMaxSchema, lark_string, name='min')
node(NameMinMaxSchema, lark_string, name='max')


NameValueAmount = LarkSchemaNode(LarkMappingSchema())
node(NameValueAmount, name_ref_type, name='name')
node(NameValueAmount, value_type, name='value')
node(NameValueAmount, int_type, name='amount', missing=1)


NameKeySchema = LarkSchemaNode(LarkMappingSchema())
node(NameKeySchema, name_ref_type, name='name')
node(NameKeySchema, lark_string, name='key')
github voidfiles / lark / lark / redis / schemas.py View on Github external
CursorMatchCountSchema = LarkSchemaNode(LarkMappingSchema())
node(CursorMatchCountSchema, int_type, name='cursor')
node(CursorMatchCountSchema, name_ref_type, name='match')
node(CursorMatchCountSchema, int_type, name='count')


NameCursorMatchCountSchema = LarkSchemaNode(LarkMappingSchema())
node(NameCursorMatchCountSchema, name_ref_type, name='name')
node(NameCursorMatchCountSchema, int_type, name='cursor')
node(NameCursorMatchCountSchema, lark_string, name='match')
node(NameCursorMatchCountSchema, int_type, name='count')


BitOpSchema = LarkSchemaNode(LarkMappingSchema())
node(BitOpSchema, lark_string, name='operation')
node(BitOpSchema, name_ref_type, name='destkey')
BitOpSchema.add(LarkSchemaNode(colander.Sequence(), LarkSchemaNode(name_ref_type), name='key'))


NameTtlValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameTtlValueSchema, name_ref_type, name='name')
node(NameTtlValueSchema, int_type, name='ttl')
node(NameTtlValueSchema, value_type, name='key')


NameNumberSchema = LarkSchemaNode(LarkMappingSchema())
node(NameNumberSchema, name_ref_type, name='name')
node(NameNumberSchema, lark_string, name='number', missing=None)
github voidfiles / lark / lark / redis / schemas.py View on Github external
return ([name], dict(scores))


NameScoreListSchema = NameScoreListSchemaNode(LarkMappingSchema())
NameScoreListSchema.add(LarkSchemaNode(name_ref_type, name='name'))
NameScoreListSchema.add(LarkSchemaNode(colander.Sequence(), NameValueTupleSchema, name='scores'))


NoSchema = LarkSchemaNode(LarkMappingSchema())


AddressSchema = LarkSchemaNode(LarkMappingSchema())
node(AddressSchema, lark_string, name='address')


InfotypeKeyScheam = LarkSchemaNode(LarkMappingSchema())
node(InfotypeKeyScheam, lark_string, name='infotype')
node(InfotypeKeyScheam, name_ref_type, name='key')


NameSchema = LarkSchemaNode(LarkMappingSchema())
node(NameSchema, name_ref_type, name='name')


class NamesSchemaNode(LarkSchemaNode):
    def signature_from_cstruct(self, cstruct, redis_args, redis_kwargs):
        return (cstruct['name'], {})


NamesSchema = NamesSchemaNode(LarkMappingSchema())
NamesSchema.add(LarkSchemaNode(colander.Sequence(accept_scalar=True), LarkSchemaNode(name_ref_type), name='name'))
github voidfiles / lark / lark / redis / schemas.py View on Github external
node(NameTimeMsValueSchema, int_type, name='time_ms')
node(NameTimeMsValueSchema, value_type, name='value')


NameOffsetSchema = LarkSchemaNode(LarkMappingSchema())
node(NameOffsetSchema, name_ref_type, name='name')
node(NameOffsetSchema, int_type, name='offset')


NameOffsetBoolValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameOffsetBoolValueSchema, name_ref_type, name='name')
node(NameOffsetBoolValueSchema, int_type, name='offset')
node(NameOffsetBoolValueSchema, bool_type, name='value')


NameOffsetStrValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameOffsetStrValueSchema, name_ref_type, name='name')
node(NameOffsetStrValueSchema, int_type, name='offset')
node(NameOffsetStrValueSchema, lark_string, name='value')


NameValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameValueSchema, name_ref_type, name='name')
node(NameValueSchema, value_type, name='value')


class NameValuesSchemaNode(LarkSchemaNode):

    def signature_from_cstruct(self, cstruct, redis_args, redis_kwargs):
        name = cstruct['name']
        values = cstruct['values']
        return ([name] + values, {})
github voidfiles / lark / lark / redis / schemas.py View on Github external
NameCursorMatchCountSchema = LarkSchemaNode(LarkMappingSchema())
node(NameCursorMatchCountSchema, name_ref_type, name='name')
node(NameCursorMatchCountSchema, int_type, name='cursor')
node(NameCursorMatchCountSchema, lark_string, name='match')
node(NameCursorMatchCountSchema, int_type, name='count')


BitOpSchema = LarkSchemaNode(LarkMappingSchema())
node(BitOpSchema, lark_string, name='operation')
node(BitOpSchema, name_ref_type, name='destkey')
BitOpSchema.add(LarkSchemaNode(colander.Sequence(), LarkSchemaNode(name_ref_type), name='key'))


NameTtlValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameTtlValueSchema, name_ref_type, name='name')
node(NameTtlValueSchema, int_type, name='ttl')
node(NameTtlValueSchema, value_type, name='key')


NameNumberSchema = LarkSchemaNode(LarkMappingSchema())
node(NameNumberSchema, name_ref_type, name='name')
node(NameNumberSchema, lark_string, name='number', missing=None)


NameMinMaxSchema = LarkSchemaNode(LarkMappingSchema())
node(NameMinMaxSchema, name_ref_type, name='name')
node(NameMinMaxSchema, lark_string, name='min')
node(NameMinMaxSchema, lark_string, name='max')
github voidfiles / lark / lark / redis / schemas.py View on Github external
SectionSchema = LarkSchemaNode(LarkMappingSchema())
node(SectionSchema, lark_string, name='section', missing=None)


NameTimeSchema = LarkSchemaNode(LarkMappingSchema())
node(NameTimeSchema, name_ref_type, name='name')
node(NameTimeSchema, int_type, missing=None, name='time')


NameValueTimeSchema = LarkSchemaNode(LarkMappingSchema())
node(NameValueTimeSchema, name_ref_type, name='name')
node(NameValueTimeSchema, value_type, name='value')
node(NameValueTimeSchema, int_type, name='time')


NameTimeMsValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameTimeMsValueSchema, name_ref_type, name='name')
node(NameTimeMsValueSchema, int_type, name='time_ms')
node(NameTimeMsValueSchema, value_type, name='value')


NameOffsetSchema = LarkSchemaNode(LarkMappingSchema())
node(NameOffsetSchema, name_ref_type, name='name')
node(NameOffsetSchema, int_type, name='offset')


NameOffsetBoolValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameOffsetBoolValueSchema, name_ref_type, name='name')
node(NameOffsetBoolValueSchema, int_type, name='offset')
node(NameOffsetBoolValueSchema, bool_type, name='value')
github voidfiles / lark / lark / redis / schemas.py View on Github external
node(SrcDstTimeoutSchema, name_ref_type, name='dst')
node(SrcDstTimeoutSchema, int_type, name='timeout', missing=0)


NameIndexSchema = LarkSchemaNode(LarkMappingSchema())
node(NameIndexSchema, name_ref_type, name='name')
node(NameIndexSchema, int_type, name='index')


NameNumValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameNumValueSchema, name_ref_type, name='name')
node(NameNumValueSchema, int_type, name='num', missing=0)
node(NameNumValueSchema, value_type, name='value')


NameIndexValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameIndexValueSchema, name_ref_type, name='name')
node(NameIndexValueSchema, int_type, name='index')
node(NameIndexValueSchema, value_type, name='value')


NameWhereRefValueValueSchema = LarkSchemaNode(LarkMappingSchema())
node(NameWhereRefValueValueSchema, name_ref_type, name='name')
node(NameWhereRefValueValueSchema, lark_string, name='where')
node(NameWhereRefValueValueSchema, value_type, name='refvalue')
node(NameWhereRefValueValueSchema, value_type, name='value')


SortSchema = LarkSchemaNode(LarkMappingSchema())
node(SortSchema, name_ref_type, name='name')
node(SortSchema, lark_string, name='start', missing=None)
node(SortSchema, int_type, name='num', missing=None)
github voidfiles / lark / lark / redis / schemas.py View on Github external
class NameKeysSchemaNode(LarkSchemaNode):

    def signature_from_cstruct(self, cstruct, redis_args, redis_kwargs):
        name = cstruct['name']
        keys = cstruct['key']
        return ([name] + keys, {})


NameKeysSchema = NameKeysSchemaNode(LarkMappingSchema())
node(NameKeysSchema, name_ref_type, name='name')
NameKeysSchema.add(LarkSchemaNode(colander.Sequence(), LarkSchemaNode(lark_string), name='key'))


class DestKeysSchemaNode(LarkSchemaNode):

    def signature_from_cstruct(self, cstruct, redis_args, redis_kwargs):
        dest = cstruct['dest']
        keys = cstruct['keys']
        return ([dest, keys], {})


DestKeysSchema = DestKeysSchemaNode(LarkMappingSchema())
node(DestKeysSchema, name_ref_type, name='dest')
DestKeysSchema.add(LarkSchemaNode(colander.Sequence(), LarkSchemaNode(lark_string), name='keys'))


class OperationDestKeysSchemaNode(LarkSchemaNode):

    def signature_from_cstruct(self, cstruct, redis_args, redis_kwargs):
        operation = cstruct['operation']