tools

command
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Forma Tools CLI

命令通过 go run ./cmd/tools <command> [options] 调用。

可用命令

  • generate-attributes:从 JSON Schema 生成 <schema>_attributes.json。
  • init-db:创建 schema registry、entity main、EAV 数据表及索引。
  • manifest-reconcile:比对 S3 parquet 对象与 manifest 条目,报告孤儿/dangling, --repair 补录 #197 flush 孤儿,--gc 清理 #188 compaction 遗留。 详见 docs/manifest-reconcile.md。退出码:0 一致 / 2 有差异 / 1 失败。

generate-attributes

选项(带默认值):

  • -schema-dir(cmd/server/schemas):Schema 所在目录。
  • -schema:Schema 名(不含 .json);与 -schema-file 互斥。
  • -schema-file:Schema 文件全路径;优先于 -schema/-schema-dir。
  • -out:输出文件路径;默认写到 schema 同目录的 <name>_attributes.json。
  • -init:允许创建全新的 attributes 文件;不指定此标志时,输出文件缺失会导致错误(因为生成会将所有 attributeID 从 1 重新编号)。

示例:

  • go run ./cmd/tools generate-attributes -schema lead(更新既有 attributes 文件)
  • go run ./cmd/tools generate-attributes -schema-file /path/to/schema.json(再生成)
  • go run ./cmd/tools generate-attributes -schema-file /path/to/schema.json -out /tmp/schema_attributes.json -init(创建新文件)

init-db

选项(可用环境变量同名大写带下划线作默认值):

  • -db-host(DB_HOST,默认 localhost)
  • -db-port(DB_PORT,默认 5432)
  • -db-name(DB_NAME,默认 forma)
  • -db-user(DB_USER,默认 postgres)
  • -db-password(DB_PASSWORD,默认空)
  • -db-ssl-mode(DB_SSL_MODE,默认 disable)
  • -schema-table(SCHEMA_TABLE,默认 schema_registry)
  • -eav-table(EAV_TABLE,默认 eav_data_2)
  • -entity-main-table(ENTITY_MAIN_TABLE,默认 entity_main)

示例:

  • go run ./cmd/tools init-db
  • go run ./cmd/tools init-db -db-host 127.0.0.1 -db-name forma_dev -entity-main-table entity_main_dev -eav-table eav_dev

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL