eteran/cpp-json

Great component

Closed this issue · 0 comments

This is not an issue, I just want to express my gratitude for releasing this component, it worked right away with my simple JSON file where other more famous parsers did throw exceptions right away on initialization and I could not resolve my simple case. Support was also great, the C++ promise of efficient high-level abstractions keeps standing!

The file is not big, it takes about 180 microseconds to parse it and fill some structures (vectors, hashmap), but since it only happens on thread creation (it's a thread_local object) I can live with it.

Regards!

[
	{
		"uri": "/ms/gasto/view",
		"sql": "execute sp_gasto_view",
		"function": "dbget"
	},
	{
		"uri": "/ms/gasto/get",
		"sql": "execute sp_gasto_get $gasto_id",
		"function": "dbget",
		"fields": [
			{"name": "gasto_id", "type": "int", "required": "true"}
		]
	},	
	{
		"uri": "/ms/gasto/delete",
		"sql": "execute sp_gasto_delete $gasto_id",
		"function": "dbexec",
		"fields": [
			{"name": "gasto_id", "type": "int", "required": "true"}
		]
	},
	{
		"uri": "/ms/gasto/add",
		"sql": "execute sp_gasto_insert $fecha, $categ_id, $monto, $motivo",
		"function": "dbexec",
		"fields": [
			{"name": "monto", "type": "double", "required": "true"},
			{"name": "fecha", "type": "date", "required": "true"},
			{"name": "motivo", "type": "string", 	"required": "true"},
			{"name": "categ_id", "type": "int", "required": "true"}
		]
	},
	{
		"uri": "/ms/gasto/update",
		"sql": "execute sp_gasto_update $gasto_id,  $fecha, $categ_id, $monto, $motivo",
		"function": "dbexec",
		"fields": [
			{"name": "gasto_id", "type": "int", "required": "true"},
			{"name": "monto", "type": "double", "required": "true"},
			{"name": "fecha", "type": "date", "required": "true"},
			{"name": "motivo", "type": "string", 	"required": "true"},
			{"name": "categ_id", "type": "int", "required": "true"}
		]
	},	
	{
		"uri": "/ms/customer/info",
		"sql": "execute sp_getCustomerInfo $customerid",
		"function": "dbgetm",
		"tags": [ {"tag": "customer"}, {"tag": "orders"} ],
		"fields": [
			{"name": "customerid", "type": "string", "required": "true"}
		]
	},
	{
		"uri": "/ms/products/view",
		"sql": "execute sp_products_view",
		"function": "dbget"
	},
	{
		"uri": "/ms/shippers/view",
		"sql": "execute sp_shippers_view",
		"function": "dbget"
	},
	{
		"uri": "/ms/customers/view",
		"sql": "SELECT customerid, contactname, companyname, phone, country FROM customers ORDER BY companyname",
		"function": "dbget"
	},
	{
		"uri": "/ms/categ/view",
		"sql": "execute sp_categ_view",
		"function": "dbget"
	},
	{
		"uri": "/ms/categ/get",
		"sql": "execute sp_categ_get $categ_id",
		"function": "dbget",
		"fields": [
			{"name": "categ_id", "type": "integer", "required": "true"}
		]
	},
	{
		"uri": "/ms/categ/add",
		"sql": "insert into categ (descrip) values ($descrip)",
		"function": "dbexec",
		"fields": [
			{"name": "descrip", "type": "string", "required": "true"}
		]
	},
	{
		"uri": "/ms/categ/update",
		"sql": "update categ set descrip = $descrip where categ_id = $categ_id",
		"function": "dbexec",
		"fields": [
			{"name": "categ_id", "type": "integer", "required": "true"},
			{"name": "descrip", "type": "string", "required": "true"}
		]
	},
	{
		"uri": "/ms/categ/delete",
		"sql": "delete from categ where categ_id = $categ_id",
		"function": "dbexec",
		"fields": [
			{"name": "categ_id", "type": "integer", "required": "true"}
		],
		"validator": { "function": "dbfind", "sql": "SELECT top 1 categ_id FROM gasto where categ_id = $categ_id", "id": "custom", "description": "This record cannot be deleted, it's in use." }
	},
	{
		"uri": "/ms/query/search",
		"sql": "execute sp_getSalesByCategory $date1, $date2",
		"function": "dbget",
		"fields": [
			{"name": "date1", "type": "date", "required": "true"},
			{"name": "date2", "type": "date", "required": "true"}
		]
	},
	{
		"uri": "/ms/status",
		"function": "getServerInfo"
	},
	{
		"uri": "/ms/login",
		"function": "login",
		"fields": [
			{"name": "login", "type": "string", "required": "true"},
			{"name": "password", "type": "string", "required": "true"}
		]
	},
	{
		"uri": "/ms/logout",
		"function": "logout"
	}
]