db

package
v0.0.0-...-68d3b97 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 2019 The DutchSec Authors.

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 (
	ErrNoGetterFound          = errors.New("No Getter found")
	ErrNoDeleterFound         = errors.New("No Deleter found")
	ErrNoSelecterFound        = errors.New("No Select found")
	ErrNoInsertOrUpdaterFound = errors.New("No InsertOrUpdater found")
	ErrNoUpdaterFound         = errors.New("No Updater found")
	ErrNoInserterFound        = errors.New("No Inserter found")
)

TODO: NEEDS COMMENT INFO

Functions

func DiscardLogging

func DiscardLogging()

func IsDuplicateKeyErr

func IsDuplicateKeyErr(err error) bool

func IsNoRowsErr

func IsNoRowsErr(err error) bool

func IsTxDoneErr

func IsTxDoneErr(err error) bool

func RandomString

func RandomString(length int) string

func SubQuery

func SubQuery(v interface{}) subQuery

Types

type Builder

type Builder interface {
	Build() (Query, []interface{})
}

type DB

type DB struct {
	*sqlx.DB
}

DB TODO: NEEDS COMMENT INFO

func Connect

func Connect(driverName, dataSourceName string) (*DB, error)

func (*DB) Begin

func (db *DB) Begin(ctx context.Context, opts ...TxOptionFunc) (*Tx, error)

Begin TODO: NEEDS COMMENT INFO

func (*DB) Do

func (db *DB) Do(ctx context.Context, fn func(tx *Tx) error) error

type Deleter

type Deleter interface {
	Delete(*sqlx.Tx) error
}

Deleter TODO: NEEDS COMMENT INFO

type Field

type Field string

func (Field) Alias

func (s Field) Alias(alias string)

func (Field) Build

func (f Field) Build() (Query, []interface{})

type Getter

type Getter interface {
	Get(*sqlx.Tx, Query, []interface{}) error
}

Getter TODO: NEEDS COMMENT INFO

type InsertOrUpdater

type InsertOrUpdater interface {
	InsertOrUpdate(*sqlx.Tx) error
}

type Inserter

type Inserter interface {
	Insert(*sqlx.Tx) error
}

Inserter TODO: NEEDS COMMENT INFO

type New

type New struct {
	// contains filtered or unexported fields
}

New TODO: NEEDS COMMENT INFO

type Newerer

type Newerer interface {
	// contains filtered or unexported methods
}

Newerer TODO: NEEDS COMMENT INFO

type Operator

type Operator interface {
	Make() (string, []interface{})
}

Operator TODO: NEEDS COMMENT INFO

func Active

func Active() Operator

Active TODO: NEEDS COMMENT INFO this is not ok.

func And

func And(operators ...Operator) Operator

AndOperator TODO: NEEDS COMMENT INFO

func Equal

func Equal(left interface{}, right interface{}) Operator

Equal TODO: NEEDS COMMENT INFO

func False

func False(fld Field) Operator

func GreaterThan

func GreaterThan(field Field, value interface{}) Operator

GreaterThan TODO: NEEDS COMMENT INFO

func In

func In(field Field, params []interface{}) Operator

OrOperator TODO: NEEDS COMMENT INFO

func InOperator

func InOperator(field Field, qry Queryx) Operator

OrOperator TODO: NEEDS COMMENT INFO

func IsNotNull

func IsNotNull(field Field) Operator

IsNotNull TODO: NEEDS COMMENT INFO

func IsNull

func IsNull(field Field) Operator

GreaterThan TODO: NEEDS COMMENT INFO

func LessThan

func LessThan(field Field, value interface{}) Operator

LessThan TODO: NEEDS COMMENT INFO

func Like

func Like(left interface{}, right interface{}) Operator

Equal TODO: NEEDS COMMENT INFO

func Not

func Not(o Operator) Operator

Not TODO: NEEDS COMMENT INFO

func Or

func Or(operators ...Operator) Operator

Or TODO: NEEDS COMMENT INFO

func True

func True(fld Field) Operator

type Query

type Query string

Query TODO: NEEDS COMMENT INFO

type Queryx

type Queryx struct {
	// contains filtered or unexported fields
}

func DeleteQuery

func DeleteQuery(tableName string) Queryx

func SelectQuery

func SelectQuery(tableName string) Queryx

func (Queryx) Build

func (tq Queryx) Build() (Query, []interface{})

func (Queryx) CountRows

func (tq Queryx) CountRows() Queryx

func (Queryx) Dump

func (tq Queryx) Dump() string

func (Queryx) Fields

func (tq Queryx) Fields(fields ...Field) Queryx

Fields NEEDS COMMENT INFO

func (Queryx) GroupBy

func (tq Queryx) GroupBy(fields ...Field) Queryx

func (Queryx) Join

func (tq Queryx) Join(tableName string) tableJoinQuery

func (Queryx) LeftJoin

func (tq Queryx) LeftJoin(tableName string) tableJoinQuery

func (Queryx) Limit

func (tq Queryx) Limit(offset, count int) Queryx

func (Queryx) OrderBy

func (tq Queryx) OrderBy(fields ...Field) Queryx

TODO: keep track of fields on construct at once, make it an arry Query().OrderBy(fld).OrderByDesc(fld2)

func (Queryx) OrderByDesc

func (tq Queryx) OrderByDesc(fields ...Field) Queryx

TODO: keep track of fields on construct at once, make it an arry

func (Queryx) RightJoin

func (tq Queryx) RightJoin(tableName string) tableJoinQuery

func (Queryx) Where

func (tq Queryx) Where(operator Operator) Queryx

type Selecter

type Selecter interface {
	Select(*sqlx.Tx, Query, ...interface{}) error
}

Selecter TODO: NEEDS COMMENT INFO

type Table

type Table string

func (Table) Alias

func (s Table) Alias(alias string)

func (Table) Build

func (s Table) Build() (Query, []interface{})

type Tx

type Tx struct {
	Tx *sqlx.Tx
	// contains filtered or unexported fields
}

Tx TODO: NEEDS COMMENT INFO

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) Countx

func (tx *Tx) Countx(qy Queryx) (int, error)

Countx TODO: NEEDS COMMENT INFO

func (*Tx) Delete

func (tx *Tx) Delete(o interface{}) error

Delete TODO: NEEDS COMMENT INFO

func (*Tx) Execute

func (tx *Tx) Execute(qy Queryx) error

Exec TODO: NEEDS COMMENT INFO

func (tx *Tx) Exec(qx Queryx) error {
	stmt, err := tx.Preparex(qx.Query)
	if err != nil {
		return err
	}

	_, err = stmt.Exec(qx.Params...)
	return err
}

func (*Tx) Exists

func (tx *Tx) Exists(qy Queryx) (bool, error)

Exists TODO: NEEDS COMMENT INFO

func (*Tx) Getx

func (tx *Tx) Getx(o interface{}, qy Queryx) error

Getx TODO: NEEDS COMMENT INFO

func (*Tx) Insert

func (tx *Tx) Insert(o interface{}) error

Insert TODO: NEEDS COMMENT INFO

func (*Tx) InsertOrUpdate

func (tx *Tx) InsertOrUpdate(o interface{}) error

Update TODO: NEEDS COMMENT INFO

func (*Tx) NamedExec

func (tx *Tx) NamedExec(query string, arg interface{}) (sql.Result, error)

Update TODO: NEEDS COMMENT INFO

func (*Tx) Preparex

func (tx *Tx) Preparex(query Query) (*sqlx.Stmt, error)

func (*Tx) Rollback

func (tx *Tx) Rollback() error

func (*Tx) Selectx

func (tx *Tx) Selectx(o interface{}, qy Queryx, options ...selectOption) error

Selectx TODO: NEEDS COMMENT INFO

func (*Tx) Update

func (tx *Tx) Update(o interface{}) error

Update TODO: NEEDS COMMENT INFO

type TxOptionFunc

type TxOptionFunc func(opt *sql.TxOptions)

func ReadOnly

func ReadOnly() TxOptionFunc

type Updater

type Updater interface {
	Update(*sqlx.Tx) error
}

Updater TODO: NEEDS COMMENT INFO

Jump to

Keyboard shortcuts

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