conn

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
}

func (*DB) CloseDatabase

func (db *DB) CloseDatabase()

CloseDatabase method is closing a connection between your app and your db

func (*DB) ConnectDatabase

func (db *DB) ConnectDatabase()

ConnectDatabase is creating a new connection to our database

func (*DB) CountInTable

func (db *DB) CountInTable(table string, conditions map[string]any) (int, error)

CountInTable: returns the number of data according to the conditions

func (*DB) DynamicCreate

func (db *DB) DynamicCreate(table string, fields map[string]any) error

DynamicCreate: the specified values are recorded in the specified table.

func (*DB) DynamicUpdate

func (db *DB) DynamicUpdate(table string, updates map[string]any, conditions map[string]any) error

DynamicUpdate: the values specified in the table are updated.

func (*DB) ExistsInTable

func (db *DB) ExistsInTable(table string, conditions map[string]any) error

ExistsInTable: If exists, I should get a “nil” return.

func (*DB) NotExistsInTable

func (db *DB) NotExistsInTable(table string, conditions map[string]any) error

NotExistsInTable: If not exists, I should get a “nil” return.

func (*DB) QueryExec

func (db *DB) QueryExec(query string, params []any) error

QueryExec: runs the given query with the specified parameters.

func (*DB) RunPrepare

func (db *DB) RunPrepare(exec any, query string, args ...any) (*sql.Stmt, error)

func (*DB) SoftDelete

func (db *DB) SoftDelete(id int, table string) error

SoftDelete: soft delete the specified id in the specified table.

type Kafka

type Kafka struct {
	sarama.SyncProducer
}

func (*Kafka) CloseKafka

func (k *Kafka) CloseKafka()

func (*Kafka) NewKafka

func (k *Kafka) NewKafka()

func (*Kafka) PushCommentToQueue

func (k *Kafka) PushCommentToQueue(topic string, message []byte) error

type Redis

type Redis struct {
	*redis.Client
}

func (*Redis) CloseRedis

func (r *Redis) CloseRedis()

func (*Redis) ConnectRedis

func (r *Redis) ConnectRedis()

func (*Redis) RedisRead

func (r *Redis) RedisRead() (string, error)

func (*Redis) RedisWrite

func (r *Redis) RedisWrite() error

Jump to

Keyboard shortcuts

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