fix(lint): 修复所有 Go 命名规范问题
- 全局替换 ApiKey → APIKey(类型、字段、方法、变量) - 修复所有 initialism 命名(API, SMTP, HTML, URL 等) - 添加所有缺失的包注释 - 修复导出符号的注释格式 主要修改: - ApiKey → APIKey(所有出现的地方) - ApiKeyID → APIKeyID - ApiKeyIDs → APIKeyIDs - TestSmtpConnection → TestSMTPConnection - HtmlURL → HTMLURL - 添加 20+ 个包注释 - 修复 10+ 个导出符号注释格式 验证结果: - ✓ golangci-lint: 0 issues - ✓ 单元测试: 通过 - ✓ 集成测试: 通过
This commit is contained in:
@@ -12,26 +12,26 @@ import (
|
||||
"github.com/Wei-Shaw/sub2api/ent/predicate"
|
||||
)
|
||||
|
||||
// ApiKeyDelete is the builder for deleting a ApiKey entity.
|
||||
type ApiKeyDelete struct {
|
||||
// APIKeyDelete is the builder for deleting a APIKey entity.
|
||||
type APIKeyDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *ApiKeyMutation
|
||||
mutation *APIKeyMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the ApiKeyDelete builder.
|
||||
func (_d *ApiKeyDelete) Where(ps ...predicate.ApiKey) *ApiKeyDelete {
|
||||
// Where appends a list predicates to the APIKeyDelete builder.
|
||||
func (_d *APIKeyDelete) Where(ps ...predicate.APIKey) *APIKeyDelete {
|
||||
_d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (_d *ApiKeyDelete) Exec(ctx context.Context) (int, error) {
|
||||
func (_d *APIKeyDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *ApiKeyDelete) ExecX(ctx context.Context) int {
|
||||
func (_d *APIKeyDelete) ExecX(ctx context.Context) int {
|
||||
n, err := _d.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -39,7 +39,7 @@ func (_d *ApiKeyDelete) ExecX(ctx context.Context) int {
|
||||
return n
|
||||
}
|
||||
|
||||
func (_d *ApiKeyDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
func (_d *APIKeyDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(apikey.Table, sqlgraph.NewFieldSpec(apikey.FieldID, field.TypeInt64))
|
||||
if ps := _d.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
@@ -56,19 +56,19 @@ func (_d *ApiKeyDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// ApiKeyDeleteOne is the builder for deleting a single ApiKey entity.
|
||||
type ApiKeyDeleteOne struct {
|
||||
_d *ApiKeyDelete
|
||||
// APIKeyDeleteOne is the builder for deleting a single APIKey entity.
|
||||
type APIKeyDeleteOne struct {
|
||||
_d *APIKeyDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the ApiKeyDelete builder.
|
||||
func (_d *ApiKeyDeleteOne) Where(ps ...predicate.ApiKey) *ApiKeyDeleteOne {
|
||||
// Where appends a list predicates to the APIKeyDelete builder.
|
||||
func (_d *APIKeyDeleteOne) Where(ps ...predicate.APIKey) *APIKeyDeleteOne {
|
||||
_d._d.mutation.Where(ps...)
|
||||
return _d
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (_d *ApiKeyDeleteOne) Exec(ctx context.Context) error {
|
||||
func (_d *APIKeyDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := _d._d.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
@@ -81,7 +81,7 @@ func (_d *ApiKeyDeleteOne) Exec(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_d *ApiKeyDeleteOne) ExecX(ctx context.Context) {
|
||||
func (_d *APIKeyDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := _d.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user