service

package
v0.0.0-...-e52901f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Project = os.Getenv("PROJECT")
)
View Source
var RedirectTableColumn = []string{"user", "redirect_path", "org", "host", "comment", "active", "begin_at", "end_at", "created_at", "update_at", "deleted_at"}
View Source
var RedirectTableName = "redirects"

Functions

func SqlConnect

func SqlConnect(project string, p DbParams) (database *gorm.DB, err error)

Types

type DBOperator

type DBOperator interface {
	// contains filtered or unexported methods
}

type DbParams

type DbParams struct {
	Dbms   string
	Dbuser string
	Dbpass string
	Dbname string
	Dbhost string
}

type MyDB

type MyDB interface {
	Put(params []interface{}) error
	Get(query string) ([]string, error)
	List() ([]string, error)
}

type Redirection

type Redirection struct {
	DbParams
}

func New

func New(dbParams DbParams) Redirection

func (*Redirection) GetInfoByUser

func (s *Redirection) GetInfoByUser(ctx context.Context, user *pb.User) (*pb.ArrayRedirectData, error)

func (*Redirection) GetOrgByPath

func (s *Redirection) GetOrgByPath(ctx context.Context, path *pb.RedirectPath) (*pb.OrgUrl, error)

func (*Redirection) ListUsers

func (s *Redirection) ListUsers(ctx context.Context, empty *emptypb.Empty) (*pb.Users, error)

func (*Redirection) PingPongMessage

func (s *Redirection) PingPongMessage(ctx context.Context, message *pb.Message) (*pb.Message, error)

func (*Redirection) RemoveUser

func (s *Redirection) RemoveUser(ctx context.Context, r *pb.User) (*emptypb.Empty, error)

func (*Redirection) SetInfo

func (s *Redirection) SetInfo(ctx context.Context, r *pb.RedirectData) (*pb.OrgUrl, error)

func (*Redirection) SetUser

func (s *Redirection) SetUser(ctx context.Context, r *pb.User) (*pb.User, error)

type Redirects

type Redirects struct {
	gorm.Model
	User         string `gorm:"foreignKey:UserName"`
	RedirectPath string
	Org          string
	Host         string
	Comment      string
	Active       int
	BeginAt      *time.Time // it will insert NULL when no value is specified
	EndAt        *time.Time // it will insert NULL when no value is specified
}

type Users

type Users struct {
	// gorm.Model
	Username string
	NotifyTo string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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