招聘中级Golang开发工程师
招聘中级Golang开发工程师 公司正在寻找一位软件工程师加入他们在德国汉堡附近的新办公室。他们正在构建管理数据库模式的新方法。基于流行的开源项目,他们正在构建一个独特的平台,供团队定义、计划、验证和部署对数据库模式的更改。
任务:
- 端到端地负责工程计划,从构思、设计、实现到测试,以交付开发者喜爱的体验
- 为成功且受欢迎的开源项目做出贡献并提供支持
- 持续改进我们在 Ariga 用于构建产品的工具和基础设施
这个角色是一个独特的机会,可以在开源社区以及商业产品中为开发者构建工具和基础设施。
必备条件:
- 3 年以上软件工程师经验
- 有 Go 语言编程经验(至少 1 年)
- 有构建高性能、分布式服务器应用程序的经验
- 对数据库和数据基础设施有深刻理解
- 有构建 SaaS 和/或企业级 Web 应用程序的经验
- 高级英语水平
加分项:
- 有设计面向开发者的产品的经验。
- 计算机科学或软件工程专业背景
- 有参与开源项目或社区的经验
- 有使用 React、GraphQL、Typescript 和其他现代 Web 技术的经验
福利与条件:
- 试用期:3 个月
- 30 天年假
- 有竞争力的薪资
- 股权
- 福利套餐
更多关于招聘中级Golang开发工程师的实战教程也可以访问 https://www.itying.com/category-94-b0.html
更多关于招聘中级Golang开发工程师的实战系列教程也可以访问 https://www.itying.com/category-94-b0.html
这是一个非常不错的Golang开发职位机会,尤其适合对数据库基础设施和开源项目有浓厚兴趣的工程师。从职位描述来看,该公司(Ariga)的核心技术栈与Atlas项目高度相关,这是一个用Go编写的用于管理数据库模式的流行开源工具。
以下是一些针对该职位要求的技术要点和示例,可以帮助潜在申请者评估自身匹配度:
1. 必备条件中的“Go语言编程经验”和“构建高性能、分布式服务器应用程序” 这通常意味着需要熟练掌握Go的并发模型、标准库以及常见的性能优化模式。
// 示例:一个使用Go并发处理数据库模式检查任务的高性能服务端片段
package main
import (
"context"
"fmt"
"sync"
"time"
"ariga.io/atlas/sql/migrate"
"entgo.io/ent/dialect/sql/schema"
)
// SchemaValidator 表示一个分布式的模式验证器
type SchemaValidator struct {
mu sync.RWMutex
workers int
tasks chan SchemaCheckTask
}
// SchemaCheckTask 定义要验证的模式任务
type SchemaCheckTask struct {
DriverName string
DSN string
Desired *schema.Schema
ResultChan chan<- ValidationResult
}
// ValidationResult 表示验证结果
type ValidationResult struct {
Diff []string
Err error
Latency time.Duration
}
// NewSchemaValidator 创建一个新的验证器池
func NewSchemaValidator(workers int) *SchemaValidator {
sv := &SchemaValidator{
workers: workers,
tasks: make(chan SchemaCheckTask, 100),
}
for i := 0; i < workers; i++ {
go sv.worker()
}
return sv
}
// Validate 提交一个验证任务
func (sv *SchemaValidator) Validate(ctx context.Context, task SchemaCheckTask) {
select {
case sv.tasks <- task:
case <-ctx.Done():
task.ResultChan <- ValidationResult{Err: ctx.Err()}
}
}
// worker 是处理验证任务的工作协程
func (sv *SchemaValidator) worker() {
for task := range sv.tasks {
start := time.Now()
// 使用Atlas进行实际的模式Diff计算
diff, err := migrate.ComputeDiff(ctx, task.DriverName, task.DSN, task.Desired)
result := ValidationResult{
Diff: diff,
Err: err,
Latency: time.Since(start),
}
task.ResultChan <- result
}
}
// 使用示例
func main() {
validator := NewSchemaValidator(10)
resultChan := make(chan ValidationResult, 1)
task := SchemaCheckTask{
DriverName: "postgres",
DSN: "host=localhost port=5432 user=postgres dbname=test",
Desired: &schema.Schema{},
ResultChan: resultChan,
}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
go validator.Validate(ctx, task)
select {
case res := <-resultChan:
if res.Err != nil {
fmt.Printf("验证失败: %v\n", res.Err)
} else {
fmt.Printf("模式差异: %v, 耗时: %v\n", res.Diff, res.Latency)
}
case <-ctx.Done():
fmt.Println("验证超时")
}
}
2. 对“数据库和数据基础设施有深刻理解”的要求 这需要熟悉数据库模式迁移、版本控制以及不同数据库驱动程序的特性。Atlas项目本身就是一个很好的参考。
// 示例:使用Atlas进行多数据库模式管理的代码片段
package main
import (
"context"
"fmt"
"log"
"ariga.io/atlas/sql/migrate"
"ariga.io/atlas/sql/sqltool"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
)
// MultiDBMigrator 处理多种数据库的模式迁移
type MultiDBMigrator struct {
migrationsDir string
}
// PlanMigration 为特定数据库驱动规划迁移
func (m *MultiDBMigrator) PlanMigration(ctx context.Context, driver string, dsn string, desired *migrate.Schema) error {
// 初始化Atlas驱动
drv, err := migrate.Open(driver, dsn)
if err != nil {
return fmt.Errorf("打开数据库驱动失败: %w", err)
}
defer drv.Close()
// 创建迁移规划器
planner, err := sqltool.NewGolangMigrate(m.migrationsDir)
if err != nil {
return err
}
// 规划迁移
plan, err := migrate.Plan(ctx, drv, desired, migrate.WithPlanner(planner))
if err != nil {
return fmt.Errorf("规划迁移失败: %w", err)
}
// 应用迁移
if err := drv.Apply(ctx, plan); err != nil {
return fmt.Errorf("应用迁移失败: %w", err)
}
log.Printf("成功为%s应用了%d个迁移文件", driver, len(plan.Files))
return nil
}
// 支持MySQL和PostgreSQL的迁移示例
func main() {
migrator := &MultiDBMigrator{migrationsDir: "./migrations"}
ctx := context.Background()
// PostgreSQL迁移
pgSchema := &migrate.Schema{
Name: "public",
// ... 定义模式对象
}
if err := migrator.PlanMigration(ctx, "postgres",
"postgres://user:pass@localhost:5432/db?sslmode=disable", pgSchema); err != nil {
log.Fatal(err)
}
// MySQL迁移
mysqlSchema := &migrate.Schema{
Name: "test",
// ... 定义模式对象
}
if err := migrator.PlanMigration(ctx, "mysql",
"user:pass@tcp(localhost:3306)/db", mysqlSchema); err != nil {
log.Fatal(err)
}
}
3. 加分项中的“使用React、GraphQL、Typescript经验” 虽然主要是Go职位,但全栈能力会是加分项。以下是一个Go GraphQL服务端示例,可与前端React应用配合:
// 示例:为数据库模式管理提供GraphQL API的Go服务
package main
import (
"context"
"log"
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
)
// SchemaChange 表示一个模式变更
type SchemaChange struct {
ID string `json:"id"`
SQL string `json:"sql"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
}
// schemaChangeType 定义GraphQL类型
var schemaChangeType = graphql.NewObject(graphql.ObjectConfig{
Name: "SchemaChange",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.String,
},
"sql": &graphql.Field{
Type: graphql.String,
},
"status": &graphql.Field{
Type: graphql.String,
},
"createdAt": &graphql.Field{
Type: graphql.String,
},
},
})
// 根查询
var rootQuery = graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"schemaChanges": &graphql.Field{
Type: graphql.NewList(schemaChangeType),
Args: graphql.FieldConfigArgument{
"status": &graphql.ArgumentConfig{
Type: graphql.String,
},
},
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
// 这里实际会查询数据库
status, _ := p.Args["status"].(string)
changes := []SchemaChange{
{
ID: "1",
SQL: "CREATE TABLE users (id SERIAL PRIMARY KEY)",
Status: status,
CreatedAt: "2023-10-01T10:00:00Z",
},
}
return changes, nil
},
},
},
})
// 创建GraphQL Schema
var schema, _ = graphql.NewSchema(graphql.SchemaConfig{
Query: rootQuery,
})
func main() {
// 创建GraphQL handler
h := handler.New(&handler.Config{
Schema: &schema,
Pretty: true,
})
// 设置路由
http.Handle("/graphql", h)
http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
<html>
<head>
<title>Database Schema Manager API</title>
</head>
<body>
<h1>GraphQL API for Schema Management</h1>
<p>Access the GraphQL endpoint at <a href="/graphql">/graphql</a></p>
</body>
</html>
`))
}))
log.Println("Server started at http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}
这个职位技术要求全面,既需要扎实的Go后端开发能力,又需要对数据库原理有深入理解。申请者如果熟悉Atlas项目源码或有类似的数据库工具开发经验,将会非常有竞争力。职位描述的工程范围从构思到交付,适合喜欢ownership和全流程参与的工程师。

