Documentation ¶
Overview ¶
Copyright 2024 aggronmagi <czy463@163.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 aggronmagi <czy463@163.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Config = &GenerateEnv{
SvcPkg: "github.com/walleframe/svc_db",
UtilPkg: "github.com/walleframe/walle/util",
CodePath: "pkg/gen/mysqlop/",
Charset: "utf8mb4",
Collate: "utf8mb4_general_ci",
}
Functions ¶
func InitTemplate ¶
func InitTemplate() (err error)
func ParseConfigFromEnv ¶
func ParseConfigFromEnv()
Types ¶
type GenerateEnv ¶
type SqlColumn ¶
type SqlColumn struct { Name string // column name GoType string // golang type SqlType string // mysql type define. eg: varchar(64) not null default ” Marshal string // Marshal Function, use for not base type Unmarshal string // Unmarshal Function, use for not base type Doc *tpl.Commets // column doc }
type SqlIndex ¶
type SqlTable ¶
type SqlTable struct { tpl.GoObject SvcDB string // service package. not set outside Charset string // charset Collate string // collate Engine string // mysql engine DB string // generate mysql db name SqlTable string // generate mysql table name Name string // generate mysql operation name prefix Struct string // import struct name, need with package name. eg: pkg.struct InnerAllColumns []*SqlColumn // all columns AutoIncr *SqlColumn // auto increment column PrimaryKey []*SqlColumn // primary key columns Columns []*SqlColumn // normal columns Index []*SqlIndex // index columns GenEx bool // generate extra method(contain time info) GenUpdate bool // generate update method when have primary key GenUpsert bool // generate upsert method when have primary key CustomOptions string // custom mysql options }