mysql

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2017 License: Apache-2.0 Imports: 20 Imported by: 12

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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 2016 Wenhui Shen <www.webx.top>

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

View Source
var (
	UnsignedTags   = []string{"unsigned", "zerofill", "unsigned zerofill"}
	EnumLength     = "'(?:''|[^'\\\\]|\\\\.)*'"
	OnActions      = "RESTRICT|NO ACTION|CASCADE|SET NULL|SET DEFAULT" ///< @var string used in foreignKeys()
	PartitionTypes = []string{`HASH`, `LINEAR HASH`, `KEY`, `LINEAR KEY`, `RANGE`, `LIST`}
)

Functions

This section is empty.

Types

type Collation

type Collation struct {
	Collation sql.NullString
	Charset   sql.NullString `json:"-"`
	Id        sql.NullInt64  `json:"-"`
	Default   sql.NullString `json:"-"`
	Compiled  sql.NullString `json:"-"`
	Sortlen   sql.NullInt64  `json:"-"`
}

type Collations

type Collations struct {
	Collations map[string][]Collation
	Defaults   map[string]int
}

func NewCollations

func NewCollations() *Collations

type DataTable added in v1.3.0

type DataTable struct {
	Columns []string
	Values  []map[string]*sql.NullString
}

func NewDataTable added in v1.3.0

func NewDataTable() *DataTable

type Enum

type Enum struct {
	Int    int
	String string
}

type Field

type Field struct {
	Field         string
	Full_type     string
	Type          string
	Length        string
	Unsigned      string
	Default       sql.NullString
	Null          bool
	AutoIncrement sql.NullString
	On_update     string
	On_delete     string
	Collation     string
	Privileges    map[string]int
	Comment       string
	Primary       bool

	Original string
}

type FieldInfo

type FieldInfo struct {
	Field      sql.NullString
	Type       sql.NullString
	Collation  sql.NullString
	Null       sql.NullString
	Key        sql.NullString
	Default    sql.NullString
	Extra      sql.NullString
	Privileges sql.NullString
	Comment    sql.NullString
}

type FieldType

type FieldType struct {
	Name              string
	MaxUnsignedLength uint64
}

type FieldTypeGroup

type FieldTypeGroup struct {
	Types []*FieldType
	Label string
	Type  string
}

func (*FieldTypeGroup) IsNumeric

func (f *FieldTypeGroup) IsNumeric(typeName string) bool

func (*FieldTypeGroup) IsString

func (f *FieldTypeGroup) IsString(typeName string) bool

type ForeignKeyParam

type ForeignKeyParam struct {
	Name     string
	Database string
	Table    string
	Source   []string
	Target   []string
	OnDelete string
	OnUpdate string
}

type Grant

type Grant struct {
	Scope    string //all|database|table|column|proxy
	Value    string //*.*|db.*|db.table|db.table(col1,col2)
	Database string
	Table    string
	Columns  string            //col1,col2
	Settings map[string]string //["CREATE"]="1|0"
	*Operation
}

func (*Grant) IsValid

func (g *Grant) IsValid(group string, values map[string]*echo.Mapx) bool

func (*Grant) String

func (g *Grant) String() string

type IndexInfo

type IndexInfo struct {
	Table         sql.NullString
	Non_unique    sql.NullString
	Key_name      sql.NullString
	Seq_in_index  sql.NullString
	Column_name   sql.NullString
	Collation     sql.NullString
	Cardinality   sql.NullString
	Sub_part      sql.NullString
	Packed        sql.NullString
	Null          sql.NullString
	Index_type    sql.NullString
	Comment       sql.NullString
	Index_comment sql.NullString
}

type Indexes

type Indexes struct {
	Name    string
	Type    string
	Columns []string
	Lengths []string
	Descs   []string
}

type KV

type KV struct {
	Value string
	Text  string
}

type Operation

type Operation struct {
	Revoke  []string
	Grant   []string
	Columns string
	On      string
	User    string
	Scope   string //all|database|table|column|proxy
}

func (*Operation) Apply

func (op *Operation) Apply(m *mySQL) error

func (*Operation) HasAllPrivileges

func (op *Operation) HasAllPrivileges(values *[]string, deleteIt bool) bool

func (*Operation) HasGrantOption

func (op *Operation) HasGrantOption(values *[]string, deleteIt bool) bool

type Partition

type Partition struct {
	Method     sql.NullString
	Position   sql.NullString
	Expression sql.NullString
	Names      []string
	Values     []string
}

type Privilege

type Privilege struct {
	Privilege sql.NullString
	Context   sql.NullString
	Comment   sql.NullString
}

type Privileges

type Privileges struct {
	Privileges []*Privilege
	// contains filtered or unexported fields
}

func NewPrivileges

func NewPrivileges() *Privileges

func (*Privileges) Parse

func (p *Privileges) Parse()

type ProcessList

type ProcessList struct {
	Id       sql.NullInt64
	User     sql.NullString
	Host     sql.NullString
	Db       sql.NullString
	Command  sql.NullString
	Time     sql.NullInt64
	State    sql.NullString
	Info     sql.NullString
	Progress sql.NullFloat64
}

type Result

type Result struct {
	SQL          string
	SQLs         []string
	RowsAffected int64
	TimeStart    time.Time
	TimeEnd      time.Time
	Started      string
	Elapsed      string

	ErrorString string
	// contains filtered or unexported fields
}

func (*Result) Error

func (r *Result) Error() error

func (*Result) Exec

func (r *Result) Exec(p *factory.Param) *Result

func (*Result) Execs

func (r *Result) Execs(p *factory.Param) *Result

func (*Result) GetAffected

func (r *Result) GetAffected() int64

func (*Result) GetBeginTime

func (r *Result) GetBeginTime() string

func (*Result) GetElapsedTime

func (r *Result) GetElapsedTime() string

func (*Result) GetError

func (r *Result) GetError() string

func (*Result) GetSQL

func (r *Result) GetSQL() string

func (*Result) GetSQLs

func (r *Result) GetSQLs() []string

func (*Result) Queries

func (r *Result) Queries(p *factory.Param, readRows func(*sql.Rows) error) *Result

func (*Result) Query

func (r *Result) Query(p *factory.Param, readRows func(*sql.Rows) error) *Result

func (*Result) QueryRow

func (r *Result) QueryRow(p *factory.Param, recvs ...interface{}) *Result

func (*Result) SetError

func (r *Result) SetError(err error)

type SelectData added in v1.3.0

type SelectData struct {
	Result  *Result
	Data    *DataTable
	Explain *DataTable
}

type SupportedEngine

type SupportedEngine struct {
	Engine       sql.NullString //CSV|InnoDB|MyISAM|MEMORY...
	Support      sql.NullString //YES|DEFAULT
	Comment      sql.NullString
	Transactions sql.NullString //NO|YES
	XA           sql.NullString //NO|YES
	Savepoints   sql.NullString //NO|YES
}

type TableStatus

type TableStatus struct {
	Name            sql.NullString
	Engine          sql.NullString
	Version         sql.NullString
	Row_format      sql.NullString
	Rows            sql.NullInt64
	Avg_row_length  sql.NullInt64
	Data_length     sql.NullInt64
	Max_data_length sql.NullInt64
	Index_length    sql.NullInt64
	Data_free       sql.NullInt64
	Auto_increment  sql.NullInt64
	Create_time     sql.NullString
	Update_time     sql.NullString
	Check_time      sql.NullString
	Collation       sql.NullString
	Checksum        sql.NullString
	Create_options  sql.NullString
	Comment         sql.NullString
}

func (*TableStatus) FKSupport

func (t *TableStatus) FKSupport(currentVersion string) bool

func (*TableStatus) IsView

func (t *TableStatus) IsView() bool

func (*TableStatus) Size

func (t *TableStatus) Size() int64

type Trigger

type Trigger struct {
	Trigger              sql.NullString
	Event                sql.NullString
	Table                sql.NullString
	Statement            sql.NullString
	Timing               sql.NullString
	Created              sql.NullString
	Sql_mode             sql.NullString
	Definer              sql.NullString
	Character_set_client sql.NullString
	Collation_connection sql.NullString
	Database_collation   sql.NullString
	Of                   string
	Type                 string
}

type TriggerOption

type TriggerOption struct {
	Type    string
	Options []string
}

type TriggerOptions

type TriggerOptions []*TriggerOption

func (TriggerOptions) Get

func (t TriggerOptions) Get(typeName string) []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL