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

RFC: Unified Logger #246

Open
binhonglee opened this issue Jul 2, 2021 · 1 comment
Open

RFC: Unified Logger #246

binhonglee opened this issue Jul 2, 2021 · 1 comment

Comments

@binhonglee
Copy link
Owner

Goal: Leveraging the template based codegen engine of wings to generate logger code across stack logging towards the same table with unified types and fields.

Syntax

go-filepath src/go
ts-filepath src/ts

import examples/input/event
import examples/input/result

gen-filetype go
db-type psql

logger Search {
  id int unique serial primary
  query string nonnull
  event Event nonnull
  results []Result
}
  • gen-filetype: Language for the table initialization code (if / when this is the first run).
  • db-type: Database type
  • unique serial primary nonnull: Database keywords

Config

We also need to add some new fields in the wings.json config files

{
  ...
  "db": {
    "credential-type": "custom" /* or "inherited" */, 
    /* The rest of the fields are only needed for custom credentials. */
    "credentials": {
      "name": "sample_db", 
      "username": "test_user", 
      "password": "test_password"
    }
  }
  ... 
}

Expectations

Here's a list of other things to expect / support in its implementation:

  • Can be imported / integrated as part of a larger project (and its initialization process).
  • Can use both existing or separate database credentials / connection.
  • Should include adding new columns if not already in existing (previously created) table.

Limitations

Here are some expected limitations on the implementation:

  • Unable to modify or delete existing columns.
    • Columns can be removed from code to prevent future use but generated code won't include removing them from existing table.
  • Unable to detect there's an existing table (in the same database) that's not generated from / by wings.

Open for suggestions.

@binhonglee
Copy link
Owner Author

This is currently being "actively" (as in when I have the time for it) implemented on the unified-logger branch.

@binhonglee binhonglee pinned this issue Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant