repo

package
v0.0.0-...-827ba16 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventLogFields = []string{"event_log_id", "description", "gmt_create", "member_id", "action"}

Functions

func CloseDB

func CloseDB()

func CreateClient

func CreateClient(client *model.Client) error

func CreateEvent

func CreateEvent(event *model.Event) error

func CreateEventLog

func CreateEventLog(eventLog *model.EventLog, conn *sqlx.Tx) error

func CreateMember

func CreateMember(member *model.Member) error

func ExistEventAction

func ExistEventAction(action string) (bool, error)

func ExistEventStatus

func ExistEventStatus(status string) (bool, error)

func ExistMember

func ExistMember(id string) (bool, error)

func ExistRole

func ExistRole(role string) (bool, error)

func GetClientByOpenId

func GetClientByOpenId(openId string) (model.Client, error)

func GetClientEvents

func GetClientEvents(f EventFilter, clientId string) ([]model.Event, error)

func GetEventById

func GetEventById(id int64) (model.Event, error)

func GetEventClientId

func GetEventClientId(eventId int64) (int64, error)

func GetEvents

func GetEvents(f EventFilter) ([]model.Event, error)

func GetMemberById

func GetMemberById(id string) (model.Member, error)

func GetMemberEvents

func GetMemberEvents(f EventFilter, memberId string) ([]model.Event, error)

func GetMemberIdByLogtoId

func GetMemberIdByLogtoId(logtoId string) (sql.NullString, error)

func GetMembers

func GetMembers(offset uint64, limit uint64) ([]model.Member, error)

func GetRoleId

func GetRoleId(role string) (sql.NullInt64, error)

func InitDB

func InitDB()

func SetDB

func SetDB(dbx *sqlx.DB)

func SetEventAction

func SetEventAction(eventLogId int64, action string, conn *sqlx.Tx) error

func SetEventStatus

func SetEventStatus(eventId int64, status string, conn *sqlx.Tx) (sql.Result, error)

func SetMemberRole

func SetMemberRole(memberId string, role string, conn *sqlx.Tx) error

func UpdateEvent

func UpdateEvent(event *model.Event, eventLog *model.EventLog) error

func UpdateMember

func UpdateMember(member model.Member) error

Types

type EventFilter

type EventFilter struct {
	Offset uint64
	Limit  uint64
	Status string
	Order  string
}

type Hooks

type Hooks struct{}

Hooks satisfies the sqlhooks.Hooks interface

func (*Hooks) After

func (h *Hooks) After(ctx context.Context, query string, args ...interface{}) (context.Context, error)

After hook will get the timestamp registered on the Before hook and print the elapsed time

func (*Hooks) Before

func (h *Hooks) Before(ctx context.Context, query string, args ...interface{}) (context.Context, error)

Before hook will print the query with it's args and return the context with the timestamp

type JoinEvent

type JoinEvent struct {
	Event  model.Event      `db:"event"`
	Member model.NullMember `db:"member"`
	Admin  model.NullMember `db:"admin"`
}

when a struct contains sub struct, the struct's field has the db tag of "struct'dbTag.subStruct.dbTag" for example: the db tag here for event is event, the db tag for mode.Event has field "EventId" with db tag "event_id" therefore the JoinEvent.Event.EventId has db tag of event.event_id.

func (JoinEvent) ToEvent

func (je JoinEvent) ToEvent() model.Event

TODO this need to be refactored...

Jump to

Keyboard shortcuts

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