1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-12 12:30:33 +08:00

feat(gen): impl. all specs except union

This commit is contained in:
源文雨
2026-03-24 00:49:26 +08:00
parent d42d758aeb
commit 1111b0ecc1
159 changed files with 9994 additions and 423 deletions

47
cmd/gen/api.go Normal file
View File

@@ -0,0 +1,47 @@
package main
import "os"
var apif *os.File
func init() {
f, err := os.Create("api.go")
if err != nil {
panic(err)
}
apif = f
apif.WriteString(`// Code generated by cmd/gen. DO NOT EDIT.
/*
*
* Copyright (C) 2026 Fumiama Minamoto
*
* SPDX-License-Identifier: MIT
*
* @file api.go
*
*/
package gozel
import (
"fmt"
"os"
"github.com/fumiama/gozel/internal/zecall"
)
func init() {
`)
}
func addAPI(name string) {
apif.WriteString("\n\tif err := zecall.Register(\"")
apif.WriteString(name)
apif.WriteString("\"); err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"[gozel.warn]\", err)\n\t}\n")
}
func closeAPI() {
apif.WriteString("\n}\n")
apif.Close()
}