Composer中的“自动增量"字段 [英] Auto Increment field in Composer

查看:74
本文介绍了Composer中的“自动增量"字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建Asset实例时是否有任何auto_increment字段类型可用. 例如,资产ID应该是自动生成的字段,应该在运行时创建,而不是在应用程序级别提及该值. 我可以通过创建事务处理程序功能来检查资产列表并添加1作为增量来实现.

Is there any auto_increment field type is available when creating an Asset instance. For example, Asset id should be autogenerated field and should be created at runtime, instead of mentioning the value at the application level. I can achieve it by creating a transaction processor function to check the list of asset and add 1 to increment as an alternative.

正在寻找一项新功能,该功能将在构建应用程序时帮助多个开发人员.

Looking for new a feature which will help multiple developers while building an application.

此致

Pradeep P

Pradeep P

推荐答案

最佳做法是在客户端生成ID,然后通过事务将其发送出去.举例来说,您无法确定交易处理器功能在每次查看交易建议的背书同行进行评估时都将保证相同的数字(ID),更不用说在发送读取/读取数据时获得相同的确定性值将(结果)集写回到客户端应用程序.关键是,交易建议书每次都会产生相同的资产ID(作为一部分-通过将其置于TP功能中,就不能每次都得到保证).相反,您将从客户端发送自动增量值,这最终是由客户端负责的.

the best practice is to generate IDs client side, and send them in via the transaction. You can't for example, be certain that the transaction processor function would guarantee the same number (ID) each time when evaluated on endorsing peers that look at transaction proposals, let alone achieving the same deterministic value when it comes to sending the read/write (results) set back to the client application. The whole point is that the transaction proposal would yield the same asset ID EVERY time (as part of that - by putting it in a TP function, that would not be guaranteed EVERY time). Rather, you would send in the auto-increment value from the client side, for something that is ultimately, the responsibility of the client side.

这篇关于Composer中的“自动增量"字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