repo

package
v0.0.0-...-c20d9b3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUserRepo

func NewUserRepo(
	db *db.Client,
	ipdb *ipdb.IPDB,
	redis *redis.Client,
	cfg *config.Config,
) domain.UserRepo

Types

type UserRepo

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

func (*UserRepo) AdminByName

func (r *UserRepo) AdminByName(ctx context.Context, username string) (*db.Admin, error)

func (*UserRepo) AdminList

func (r *UserRepo) AdminList(ctx context.Context, page *web.Pagination) ([]*db.Admin, *db.PageInfo, error)

func (*UserRepo) AdminLoginHistory

func (r *UserRepo) AdminLoginHistory(ctx context.Context, page *web.Pagination) ([]*db.AdminLoginHistory, *db.PageInfo, error)

func (*UserRepo) CleanPermissionCache

func (r *UserRepo) CleanPermissionCache(ctx context.Context, id uuid.UUID)

func (*UserRepo) CreateAdmin

func (r *UserRepo) CreateAdmin(ctx context.Context, admin *db.Admin, roleID int64) (*db.Admin, error)

func (*UserRepo) CreateInviteCode

func (r *UserRepo) CreateInviteCode(ctx context.Context, userID string, code string) (*db.InviteCode, error)

func (*UserRepo) CreateUser

func (r *UserRepo) CreateUser(ctx context.Context, us *db.User) (*db.User, error)

func (*UserRepo) Delete

func (r *UserRepo) Delete(ctx context.Context, id string) error

func (*UserRepo) DeleteAdmin

func (r *UserRepo) DeleteAdmin(ctx context.Context, id string) error

func (*UserRepo) ExportCompletionData

func (r *UserRepo) ExportCompletionData(ctx context.Context) ([]*domain.CompletionData, error)

func (*UserRepo) GetByName

func (r *UserRepo) GetByName(ctx context.Context, username string) (*db.User, error)

func (*UserRepo) GetOrCreateApiKey

func (r *UserRepo) GetOrCreateApiKey(ctx context.Context, userID string) (*db.ApiKey, error)

func (*UserRepo) GetPermissions

func (r *UserRepo) GetPermissions(ctx context.Context, id uuid.UUID) (*domain.Permissions, error)

func (*UserRepo) GetSetting

func (r *UserRepo) GetSetting(ctx context.Context) (*db.Setting, error)

func (*UserRepo) GetUserByApiKey

func (r *UserRepo) GetUserByApiKey(ctx context.Context, apiKey string) (*db.User, error)

GetUserByApiKey a new method to get user by api key

func (*UserRepo) GetUserCount

func (r *UserRepo) GetUserCount(ctx context.Context) (int64, error)

func (*UserRepo) GrantRole

func (r *UserRepo) GrantRole(ctx context.Context, req *domain.GrantRoleReq) error

func (*UserRepo) InitAdmin

func (r *UserRepo) InitAdmin(ctx context.Context, username, password string) error

func (*UserRepo) List

func (r *UserRepo) List(ctx context.Context, page *web.Pagination) ([]*db.User, *db.PageInfo, error)

func (*UserRepo) ListRole

func (r *UserRepo) ListRole(ctx context.Context) ([]*db.Role, error)

func (*UserRepo) OAuthLogin

func (r *UserRepo) OAuthLogin(ctx context.Context, platform consts.UserPlatform, req *domain.OAuthUserInfo) (*db.User, error)

func (*UserRepo) OAuthRegister

func (r *UserRepo) OAuthRegister(ctx context.Context, platform consts.UserPlatform, inviteCode string, req *domain.OAuthUserInfo) (*db.User, error)

func (*UserRepo) SaveAdminLoginHistory

func (r *UserRepo) SaveAdminLoginHistory(ctx context.Context, adminID string, ip string) error

func (*UserRepo) SaveUserLoginHistory

func (r *UserRepo) SaveUserLoginHistory(ctx context.Context, userID string, ip string, session *domain.VSCodeSession) error

func (*UserRepo) SignUpOrIn

func (r *UserRepo) SignUpOrIn(ctx context.Context, platform consts.UserPlatform, req *domain.OAuthUserInfo) (*db.User, error)

func (*UserRepo) Update

func (r *UserRepo) Update(ctx context.Context, id string, fn func(*db.Tx, *db.User, *db.UserUpdateOne) error) (*db.User, error)

func (*UserRepo) UpdateSetting

func (r *UserRepo) UpdateSetting(ctx context.Context, fn func(*db.Setting, *db.SettingUpdateOne)) (*db.Setting, error)

func (*UserRepo) UserLoginHistory

func (r *UserRepo) UserLoginHistory(ctx context.Context, page *web.Pagination) ([]*db.UserLoginHistory, *db.PageInfo, error)

func (*UserRepo) ValidateInviteCode

func (r *UserRepo) ValidateInviteCode(ctx context.Context, code string) (*db.InviteCode, error)

Jump to

Keyboard shortcuts

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