sql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(driver string, db *sql.DB, storageMountID string, userConverter UserConverter) (share.Manager, error)

New returns a new Cache instance connecting to the given sql.DB

func NewMysql

func NewMysql(m map[string]interface{}) (share.Manager, error)

NewMysql returns a new share manager connection to a mysql database

Types

type DBShare

type DBShare struct {
	ID           string
	UIDOwner     string
	UIDInitiator string
	ItemStorage  string
	ItemSource   string
	ShareWith    string
	Token        string
	Expiration   string
	Permissions  int
	ShareType    int
	ShareName    string
	STime        int
	FileTarget   string
	RejectedBy   string
	State        int
}

DBShare stores information about user and public shares.

type GatewayUserConverter

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

GatewayUserConverter converts usernames and ids using the gateway

func NewGatewayUserConverter

func NewGatewayUserConverter(gwAddr string) *GatewayUserConverter

NewGatewayUserConverter returns a instance of GatewayUserConverter

func (*GatewayUserConverter) UserIDToUserName

func (c *GatewayUserConverter) UserIDToUserName(ctx context.Context, userid *userpb.UserId) (string, error)

UserIDToUserName converts a user ID to an username

func (*GatewayUserConverter) UserNameToUserID

func (c *GatewayUserConverter) UserNameToUserID(ctx context.Context, username string) (*userpb.UserId, error)

UserNameToUserID converts a username to an user ID

type UserConverter

type UserConverter interface {
	UserNameToUserID(ctx context.Context, username string) (*userpb.UserId, error)
	UserIDToUserName(ctx context.Context, userid *userpb.UserId) (string, error)
}

UserConverter describes an interface for converting user ids to names and back

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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