srdblib

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 14 Imported by: 4

README

srdblib

SHOWROOM関連のプログラムは共通のデータベースを使用しています。

https://github.com/Chouette2100/SRDB

このデータベースにアクセスするための関数を集めたライブラリです。 現時点ではまだ各プログラムにデータベースにアクセスするための関数が存在しており、今集約を進めているところです。


このライブラリーを使用している(あるいは使用する予定の)プログラムは以下のものです。

https://github.com/Chouette2100/SRGSE5M

https://github.com/Chouette2100/SRCGI

https://github.com/Chouette2100/SRGPC

https://github.com/Chouette2100/SRUEUI

https://github.com/Chouette2100/SRUUI

Documentation

Overview

! Copyright © 2023 [email protected] Released under the MIT license https://opensource.org/licenses/mit-license.php

! Copyright © 2024 [email protected] Released under the MIT license https://opensource.org/licenses/mit-license.php

! Copyright © 2023 [email protected] Released under the MIT license https://opensource.org/licenses/mit-license.php

! Copyright © 2022 [email protected] Released under the MIT license https://opensource.org/licenses/mit-license.php

Index

Constants

View Source
const Version = "01AB00"

Variables

View Source
var Colorlist1 []Color = []Color{
	{"cyan", "cyan"},
	{"magenta", "magenta"},
	{"yellow", "yellow"},
	{"royalblue", "royalblue"},
	{"coral", "coral"},
	{"khaki", "khaki"},
	{"deepskyblue", "deepskyblue"},
	{"crimson", "crimson"},
	{"orange", "orange"},
	{"lightsteelblue", "lightsteelblue"},
	{"pink", "pink"},
	{"sienna", "sienna"},
	{"springgreen", "springgreen"},
	{"blueviolet", "blueviolet"},
	{"salmon", "salmon"},
	{"lime", "lime"},
	{"red", "red"},
	{"darkorange", "darkorange"},
	{"skyblue", "skyblue"},
	{"lightpink", "lightpink"},
}
View Source
var Colorlist2 []Color = []Color{
	{"red", "#FF2800"},
	{"yellow", "#FAF500"},
	{"green", "#35A16B"},
	{"blue", "#0041FF"},
	{"skyblue", "#66CCFF"},
	{"lightpink", "#FFD1D1"},
	{"orange", "#FF9900"},
	{"purple", "#9A0079"},
	{"brown", "#663300"},
	{"lightgreen", "#87D7B0"},
	{"white", "#FFFFFF"},
	{"gray", "#77878F"},
}

https://www.fukushihoken.metro.tokyo.lg.jp/kiban/machizukuri/kanren/color.files/colorudguideline.pdf

View Source
var Db *sql.DB //  プログラム中では一貫してこの変数を使うこと
View Source
var Dberr error //  プログラム中では一貫してこの変数を使うこと
View Source
var Dialer sshql.Dialer
View Source
var Event_inf exsrapi.Event_Inf
View Source
var SortByFollowers bool
View Source
var Tevent = "event"
View Source
var Teventuser = "eventuser"
View Source
var Tuser = "user"
View Source
var Tuserhistory = "userhistory"

Functions

func ConverGenre2Abbr added in v1.1.0

func ConverGenre2Abbr(
	genre string,
) (
	abbr string,
)

日本語名のジャンルを英語名に変換する

v1.1.1 ジャンルの省略名は使わないようにする

func InsertEventinflistToEvent

func InsertEventinflistToEvent(
	tevent string,
	eventinflist *[]exsrapi.Event_Inf,
	bcheck bool,
) (
	err error,
)

イベント情報リストをイベントテーブルに格納する。 格納できたときは (*eventinflist)[i].Valid = false とする。 格納できないときは (*eventinflist)[i].Valid = true とする。 (*eventinflist)[i].Valid はイベント情報とは無関係で 処理の状況を示すために使われる。

func InsertIntoOrUpdateUser added in v1.1.0

func InsertIntoOrUpdateUser(tnow time.Time, eventid string, roominf RoomInfo) (status int)

func InsertNewOnes added in v1.1.0

func InsertNewOnes(
	client *http.Client,
	order int,
	eventinf exsrapi.Event_Inf,
	room srapi.Room,
) (
	err error,
)

