isar / hive

Lightweight and blazing fast key-value database written in pure Dart.
Apache License 2.0
4.07k stars 404 forks source link

Do you use Hive in production? #180

Open simc opened 4 years ago

simc commented 4 years ago

Thanks for using Hive! I'd love to hear about your experience or problems with Hive and how you use it.

If you are okay with it, I'd like to add your app to a new "Apps using Hive" section :+1:

SirMaxxx commented 4 years ago

I'm developing a (closed source :( ) package using Hive to store data for a form-generation tool used by our (internal) app. So far, so good! Certainly fast. Only annoying thing is having to use magic numbers for the typeId and HiveField - I've used a bunch of consts for TypeId but it just feels a bit yucky! (I can see the reason, and it's probably safer than strings, but still a little annoying! The HiveField, during initial development, means re-ordering fields in my Json tends to not happen (as I'd be in danger of not knowing the highest number allocated when adding a new field)

Thanks for creating this - my issues above are minor compared to the awesomeness!

annshsingh commented 4 years ago

Hey @leisim Thanks for the hard work that went into developing Hive. I am working on two projects that'll be using hive in production. Since I just started using it, do you mind telling me the best possible way to implement search in a list populated using hive db. Thanks

Gorniv commented 4 years ago

I'm using hive for cache manager in meows.app This is an indie project) I have a problem only in debug mode with https://github.com/hivedb/hive/issues/94 Thank you!

Reprevise commented 4 years ago

I'm using Hive in one of my production apps, school_life. I dont really have any issues as I was using SQFLite before but that was way too big for my needs and Hive suits them just right. Thanks for the hard work you do for this project and I hope there's more great features to come!

Reprevise commented 4 years ago

Also @annshsingh, it would be great if you could open up a new issue for better support.

However, basically Hive (as of right now) doesnt have a querying language so you're going to have to use Dart's where and filter on values from a box. I can possibly write a tutorial for the Hive documentation on using querys with Hive in Dart and Flutter in a search app.

simc commented 4 years ago

Thanks everyone for using Hive!

@SirMaxxx I understand that it is a bit annoying to annotate each class and field. But it gives you great flexibility when you want to change an existing class which is already used in production. You don't have to do migrations with Hive (which are also super annoying). The only alternative to fieldIds I can think of is using the name of the field which prohibits you from ever renaming it.

I'd be in danger of not knowing the highest number allocated when adding a new field

I was thinking about adding a @LegacyField annotation which keeps track of old field ids. It would allow the generator to verify that you did not accidentally reuse an old id:

@HiveType(typeId: 0)
@LegacyField(0)
@LegacyField(2)
class MyObject {
  @HiveField(0) // COMPILE TIME ERROR
  String someProperty;

  @HiveField(1)
  int somethingElse;
}

What do you think?

@annshsingh Like @Reprevise said queries are not supported yet because I want to get them right and the single-threaded model of Dart is very limiting. Currently you can do the following:

yourPersonBox.values.filter((it) => it.age> 40);

@Gorniv Are you using the latest version of Hive? If yes, please open a new issue. Thanks!

@Reprevise Really cool!

SirMaxxx commented 4 years ago

@leisim re the LegacyField: I can see that it wold be useful if you remove fields - maybe the syntax could be LegacyFields([0,4,6]) just to save on the number of lines?

IN my particular instance, during development, the issue is something like this:

I Have @HiveId(0) String id; @HiveId(1) String customerName; @HiveId(2) String someOtherField; @HiveId(3) String somethingElse now I realise I also need to store the Customer Id

I can easily add @HiveId(4) at the end - but logically I'd like to position the field in my class next to customerName, like this: @HiveId(0) String id; @HiveId(4) String customerId @HiveId(1) String customerName; @HiveId(2) String someOtherField; @HiveId(3) String somethingElse

that's all fine - until Joe Junior Programmer wants to add a field. He'll look at the last field (3) and try to add String anotherField (4)

Hmm - actually, thinking about it, this isn't a problem, is it, because the generator gives Joe a nice error message, so he can fix it up.

And if I removed customerId at a later date, and used LegacyField(4), Joe would still get a generation time error.

So this ends up being a long way of saying "Yeah! @LegacyField would be a good way to handle this edge case!

simc commented 4 years ago

So this ends up being a long way of saying "Yeah! @LegacyField would be a good way to handle this edge case!

Maybe adding a legacyFields parameter to @HiveType would be even cleaner: @HiveType(typeId: 0, legacyFields: [0, 4, 6]).

SirMaxxx commented 4 years ago

@leisim Brilliant!

annshsingh commented 4 years ago

@Reprevise Hey, a tutorial around the topic would be much appreciated. Thanks. @leisim I used Dart's where to make it work for my usecase. Thank you both for the update.

Gorniv commented 4 years ago

@leisim now all is good!

lukasmarsoner commented 4 years ago

Hi,

we've recently started development on a costume rental service for a small shop in Brandenburg.

We'll be using hive for the caging of both metadata and images. We want the service to be available to users on iOS, Android, and in the browser, so it is the prefect fit.

Thank you very much for this project! ๐Ÿ™‚

zgramming commented 4 years ago

I think i can answer this question. Before that, i want to say thank you because you already working hard to make this great project. Yes , i already have 2 application published in Google Playstore using Hive . I feel easier use it for saving data into database compare with SQFLite, especially the configuration. Debt Diary What I Do Today

I have also been push this project to my github.

AlexV525 commented 4 years ago

Hive replaced SharedPreferences in my project. And I'm using it for at least two project. First is OpenJMU. This one is in production environment and used by thousands of people. It never ran out an issue about Hive itself. Second is a novel reader but not open sources. Hive help me to create content cache and settings storage, etc. Glad to met Hive at the early stage of my develop career. ๐Ÿ‘

yringler commented 4 years ago

I'm using it in my app, currently in beta but hopefully will be public next week. I do some sensible things with it, like saving class progress and history, and user settings when I add them. And I save a couple 1000 records (all the audio class / category data)... lazy box, of course. I haven't had issues yet, but it's a lot of data... But it's been working great! Thank you for an awesome db!

I did briefly try to use inheritance in my models after it was supported, but it didn't work. Possibly because I had 3 levels of inheritance? I wasn't sure where in the hierarchy to use the @HiveType annotation, and maybe I was doing some other stuff wrong. Unfortunately (sorta) everything is working wonderfully without it (I use implements unstead of extends), and I don't have time to put together a reproduction case. But documenting how to use inheritance in hive models would be great.

V1rus999 commented 4 years ago

We are using Hive in our app.

We migrated from SQL to Hive as there was no real reason for a relational database and Hive seems easier from a code perspective. So far it has been a breeze. I love how often Hive gets updated (what happened to the release notes by the way).

So far we haven't had problems, but there are some features that I would like:

Ahmadre commented 4 years ago

I started using hive in our new eHealth App: https://pulmonary-intensive-care-unit.firebaseapp.com/#/ when I encountered, that Flutter-Secure Storage is holding the private keys inside the code in clear text ๐Ÿคจ

coolsol commented 4 years ago

Hi, used it in Mogra android app. Very glad with Hive so far. Is there a method to list all boxes?? Did not readily find that.. Thanks for such a wonderful thing!

hirenm1990 commented 3 years ago

Hi, thanks for Hive DB. I am using this in my daily expense app in combination with server side database sync. Hive easily gives my app offline capability I needed & can sync data whenever user is online.

Checkout my app DailyExpense here.

JatanPandya commented 3 years ago

Hi! I am developing a large app with Hive in flutter for android and web. Initially I was facing issues using Hive, but Hive is capable of fulfilling almost requirements related to applications. I would love to share the source but, client won't like it.

I miss the freedom to do queries though. Fetching desired and processed data is little difficult. If any of you have any source, where there is documented methods to fetch data from NoSQL like that of SQL, please share.

Summing up, Hive is very much faster and easy to use. If you don't required to do queries and fetch variety of data, Hive can do the task for you.

Thanks

NoxiousBuff commented 3 years ago

I'm using hive for cache manager in meows.app This is an indie project) I have a problem only in debug mode with #94 Thank you!

Did you use flutter for app development ??