Thank you for your interest in the go-etl project! We welcome and appreciate contributions in various forms, including but not limited to bug reports, feature requests, code improvements, documentation improvements, and more.
- Code of Conduct
- Getting Started
- Development Environment Setup
- Project Structure
- Developing New Plugins
- Code Standards
- Submitting Code
- Testing
- Documentation
- Getting Help
Please treat all contributors with respect and maintain friendly and professional communication. We aim to create an open and inclusive community, and any inappropriate behavior is unacceptable.
If you find a bug, please report it through GitHub Issues. Include the following information:
- Problem description
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment information (operating system, Go version, etc.)
- Possible solutions
If you have new feature suggestions, feel free to discuss them via GitHub Issues. Please describe:
- The feature you want to implement
- Use case scenario
- Possible implementation ideas
- Any relevant reference materials
- Fork this project
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Submit a Pull Request
- Go 1.20 or higher
- GCC 4.8 or higher (Linux)
- MinGW-w64 environment (Windows, GCC 7.2.0 or higher)
cd ${GO_PATH}/src
git clone https://github.com/Breeze0806/go-etl.git "github.com/Breeze0806/go-etl"
cd github.com/Breeze0806/go-etlLinux:
make dependenciesWindows:
release.batLinux:
make releaseWindows:
release.batIf DB2 support is not needed, set the environment variable before building:
Linux:
export IGNORE_PACKAGES=db2
make dependencies
make releaseWindows:
set IGNORE_PACKAGES=db2
release.batgo-etl project uses a Framework + plugin architecture and mainly includes the following modules:
go-etl/
├── datax/ # Data synchronization framework
│ ├── plugin/
│ │ ├── reader/ # Reader plugins
│ │ └── writer/ # Writer plugins
│ └── ...
├── element/ # Data types and type conversions
├── storage/ # Storage modules
│ ├── database/ # Database integration
│ └── stream/ # Data stream processing
├── tools/ # Tool collection
│ ├── datax/ # Build and release tools
│ └── license/ # License tool
└── ...
- datax: Offline data synchronization framework similar to Alibaba's DataX
- element: Data type definitions and type conversions
- storage/database: Database basic integration and dialect interfaces
- storage/stream/file: File parsing (CSV, Excel, etc.)
- tools/build: Plugin registration and code generation
- tools/license: Automatic license addition
go-etl supports extending data sources through plugins. Below is a guide for developing new plugins.
- Use the template generation tool to create the plugin framework:
cd tools/datax/plugin
go run main.go -t reader -p Mysql-
Modify the generated files:
- Update plugin information in
plugin.json - Implement Job interface in
job.go - Implement Task interface in
task.go - Implement Reader interface in
reader.go
- Update plugin information in
-
Register the plugin:
go generate ./...- Use the template generation tool to create the plugin framework:
cd tools/datax/plugin
go run main.go -t writer -p Mysql-
Modify the generated files:
- Update plugin information in
plugin.json - Implement Job interface in
job.go - Implement Task interface in
task.go - Implement Writer interface in
writer.go
- Update plugin information in
-
Register the plugin:
go generate ./...Reader plugins need to implement the following interfaces:
Job Interface:
Init(ctx context.Context) (err error)
Destroy(ctx context.Context) (err error)
Split(ctx context.Context, number int) ([]*config.JSON, error)
Prepare(ctx context.Context) error
Post(ctx context.Context) errorTask Interface:
Init(ctx context.Context) (err error)
Destroy(ctx context.Context) (err error)
StartRead(ctx context.Context, sender plugin.RecordSender) error
Prepare(ctx context.Context) error
Post(ctx context.Context) errorWriter plugins need to implement the following interfaces:
Job Interface:
Init(ctx context.Context) (err error)
Destroy(ctx context.Context) (err error)
Split(ctx context.Context, number int) ([]*config.JSON, error)
Prepare(ctx context.Context) error
Post(ctx context.Context) errorTask Interface:
Init(ctx context.Context) (err error)
Destroy(ctx context.Context) (err error)
StartWrite(ctx context.Context, receiver plugin.RecordReceiver) error
Prepare(ctx context.Context) error
Post(ctx context.Context) error
SupportFailOver() boolIf implementing a relational database plugin, it is recommended to:
- Refer to the Database Storage Developer Guide
- Implement the
Querierinterface (Reader) orExecerinterface (Writer) - Use the
dbms.StartReadordbms.StartWritefunction
If implementing a two-dimensional table file plugin (such as CSV, Excel), it is recommended to:
- Refer to the Two-dimensional Table File Stream Storage Developer Guide
- Implement file parsing and generation logic
- Use camelCase naming
- Configuration items should be orthogonal with no overlapping functionality
- Use JSON types reasonably
- Follow conventions of similar plugins
The project uses gofmt for code formatting:
gofmt -s -w yourfile.goBefore submitting code, please run the following command to automatically add a license:
go run tools/license/main.go- Package names: concise and meaningful
- Function names: camelCase
- Constant names: UPPER_CASE with underscores
- Variable names: camelCase
- Public functions and types require comments
- Complex logic requires detailed comments
- Use English for comments
- Use English to describe the changes
- Concisely describe what was changed
- Include related Issue numbers (if any)
Example:
Add MySQL reader plugin support
Implement basic MySQL data reading functionality with batch fetch.
Fixes #123
- Code must pass all tests
- Follow project code standards
- Include necessary documentation updates
- Clearly describe the purpose and content of the PR
go test ./...The project encourages improving test coverage. New features should include corresponding unit tests.
For performance-related changes, please provide a performance test report including:
- Test environment (hardware, operating system, etc.)
- Test data characteristics
- Test parameter configuration
- Performance comparison data
- Public APIs must have comments
- Complex logic requires detailed explanations
- Use English for comments
New plugins need to include the following documentation:
- Quick Introduction: Plugin functionality and use cases
- Implementation Principles: Underlying implementation principles
- Configuration Instructions: JSON configuration examples and parameter descriptions
- Type Conversion: Data type conversion rules
- Performance Report: Performance test data
- Constraints and Limitations: Usage restrictions and precautions
- FAQ: Frequently asked questions
If your changes affect user usage, please update:
README_USER.md: User manualREADME_USER_zh-CN.md: Chinese user manual- Plugin documentation
If you encounter problems during contribution, you can get help through the following methods:
- Check the Project Documentation
- Check the Developer Documentation
- Check the User Manual
- Submit GitHub Issue for discussion
- QQ Group: 185188648
Thanks to all developers who have contributed to the go-etl project!