Arvo的Scheme规范

Arvo的Scheme规范

语法格式

  • JSON格式

支持的【简单】类型

  1. null------------no value
  2. boolean---------a binary value
  3. int ------------32 bit signed integer
  4. long------------64 bit signed integer
  5. float-----------single precision (32 bit)
  6. double----------double precision (64 bit)
  7. bytes-----------sequence of 8-bit unsigned bytes
  8. string----------unicode character sequence

支持的【复杂】类型

  1. records
  2. enums
  3. arrays
  4. maps
  5. unions
  6. fixed

例子

  • 备注
    1. name---名称
    2. namespace---路径名称
    3. doc---文档注释
    4. aliases---别名
    5. fileds---包含项
    6. type---类型
    7. default---默认值
    8. symbols---枚举常量
序号复杂类型要求例子
1Records
        "type":"record"

    参数要求:

        1、name【必须】

        2、namespace

        3、doc【可选】

        4、aliases【可选】

        5、fields【必须】

                1、name【必须】

                2、doc【可选】

                3、type【必须】

                4、default【可选】
{
"type": "record",
"name": "LongList",
"aliases": ["LinkedLongs"],
fields" : [
  {"name": "value", "type": "long"},
  {"name": "next", "type": ["null", "LongList"]}
]
}
2Enums
        "type":"enum"

    参数要求:

        1、name【必须】

        2、namespace

        3、doc【可选】

        4、aliases【可选】

        4、symbols【必须】
{
"type": "enum",
"name": 
"Suit",
"symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
}
3Arrays
        "type":"array"

    参数要求:

        1、items【必须--写子项的类型】
{"type": "array", "items": "string"}
4Maps
        "type":"map"

    参数要求:

        1、values【必须--写子项的类型】
{"type": "map", "values": "long"}
5Unions类型:JSON上数组【Unions不能包含多个相同类型的Schema,除非是命名的record类型、命名的fixed类型和命名的enum类型】["null","string"]
6Fixed
        "type":"fixed"

    参数要求:

        1、name【必须】

        2、namespace

        3、size【必须】

        4、aliases【可选】
{"type": "fixed", "size": 16, "name": "md5"}

复杂用法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乘风御浪云帆之上

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值