0.0.21 • Published 4 years ago

fdmd v0.0.21

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

fdmd

Firebase Data Modeling Desing Tool. yaml => firestore modeling code.

https://www.npmjs.com/package/fdmd

Install

Install to your project (recommand).

npm install --save-dev fdmd

Run

Copy from yaml dir and template dir to your current directory.

yaml template

# generate code
node_modules/.bin/fdmd

# generate code with options
node_modules/.bin/fdmd --generate all --inputFile yaml/db.yaml --tempDir template
command optionsdetailsremarks
--generateall (default all)auto generate code type
--inputFilemodeling yaml (default yaml/db.yaml )input data to auto generate code
--tempDirtemplate code (default template)input data to auto generate code

Support language

generate codesupportcommandgenerate code example
Allallcode
Dart---
Dart - Freezeddart_freezedcode
TypeScript---
TypeScript - Ballcap-Admints_ballcap_admincode
Swift---
Swift - Ballcap---
Kotlin---

Data Modeling

Can be design data modeling with yaml file.

typesupport
string
int
double
timestamp
map
array
any
bool
nullable

How to design yaml

yaml sample

Document

docs: # add
  - name: Poster
    path: /social/${socialId}/posters/${posterId}
    description: 投稿者の情報
    codeGenerate: true # code generate
    data:
      - field: id
        type: string # non nullable
        example: DocumentId
      - field: name
        type: string,nullable # nullable
        example: ケン
      - field: age
        type: int,nullable
        example: 10
      - field: createdAt
        type: timestamp,nullable
        example: '2021-09-16T13:10:52+09:00'
      - field: updatedAt
        type: timestamp,nullable
        example: '2021-09-16T13:10:52+09:00'

Map model

maps: # add
  - name: ThumbnailImage
    description: 画像情報
    codeGenerate: true
    data:
      - field: url
        type: string
        example: https://sample/image.jpg
      - field: path
        type: string
        example: /social/${socialId}/users/${userId}/images/${imageId}

Reference map model

docs:
  - name: Poster
    path: /social/${socialId}/posters/${posterId}
    description: 投稿者の情報
    codeGenerate: true
    data:
      - field: image
        type: map,nullable
        map:
          reference: ThumbnailImage # add. same maps name
maps:
  - name: ThumbnailImage # add. same docs name
    description: 画像情報
    codeGenerate: true
    data:
      - field: url
        type: string
        example: https://sample/image.jpg
      - field: path
        type: string
        example: /social/${socialId}/users/${userId}/images/${imageId}

Collection

docs:
  - name: Poster
    path: /social/${socialId}/posters/${posterId}
    description: 投稿者の情報
    codeGenerate: true
    data:
      - field: name
        type: string,nullable
        example: ケン
    collections: # add
      - field: posts
        type: Post
  - name: Post
    path: /social/${socialId}/posters/${posterId}/posts/${postId}
    description: 投稿情報
    codeGenerate: true
    data:
      - field: title
        type: string,nullable
        example: タイトル
      - field: text
        type: string,nullable
        example: テキスト内容
0.0.20

4 years ago

0.0.21

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago