Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New package: @alwatr/storage #167

Merged
merged 13 commits into from
Jul 22, 2022
Merged

New package: @alwatr/storage #167

merged 13 commits into from
Jul 22, 2022

Conversation

alimd
Copy link
Member

@alimd alimd commented Jul 22, 2022

داستان چیه؟!
این دمو رو ببینید

import {AlwatrStorage} from '@alwatr/storage';

import type {DocumentObject} from '@alwatr/storage';

interface User extends DocumentObject {
  fname: string;
  lname: string;
  email: string;
  token?: string;
}

const db = new AlwatrStorage<User>('user-list', 'temp');

// await db.ready
// or
db.ready.then(() => {
  console.log('db loaded and ready to access.');

  let ali = db.get('alimd');

  if (ali == null) {
    console.log('ali not found');
    ali = {
      _id: 'alimd',
      fname: 'Ali',
      lname: 'Mihandoost',
      email: 'ali@mihandoost.com',
    };
  } else {
    console.log('ali found: %o', ali);
    /**
     * {
     *   _id: 'alimd',
     *   fname: 'Ali',
     *   lname: 'MM',
     *   email: 'i@ali.md',
     * }
     */

    ali.token = Math.random().toString(36).substring(2, 15);
  }

  db.set(ali);

  db.set({
    _id: 'fmd',
    fname: 'Fatemeh',
    lname: 'Mihandoost',
    email: 'Fatemeh@mihandoost.com',
    token: Math.random().toString(36).substring(2, 15),
  });
});

@alimd alimd added the documentation Solely about the documentation of the project. label Jul 22, 2022
@alimd alimd added this to the v1.0.0-beta milestone Jul 22, 2022
@alimd alimd requested a review from njfamirm July 22, 2022 00:11
@alimd alimd self-assigned this Jul 22, 2022
@alimd
Copy link
Member Author

alimd commented Jul 22, 2022

@njfamirm
Please make readme with document and sample like othe packages

@njfamirm
Copy link
Member

njfamirm commented Jul 22, 2022

توی _init فایل رو که ممکنه وجود نداشته باشه رو میخواین باز کنید

https://github.com/AliMD/alwatr/blob/0fdd533446943502c187d961ebfcbf872f7c15e1/packages/core/jatabase/src/util.ts#L18

و خب اگه نباشه که کرش میکنه کد!
شاید کاربر بخواد از اون به بعد با get اضافه کنه

@njfamirm
Copy link
Member

_id: string;

دلیل underline قبلش چیه؟

@alimd
Copy link
Member Author

alimd commented Jul 22, 2022

توی _init فایل رو که ممکنه وجود نداشته باشه رو میخواین باز کنید

https://github.com/AliMD/alwatr/blob/0fdd533446943502c187d961ebfcbf872f7c15e1/packages/core/jatabase/src/util.ts#L18

و خب اگه نباشه که کرش میکنه کد! شاید کاربر بخواد از اون به بعد با get اضافه کنه

اولا چرا کامنت عادی نمیدی که بشه بهش جواب داد
دوما راست میگی! چرا همچین سوتی ای دادم؟!

@alimd
Copy link
Member Author

alimd commented Jul 22, 2022

_id: string;

دلیل underline قبلش چیه؟

نباید با دیتای کسی که استفاده میکنه قاطی بشه
کلا هر دیتایی که خود سیستم اضافه میکنه با underscore معمولا میزارن

Copy link
Contributor

@MM25Zamanian MM25Zamanian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

در کل با گوشی ریویو کردم شرمنده

ولی خیلی جذاب شد (همونی که خودتون میگین)

packages/core/jatabase/src/type.ts Outdated Show resolved Hide resolved
packages/core/jatabase/src/type.ts Outdated Show resolved Hide resolved
packages/core/jatabase/src/jatabase.ts Outdated Show resolved Hide resolved
packages/core/jatabase/src/jatabase.ts Outdated Show resolved Hide resolved
packages/core/jatabase/src/jatabase.ts Outdated Show resolved Hide resolved
packages/core/jatabase/src/jatabase.ts Outdated Show resolved Hide resolved
@alimd alimd changed the title New package: Jatabase New package: @alwatr/storage Jul 22, 2022
Copy link
Member Author

@alimd alimd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

تامااااااام
یکی داکیومنت ریدمی رو شبیه مابقیه پکیج ها درست کنه
و حالا بریم سراغ میکروسرویسش 😎

@alimd alimd merged commit 80abb6f into next Jul 22, 2022
@alimd alimd deleted the feat/jatabase branch July 22, 2022 15:05
@github-actions
Copy link

Pull Request closed and locked due to lack of activity.
If you'd like to build on this closed PR, you can clone it using this method: https://stackoverflow.com/a/14969986
Then open a new PR, referencing this closed PR in your message.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Solely about the documentation of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants