util

package
v0.0.0-...-f479c88 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package util provides common code for all the importers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQL

func ParseSQL(line string, table string) ([]string, error)

ParseSQL parses a line of the SQL statement by extracting the relevant INSERT line into the target table

func Reverse

func Reverse(s string) string

func SplitString

func SplitString(query string, sep rune, keepEmpty bool, singleQuote bool) []string

SplitString splits a quoted string.

query (string): the string to split
sep (rune): the separator to split on
keepEmpty (bool): whether to keep empty fiedls
singleQuote (bool): true to use single quote, false to use double quote

Types

type GenericData

type GenericData struct {
	Id           primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	MemberID     int                `bson:"memberid"`
	Email        string             `bson:"email"`
	Liame        string             `bson:"liame"`
	PasswordHash string             `bson:"passwordhash"`
	Password     string             `bson:"password"`
	Username     string             `bson:"username"`
	Hint         string             `bson:"hint"`
	Breach       string             `bson:"breach"`
	IP           string             `bson:"ip"`
	Name         string             `bson:"name"`
}

type Importer

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

func MakeImporter

func MakeImporter(defaultFileName string, parser LineParser, numThreads int) (*Importer, error)

MakeImporter constructs and returns an importer

func (*Importer) Finish

func (i *Importer) Finish()

Finish finishes the importing process

func (*Importer) Run

func (i *Importer) Run()

type LineParser

type LineParser interface {
	ParseLine(line string) ([]interface{}, error)
	EstimateCount(line string) (int, error)
}

Jump to

Keyboard shortcuts

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