Fetch this

avatar
(Edited)

I am not a fan of any sort of api request really, I hate having to deal with them and wish everything could just be one big relational DB with the only states "We got yo stuff" or "Ain't got yo stuff".

It could just be because of all the boilerplate I seem to always be creating, maybe it is that frankly I can't ever be sure of all the responses to expect and catch.

So it is fair enough to assume I am a bit haphazardous when it comes to exception handling. At least it can feel like that to me.

Lately I have been working with a mix of JS and PHP to accomplish some tasks which one could argue can be offloaded to the client side only but I think the fallout of a bad client connection for a long running task is just not worth it.

So I have the client do the minimal required for me to then queue the job in cron and process it via Guzzle for reads and since PHP does not have reliable tools for me to broadcast to Hive I offload that to a Node Instance which I kinda like since I can move it anywhere.

Anyway that is probably gibberish, but it is how I approach thing with a preference for developing in PHP. No SPA or loaders or any of that jazz.

This does come with its own problems as I have outlined but once the boilerplate is in place as with any framework it really is not all that bad.

Really the only pain points are dealing with Hive and Hive-engine.

For reading data I got it down, and Guzzle does a great job at retrying connections although I am expanding that now to try different nodes also.

Anyway this is not so much about all that.

Something I never clicked until recently is that Hive-Engine uses Loki as the database.

I guess I missed that bit because I mainly just jumped to the "Hey make NFT" bit of the documentation and then I wanted to know "Hey where my NFT" which worked well for all the info, or "Hey NFT was in transaction, what up?"

"Sowwi boss here the logs."

Then I got real showy and wanted to know exactly the whereabouts of NFT #511 and #520 and also only the ones I tagged as "Level 5"...

Yeah, if it was Hive you would need to loop the shit out of someone's History using a bitmask no one knows how to mask.

But since this is Loki you can go ahead and just ask very specifically:

Obviously for all the JS gurus those would be objects. As you see, you can use for example '$in' : [...keys] and be very specific with what you are trying to retrieve.

Ok sure, I don't need a limit of 1000 there :P Sue me.

The other benefit of the DB access is that you can access properties very specific with dot notation on the NFT and substrings or objects in values.

I guess since we submit JSON as string to Hive-Engine properties though you would using the substring ability , I have not tested this but at least being able to get very specific items by properties as I would in a SQL call is very satisfactory.



0
0
0.000
0 comments