sql

package
v0.0.0-...-2b6bb91 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Accounts map[string]AccountsStruct
)

Functions

func CheckControl

func CheckControl(target string, platform string)

********************************************************************************

  • _ _ _____ _ _
  • | | | | / ____| | | | |
  • ___| |__ ___ ___| | _| | ___ _ __ | |_ _ __ ___ | |
  • / __| '_ \ / _ \/ __| |/ / | / _ \| '_ \| __| '__/ _ \| |
  • | (__| | | | __/ (__| <| |___| (_) | | | | |_| | | (_) | |
  • \___|_| |_|\___|\___|_|\_\\_____\___/|_| |_|\__|_| \___/|_|
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • get the last article in the database.
  • -----------------------------------------------------------------------------

func CountSQL

func CountSQL(sqlStatement string) (id int64)

********countSQL*******************************************************************

  • _ _____ ____ _
  • | | / ____|/ __ \| |
  • ___ ___ _ _ _ __ | |_| (___ | | | | |
  • / __/ _ \| | | | '_ \| __|\___ \| | | | |
  • | (_| (_) | |_| | | | | |_ ____) | |__| | |____
  • \___\___/ \__,_|_| |_|\__|_____/ \___\_\______|
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Count records based on the SQL request.
  • ------------------------------------------------------------------------

func GetJsonByArticleId

func GetJsonByArticleId(articleId string) (reply conf.Reply)

****************************************************************************************************

  • _ _ ____ _____ _
  • | | | | | _ \ |_ _| | |
  • __ _ ___| |_ | |___ ___ _ __ | |_) |_ _ | | __| |
  • / _` |/ _ \ __| | / __|/ _ \| '_ \| _ <| | | | | | / _` |
  • | (_| | __/ || |__| \__ \ (_) | | | | |_) | |_| |_| || (_| |
  • \__, |\___|\__\____/|___/\___/|_| |_|____/ \__, |_____\__,_|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • ------------------------------------------------------------------------------------------------

func GetJsonByContent

func GetJsonByContent(searchStr string, limit int, topic string) (reply conf.Reply)

****************************************************************************************************

  • _ _ ____ _____ _ _
  • | | | | | _ \ / ____| | | | |
  • __ _ ___| |_ | |___ ___ _ __ | |_) |_ _| | ___ _ __ | |_ ___ _ __ | |_
  • / _` |/ _ \ __| | / __|/ _ \| '_ \| _ <| | | | | / _ \| '_ \| __/ _ \ '_ \| __|
  • | (_| | __/ || |__| \__ \ (_) | | | | |_) | |_| | |___| (_) | | | | || __/ | | | |_
  • \__, |\___|\__\____/|___/\___/|_| |_|____/ \__, |\_____\___/|_| |_|\__\___|_| |_|\__|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • ------------------------------------------------------------------------------------------------

func GetJsonByTitle

func GetJsonByTitle(search string, limit int, topic string) (reply conf.Reply)

****************************************************************************************************

  • _ _ ____ _______ _ _ _
  • | | | | | _ \ |__ __(_) | | |
  • __ _ ___| |_ | |___ ___ _ __ | |_) |_ _| | _| |_| | ___
  • / _` |/ _ \ __| | / __|/ _ \| '_ \| _ <| | | | | | | __| |/ _ \
  • | (_| | __/ || |__| \__ \ (_) | | | | |_) | |_| | | | | |_| | __/
  • \__, |\___|\__\____/|___/\___/|_| |_|____/ \__, |_| |_|\__|_|\___|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • ------------------------------------------------------------------------------------------------

func GetLastJsonByFilter

func GetLastJsonByFilter(limit int, filter string, topic string) (reply conf.Reply)

****************************************************************************************************

  • _ _ _ _ ____ ______ _ _ _
  • | | | | | | | | | _ \ | ____(_) | |
  • __ _ ___| |_| | __ _ ___| |_ | |___ ___ _ __ | |_) |_ _| |__ _| | |_ ___ _ __
  • / _` |/ _ \ __| | / _` / __| __| | / __|/ _ \| '_ \| _ <| | | | __| | | | __/ _ \ '__|
  • | (_| | __/ |_| |___| (_| \__ \ || |__| \__ \ (_) | | | | |_) | |_| | | | | | || __/ |
  • \__, |\___|\__|______\__,_|___/\__\____/|___/\___/|_| |_|____/ \__, |_| |_|_|\__\___|_|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • ------------------------------------------------------------------------------------------------

func GetLastSingleJsonArticle

func GetLastSingleJsonArticle(topic string, limit int) (reply conf.Reply)

********************************************************************************

  • _ _ _ _ _ _
  • | | | | | | /\ | | (_) | |
  • __ _ ___| |_| | __ _ ___| |_ / \ _ __| |_ _ ___| | ___
  • / _` |/ _ \ __| | / _` / __| __| / /\ \ | '__| __| |/ __| |/ _ \
  • | (_| | __/ |_| |___| (_| \__ \ |_ / ____ \| | | |_| | (__| | __/
  • \__, |\___|\__|______\__,_|___/\__/_/ \_\_| \__|_|\___|_|\___|
  • __/ |
  • |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • get the last article in the database.
  • -----------------------------------------------------------------------------

func GetLatestJsonArticle

func GetLatestJsonArticle(callerId string, limit int, next bool, platform string, topic string) (reply conf.Reply)

****************************************************************************************************

  • _ _ _ _ _ _ _ _
  • | | | \ | | | | | | /\ | | (_) | |
  • __ _ ___| |_| \| | _____ _| |_ | |___ ___ _ __ / \ _ __| |_ _ ___| | ___
  • / _` |/ _ \ __| . ` |/ _ \ \/ / __| | / __|/ _ \| '_ \ / /\ \ | '__| __| |/ __| |/ _ \
  • | (_| | __/ |_| |\ | __/> <| || |__| \__ \ (_) | | | |/ ____ \| | | |_| | (__| | __/
  • \__, |\___|\__|_| \_|\___/_/\_\\__\____/|___/\___/|_| |_/_/ \_\_| \__|_|\___|_|\___|
  • __/ |
  • |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • ------------------------------------------------------------------------------------------------

func GetListOfTargets

func GetListOfTargets(platform string) (aList []string)

TODO check this function

func GetNextArticle

func GetNextArticle(callerId string, platform string, topic string) (message string, Behind int)

******************************************************************************

  • _ _ _ _ _ _ _
  • | | | \ | | | | /\ | | (_) | |
  • __ _ ___| |_| \| | _____ _| |_ / \ _ __| |_ _ ___| | ___
  • / _` |/ _ \ __| . ` |/ _ \ \/ / __| / /\ \ | '__| __| |/ __| |/ _ \
  • | (_| | __/ |_| |\ | __/> <| |_ / ____ \| | | |_| | (__| | __/
  • \__, |\___|\__|_| \_|\___/_/\_\\__/_/ \_\_| \__|_|\___|_|\___|
  • __/ |
  • |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID from the control
  • ----------------------------------------------------------------------------

func GetNextArticleByKeyWords

func GetNextArticleByKeyWords(callerId string, keyword string, platform string, topic string) (message string)

******************************************************************************

  • _ _ _ _ _ _ _ ____ _ __
  • | | | \ | | | | /\ | | (_) | | | _ \ | |/ /
  • __ _ ___| |_| \| | _____ _| |_ / \ _ __| |_ _ ___| | ___| |_) |_ _| ' / ___ _ _
  • / _` |/ _ \ __| . ` |/ _ \ \/ / __| / /\ \ | '__| __| |/ __| |/ _ \ _ <| | | | < / _ \ | | |
  • | (_| | __/ |_| |\ | __/> <| |_ / ____ \| | | |_| | (__| | __/ |_) | |_| | . \ __/ |_| |
  • \__, |\___|\__|_| \_|\___/_/\_\\__/_/ \_\_| \__|_|\___|_|\___|____/ \__, |_|\_\___|\__, |
  • __/ | __/ | __/ |
  • |___/ |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID from the control
  • ----------------------------------------------------------------------------

func GetNextJsonByArticleId

func GetNextJsonByArticleId(articleId string, limit int, filter string, topic string) (reply conf.Reply)

**********************************************************************************************************************

  • _ _ _ _ _ ____ _ _ _ _____ _
  • | | | \ | | | | | | | _ \ /\ | | (_) | | |_ _| | |
  • __ _ ___| |_| \| | _____ _| |_ | |___ ___ _ __ | |_) |_ _ / \ _ __| |_ _ ___| | ___ | | __| |
  • / _` |/ _ \ __| . ` |/ _ \ \/ / __| | / __|/ _ \| '_ \| _ <| | | | / /\ \ | '__| __| |/ __| |/ _ \ | | / _` |
  • | (_| | __/ |_| |\ | __/> <| || |__| \__ \ (_) | | | | |_) | |_| |/ ____ \| | | |_| | (__| | __/_| || (_| |
  • \__, |\___|\__|_| \_|\___/_/\_\\__\____/|___/\___/|_| |_|____/ \__, /_/ \_\_| \__|_|\___|_|\___|_____\__,_|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • -------------------------------------------------------------------------------------------------------------------

func GetPrevJsonByArticleId

func GetPrevJsonByArticleId(articleId string, limit int, filter string, topic string) (reply conf.Reply)

***********************************************************************************************************************

  • _ _____ _ ____ _ _ _ _____ _
  • | | | __ \ | | | _ \ /\ | | (_) | | |_ _| | |
  • __ _ ___| |_| |__) | __ _____ __ | |___ ___ _ __ | |_) |_ _ / \ _ __| |_ _ ___| | ___ | | __| |
  • / _` |/ _ \ __| ___/ '__/ _ \ \ / / | / __|/ _ \| '_ \| _ <| | | | / /\ \ | '__| __| |/ __| |/ _ \ | | / _` |
  • | (_| | __/ |_| | | | | __/\ V / |__| \__ \ (_) | | | | |_) | |_| |/ ____ \| | | |_| | (__| | __/_| || (_| |
  • \__, |\___|\__|_| |_| \___| \_/ \____/|___/\___/|_| |_|____/ \__, /_/ \_\_| \__|_|\___|_|\___|_____\__,_|
  • __/ | __/ |
  • |___/ |___/
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Gets the next article depending on the last Article ID and return as a json object
  • -------------------------------------------------------------------------------------------------------------------

func InitDB

func InitDB()

func InsertArticle

func InsertArticle(topic string, title string, content string, name string, email string, cat string, link string, image string) (id int64, returnErr error)

******************************************************************

  • _ _ _ _ _
  • (_) | | /\ | | (_) | |
  • _ _ __ ___ ___ _ __| |_ / \ _ __| |_ _ ___| | ___
  • | | '_ \/ __|/ _ \ '__| __| / /\ \ | '__| __| |/ __| |/ _ \
  • | | | | \__ \ __/ | | |_ / ____ \| | | |_| | (__| | __/
  • |_|_| |_|___/\___|_| \__/_/ \_\_| \__|_|\___|_|\___|
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Inserts new articles into the datase, Rejects duplicates
  • ----------------------------------------------------------------

func LoadAccounts

func LoadAccounts()

TODO save accounts to Database

func RunSQL

func RunSQL(sqlStatement string) (id int64)

***************************************************************************

  • _ _____ _ _ _
  • | |/ ____| | | | | |
  • ___ __ _| | (___ | |_ __ _| |_ ___ _ __ ___ ___ _ __ | |_
  • / __|/ _` | |\___ \| __/ _` | __/ _ \ '_ ` _ \ / _ \ '_ \| __|
  • \__ \ (_| | |____) | || (_| | || __/ | | | | | __/ | | | |_
  • |___/\__, |_|_____/ \__\__,_|\__\___|_| |_| |_|\___|_| |_|\__|
  • | |
  • |_|
  • * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • Run an SQL statement such as an insert.
  • ------------------------------------------------------------------------

Types

type AccountsStruct

type AccountsStruct struct {
	Email     string
	Otpkey    string
	Plan      string
	Allocated int64
	Used      int64
	End       time.Time
}

type Article

type Article struct {
	Uid     int64         `json:"uid"`
	Title   string        `json:"title"`
	Content string        `json:"desc"`
	Author  string        `json:"author"`
	Email   string        `json:"email"`
	Topic   string        `json:"topic"`
	Cat     string        `json:"cat"`
	Link    string        `json:"link"`
	Detail  ArticleDetail `json:"detail"`
	Rating  int64         `json:"rating"`
	Created time.Time     `json:"created"`
}

type ArticleDetail

type ArticleDetail map[string]interface{}

func (*ArticleDetail) Scan

func (a *ArticleDetail) Scan(value interface{}) error

func (*ArticleDetail) Value

func (a *ArticleDetail) Value() (driver.Value, error)

type HomeMadeArticle

type HomeMadeArticle struct {
	Title   string `json:"title"`
	Content string `json:"desc"`
	Author  string `json:"author"`
	Email   string `json:"email"`
	Cat     string `json:"cat"`
	Link    string `json:"link"`
	Image   string `json:"image"`
}

Jump to

Keyboard shortcuts

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