mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
643 B
29 lines
643 B
// Copyright 2023 ROC. All rights reserved.
|
|
// Use of this source code is governed by a MIT style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build generate
|
|
// +build generate
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"strings"
|
|
|
|
"github.com/alimy/yesql"
|
|
)
|
|
|
|
//go:generate go run $GOFILE
|
|
func main() {
|
|
log.Println("[Yesql] generate code start")
|
|
yesql.SetDefaultQueryHook(func(query *yesql.Query) (*yesql.Query, error) {
|
|
query.Query = strings.TrimRight(query.Query, ";")
|
|
return query, nil
|
|
})
|
|
if err := yesql.Generate(); err != nil {
|
|
log.Fatalf("generate code occurs error: %s", err)
|
|
}
|
|
log.Println("[Yesql] generate code finish")
|
|
}
|