func SelectCurEventList added in v1.1.0

func SelectCurEventList() (
	eventlist []exsrapi.Event_Inf,
	err error,
)

DBから現在開催中のイベントを抜き出す

func SelectEventNoAndName

func SelectEventNoAndName(eventid string) (
	eventname string,
	period string,
	status int,
)

func SelectEventRoomInfList

func SelectEventRoomInfList(
	eventid string,
	roominfolist *RoomInfoList,
) (
	eventname string,
	status int,
)

func SelectEventinflistFromEvent added in v1.1.0

func SelectEventinflistFromEvent(
	cond int,
	keyword string,
	offset int,
	limit int,
) (
	eventinflist []exsrapi.Event_Inf,
	err error,
)

指定した条件に該当するイベントのリストを作る。

func SelectFromEvent

func SelectFromEvent(eventid string) (
	peventinf *exsrapi.Event_Inf,
	err error,
)

func SelectPointList

func SelectPointList(userno int, eventid string) (norow int, tp *[]time.Time, pp *[]int)

func UpdatePointsSetQstatus

func UpdatePointsSetQstatus(
	eventid string,
	userno int,
	tstart string,
	tend string,
	point string,
) (status int)

Types

type Color

type Color struct {
	Name  string
	Value string
}

type ColorInf

type ColorInf struct {
	Color      string
	Colorvalue string
	Selected   string
}

type ColorInfList

type ColorInfList []ColorInf

type DBConfig

type DBConfig struct {
	UseSSH    bool   `yaml:"UseSSH"`
	DBhost    string `yaml:"DBhost"`
	DBport    string `yaml:"DBport"`
	DBname    string `yaml:"DBname"`
	DBuser    string `yaml:"DBuser"`
	DBpswd    string `yaml:"DBpswd"`
	SRacct    string `yaml:"SRacct"`
	SRpswd    string `yaml:"SRpswd"`
	SSHhost   string `yaml:"SSHhost"`
	SSHport   int    `yaml:"SSHport"`
	SSHuser   string `yaml:"SSHuser"`
	SSHpswd   string `yaml:"SSHpswd"`
	SSHprvkey string `yaml:"SSHprvkey"`
}

func OpenDb

func OpenDb(filenameofdbconfig string) (dbconfig *DBConfig, err error)

type PerSlot

type PerSlot struct {
	Timestart time.Time
	Dstart    string
	Tstart    string
	Tend      string
	Point     string
	Ipoint    int
	Tpoint    string
}

type PerSlotInf

type PerSlotInf struct {
	Eventname   string
	Eventid     string
	Period      string
	Roomname    string
	Roomid      int
	Perslotlist []PerSlot
}

func MakePointPerSlot

func MakePointPerSlot(eventid string) (perslotinflist []PerSlotInf, status int)

type RoomInfo

type RoomInfo struct {
	Name      string //	ルーム名のリスト
	Longname  string
	Shortname string
	Account   string //	アカウントのリスト、アカウントは配信のURLの最後の部分の英数字です。
	ID        string //	IDのリスト、IDはプロフィールのURLの最後の部分で5~6桁の数字です。
	Userno    int
	//	APIで取得できるデータ(1)
	Genre      string
	Rank       string
	Irank      int
	Nrank      string
	Prank      string
	Followers  int
	Sfollowers string
	Fans       int
	Fans_lst   int
	Level      int
	Slevel     string
	//	APIで取得できるデータ(2)
	Order        int
	Point        int //	イベント終了後12時間〜36時間はイベントページから取得できることもある
	Spoint       string
	Istarget     string
	Graph        string
	Iscntrbpoint string
	Color        string
	Colorvalue   string
	Colorinflist ColorInfList
	Formid       string
	Eventid      string
	Status       string
	Statuscolor  string
}

type RoomInfoList

type RoomInfoList []RoomInfo

func (RoomInfoList) Choose

func (r RoomInfoList) Choose(from, to int) (s RoomInfoList)

func (RoomInfoList) Len

func (r RoomInfoList) Len() int

sort.Sort()のための関数三つ

func (RoomInfoList) Less

func (r RoomInfoList) Less(i, j int) bool

降順に並べる

func (RoomInfoList) Swap

func (r RoomInfoList) Swap(i, j int)

Jump to

Keyboard shortcuts

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