Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorConstraint(err error) string
- func GroupCriteriaWhereClause(comp *Composer, c *GroupCriteria, id int) error
- func GroupPermissionsCriteriaWhereClause(comp *Composer, c *GroupPermissionsCriteria, id int) error
- func PermissionCriteriaWhereClause(comp *Composer, c *PermissionCriteria, id int) error
- func QueryFloat64WhereClause(i *qtypes.Float64, id int, sel string, com *Composer, opt *CompositionOpts) (err error)
- func QueryInt64WhereClause(i *qtypes.Int64, id int, sel string, com *Composer, opt *CompositionOpts) (err error)
- func QueryStringWhereClause(i *qtypes.String, id int, sel string, com *Composer, opt *CompositionOpts) (err error)
- func QueryTimestampWhereClause(i *qtypes.Timestamp, id int, sel string, com *Composer, opt *CompositionOpts) (err error)
- func UserCriteriaWhereClause(comp *Composer, c *UserCriteria, id int) error
- func UserGroupsCriteriaWhereClause(comp *Composer, c *UserGroupsCriteria, id int) error
- func UserPermissionsCriteriaWhereClause(comp *Composer, c *UserPermissionsCriteria, id int) error
- type Composer
- func (c *Composer) Add(arg interface{})
- func (c *Composer) Args() []interface{}
- func (c *Composer) Len() int
- func (c *Composer) Read(b []byte) (int, error)
- func (c *Composer) ResetBuf()
- func (c *Composer) String() string
- func (c *Composer) Write(b []byte) (int, error)
- func (c *Composer) WriteAlias(i int) error
- func (c *Composer) WritePlaceholder() error
- func (c *Composer) WriteString(s string) (int, error)
- type CompositionOpts
- type CompositionWriter
- type GroupCountExpr
- type GroupCriteria
- type GroupEntity
- type GroupFindExpr
- type GroupIterator
- type GroupJoin
- type GroupPatch
- type GroupPermissionsCountExpr
- type GroupPermissionsCriteria
- type GroupPermissionsEntity
- type GroupPermissionsFindExpr
- type GroupPermissionsIterator
- func (i *GroupPermissionsIterator) Close() error
- func (i *GroupPermissionsIterator) Columns() ([]string, error)
- func (i *GroupPermissionsIterator) Ent() (interface{}, error)
- func (i *GroupPermissionsIterator) Err() error
- func (i *GroupPermissionsIterator) GroupPermissions() (*GroupPermissionsEntity, error)
- func (i *GroupPermissionsIterator) Next() bool
- type GroupPermissionsJoin
- type GroupPermissionsPatch
- type GroupPermissionsProvider
- type GroupPermissionsRepository
- type GroupPermissionsRepositoryBase
- func (r *GroupPermissionsRepositoryBase) Count(ctx context.Context, c *GroupPermissionsCountExpr) (int64, error)
- func (r *GroupPermissionsRepositoryBase) Find(ctx context.Context, fe *GroupPermissionsFindExpr) ([]*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) FindIter(ctx context.Context, fe *GroupPermissionsFindExpr) (*GroupPermissionsIterator, error)
- func (r *GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, groupPermissionsGroupID int64, ...) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) FindQuery(fe *GroupPermissionsFindExpr) (string, []interface{}, error)
- func (r *GroupPermissionsRepositoryBase) Insert(ctx context.Context, e *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) InsertQuery(e *GroupPermissionsEntity, read bool) (string, []interface{}, error)
- func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, groupPermissionsGroupID int64, ...) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, ...) (string, []interface{}, error)
- func (r *GroupPermissionsRepositoryBase) Upsert(ctx context.Context, e *GroupPermissionsEntity, p *GroupPermissionsPatch, ...) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) UpsertQuery(e *GroupPermissionsEntity, p *GroupPermissionsPatch, inf ...string) (string, []interface{}, error)
- type GroupProvider
- type GroupRepository
- func (gr *GroupRepository) Create(ctx context.Context, createdBy int64, name string, description *ntypes.String) (ent *GroupEntity, err error)
- func (gr *GroupRepository) FindByUserID(ctx context.Context, userID int64) ([]*GroupEntity, error)
- func (gr *GroupRepository) IsGranted(ctx context.Context, id int64, p charon.Permission) (bool, error)
- func (gr *GroupRepository) SetPermissions(ctx context.Context, id int64, p ...charon.Permission) (int64, int64, error)
- func (gr *GroupRepository) UpdateOneByID(ctx context.Context, id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error)
- type GroupRepositoryBase
- func (r *GroupRepositoryBase) Count(ctx context.Context, c *GroupCountExpr) (int64, error)
- func (r *GroupRepositoryBase) DeleteOneByID(ctx context.Context, pk int64) (int64, error)
- func (r *GroupRepositoryBase) Find(ctx context.Context, fe *GroupFindExpr) ([]*GroupEntity, error)
- func (r *GroupRepositoryBase) FindIter(ctx context.Context, fe *GroupFindExpr) (*GroupIterator, error)
- func (r *GroupRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*GroupEntity, error)
- func (r *GroupRepositoryBase) FindOneByName(ctx context.Context, groupName string) (*GroupEntity, error)
- func (r *GroupRepositoryBase) FindQuery(fe *GroupFindExpr) (string, []interface{}, error)
- func (r *GroupRepositoryBase) Insert(ctx context.Context, e *GroupEntity) (*GroupEntity, error)
- func (r *GroupRepositoryBase) InsertQuery(e *GroupEntity, read bool) (string, []interface{}, error)
- func (r *GroupRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *GroupPatch) (*GroupEntity, error)
- func (r *GroupRepositoryBase) UpdateOneByIDQuery(pk int64, p *GroupPatch) (string, []interface{}, error)
- func (r *GroupRepositoryBase) UpdateOneByName(ctx context.Context, groupName string, p *GroupPatch) (*GroupEntity, error)
- func (r *GroupRepositoryBase) UpdateOneByNameQuery(groupName string, p *GroupPatch) (string, []interface{}, error)
- func (r *GroupRepositoryBase) Upsert(ctx context.Context, e *GroupEntity, p *GroupPatch, inf ...string) (*GroupEntity, error)
- func (r *GroupRepositoryBase) UpsertQuery(e *GroupEntity, p *GroupPatch, inf ...string) (string, []interface{}, error)
- type JSONArrayFloat64
- type JSONArrayInt64
- type JSONArrayString
- type JoinType
- type LogFunc
- type MockCompositionWriter
- type MockGroupPermissionsProvider
- type MockGroupProvider
- func (_m *MockGroupProvider) Create(ctx context.Context, createdBy int64, name string, description *ntypes.String) (*GroupEntity, error)
- func (_m *MockGroupProvider) DeleteOneByID(_a0 context.Context, _a1 int64) (int64, error)
- func (_m *MockGroupProvider) Find(_a0 context.Context, _a1 *GroupFindExpr) ([]*GroupEntity, error)
- func (_m *MockGroupProvider) FindByUserID(_a0 context.Context, _a1 int64) ([]*GroupEntity, error)
- func (_m *MockGroupProvider) FindOneByID(_a0 context.Context, _a1 int64) (*GroupEntity, error)
- func (_m *MockGroupProvider) Insert(_a0 context.Context, _a1 *GroupEntity) (*GroupEntity, error)
- func (_m *MockGroupProvider) IsGranted(_a0 context.Context, _a1 int64, _a2 charon.Permission) (bool, error)
- func (_m *MockGroupProvider) SetPermissions(_a0 context.Context, _a1 int64, _a2 ...charon.Permission) (int64, int64, error)
- func (_m *MockGroupProvider) UpdateOneByID(ctx context.Context, id int64, updatedBy int64, name *ntypes.String, ...) (*GroupEntity, error)
- type MockPermissionProvider
- func (_m *MockPermissionProvider) Find(ctx context.Context, criteria *PermissionFindExpr) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindByGroupID(ctx context.Context, groupID int64) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindByUserID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindOneByID(ctx context.Context, id int64) (*PermissionEntity, error)
- func (_m *MockPermissionProvider) Insert(ctx context.Context, entity *PermissionEntity) (*PermissionEntity, error)
- func (_m *MockPermissionProvider) Register(ctx context.Context, permissions charon.Permissions) (int64, int64, int64, error)
- type MockPermissionRegistry
- type MockRows
- type MockUserGroupsProvider
- func (_m *MockUserGroupsProvider) DeleteByUserID(ctx context.Context, id int64) (int64, error)
- func (_m *MockUserGroupsProvider) Exists(ctx context.Context, userID int64, groupID int64) (bool, error)
- func (_m *MockUserGroupsProvider) Find(ctx context.Context, expr *UserGroupsFindExpr) ([]*UserGroupsEntity, error)
- func (_m *MockUserGroupsProvider) Insert(ctx context.Context, ent *UserGroupsEntity) (*UserGroupsEntity, error)
- func (_m *MockUserGroupsProvider) Set(ctx context.Context, userID int64, groupIDs []int64) (int64, int64, error)
- type MockUserPermissionsProvider
- type MockUserProvider
- func (_m *MockUserProvider) ChangePassword(ctx context.Context, id int64, password string) error
- func (_m *MockUserProvider) Count(_a0 context.Context) (int64, error)
- func (_m *MockUserProvider) Create(ctx context.Context, username string, password []byte, FirstName string, ...) (*UserEntity, error)
- func (_m *MockUserProvider) CreateSuperuser(ctx context.Context, username string, password []byte, FirstName string, ...) (*UserEntity, error)
- func (_m *MockUserProvider) DeleteOneByID(_a0 context.Context, _a1 int64) (int64, error)
- func (_m *MockUserProvider) Exists(_a0 context.Context, _a1 int64) (bool, error)
- func (_m *MockUserProvider) Find(_a0 context.Context, _a1 *UserFindExpr) ([]*UserEntity, error)
- func (_m *MockUserProvider) FindOneByID(_a0 context.Context, _a1 int64) (*UserEntity, error)
- func (_m *MockUserProvider) FindOneByUsername(_a0 context.Context, _a1 string) (*UserEntity, error)
- func (_m *MockUserProvider) Insert(_a0 context.Context, _a1 *UserEntity) (*UserEntity, error)
- func (_m *MockUserProvider) IsGranted(ctx context.Context, id int64, permission charon.Permission) (bool, error)
- func (_m *MockUserProvider) RegistrationConfirmation(ctx context.Context, id int64, confirmationToken string) (int64, error)
- func (_m *MockUserProvider) SetPermissions(ctx context.Context, id int64, permissions ...charon.Permission) (int64, int64, error)
- func (_m *MockUserProvider) UpdateLastLoginAt(ctx context.Context, id int64) (int64, error)
- func (_m *MockUserProvider) UpdateOneByID(_a0 context.Context, _a1 int64, _a2 *UserPatch) (*UserEntity, error)
- type NullBoolArray
- type NullByteaArray
- type NullFloat64Array
- type NullInt64Array
- type NullStringArray
- type PermissionCountExpr
- type PermissionCriteria
- type PermissionEntity
- type PermissionFindExpr
- type PermissionIterator
- func (i *PermissionIterator) Close() error
- func (i *PermissionIterator) Columns() ([]string, error)
- func (i *PermissionIterator) Ent() (interface{}, error)
- func (i *PermissionIterator) Err() error
- func (i *PermissionIterator) Next() bool
- func (i *PermissionIterator) Permission() (*PermissionEntity, error)
- type PermissionJoin
- type PermissionPatch
- type PermissionProvider
- type PermissionReg
- type PermissionRegistry
- type PermissionRepository
- func (pr *PermissionRepository) FindBy(ctx context.Context, query string, args ...interface{}) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByGroupID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByTag(ctx context.Context, userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByUserID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) Register(ctx context.Context, permissions charon.Permissions) (created, unt, removed int64, err error)
- type PermissionRepositoryBase
- func (r *PermissionRepositoryBase) Count(ctx context.Context, c *PermissionCountExpr) (int64, error)
- func (r *PermissionRepositoryBase) DeleteOneByID(ctx context.Context, pk int64) (int64, error)
- func (r *PermissionRepositoryBase) Find(ctx context.Context, fe *PermissionFindExpr) ([]*PermissionEntity, error)
- func (r *PermissionRepositoryBase) FindIter(ctx context.Context, fe *PermissionFindExpr) (*PermissionIterator, error)
- func (r *PermissionRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction(ctx context.Context, permissionSubsystem string, permissionModule string, ...) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) FindQuery(fe *PermissionFindExpr) (string, []interface{}, error)
- func (r *PermissionRepositoryBase) Insert(ctx context.Context, e *PermissionEntity) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) InsertQuery(e *PermissionEntity, read bool) (string, []interface{}, error)
- func (r *PermissionRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *PermissionPatch) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) UpdateOneByIDQuery(pk int64, p *PermissionPatch) (string, []interface{}, error)
- func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction(ctx context.Context, permissionSubsystem string, permissionModule string, ...) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndActionQuery(permissionSubsystem string, permissionModule string, permissionAction string, ...) (string, []interface{}, error)
- func (r *PermissionRepositoryBase) Upsert(ctx context.Context, e *PermissionEntity, p *PermissionPatch, inf ...string) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) UpsertQuery(e *PermissionEntity, p *PermissionPatch, inf ...string) (string, []interface{}, error)
- type Rows
- type UserCountExpr
- type UserCriteria
- type UserEntity
- type UserFindExpr
- type UserGroupsCountExpr
- type UserGroupsCriteria
- type UserGroupsEntity
- type UserGroupsFindExpr
- type UserGroupsIterator
- func (i *UserGroupsIterator) Close() error
- func (i *UserGroupsIterator) Columns() ([]string, error)
- func (i *UserGroupsIterator) Ent() (interface{}, error)
- func (i *UserGroupsIterator) Err() error
- func (i *UserGroupsIterator) Next() bool
- func (i *UserGroupsIterator) UserGroups() (*UserGroupsEntity, error)
- type UserGroupsJoin
- type UserGroupsPatch
- type UserGroupsProvider
- type UserGroupsRepository
- func (ugr *UserGroupsRepository) DeleteByUserID(ctx context.Context, id int64) (int64, error)
- func (ugr *UserGroupsRepository) Exists(ctx context.Context, userID, groupID int64) (bool, error)
- func (ugr *UserGroupsRepository) Set(ctx context.Context, userID int64, groupIDs []int64) (int64, int64, error)
- type UserGroupsRepositoryBase
- func (r *UserGroupsRepositoryBase) Count(ctx context.Context, c *UserGroupsCountExpr) (int64, error)
- func (r *UserGroupsRepositoryBase) Find(ctx context.Context, fe *UserGroupsFindExpr) ([]*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) FindIter(ctx context.Context, fe *UserGroupsFindExpr) (*UserGroupsIterator, error)
- func (r *UserGroupsRepositoryBase) FindOneByUserIDAndGroupID(ctx context.Context, userGroupsUserID int64, userGroupsGroupID int64) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) FindQuery(fe *UserGroupsFindExpr) (string, []interface{}, error)
- func (r *UserGroupsRepositoryBase) Insert(ctx context.Context, e *UserGroupsEntity) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) InsertQuery(e *UserGroupsEntity, read bool) (string, []interface{}, error)
- func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID(ctx context.Context, userGroupsUserID int64, userGroupsGroupID int64, ...) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupIDQuery(userGroupsUserID int64, userGroupsGroupID int64, p *UserGroupsPatch) (string, []interface{}, error)
- func (r *UserGroupsRepositoryBase) Upsert(ctx context.Context, e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) UpsertQuery(e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (string, []interface{}, error)
- type UserIterator
- type UserJoin
- type UserPatch
- type UserPermissionsCountExpr
- type UserPermissionsCriteria
- type UserPermissionsEntity
- type UserPermissionsFindExpr
- type UserPermissionsIterator
- func (i *UserPermissionsIterator) Close() error
- func (i *UserPermissionsIterator) Columns() ([]string, error)
- func (i *UserPermissionsIterator) Ent() (interface{}, error)
- func (i *UserPermissionsIterator) Err() error
- func (i *UserPermissionsIterator) Next() bool
- func (i *UserPermissionsIterator) UserPermissions() (*UserPermissionsEntity, error)
- type UserPermissionsJoin
- type UserPermissionsPatch
- type UserPermissionsProvider
- type UserPermissionsRepository
- type UserPermissionsRepositoryBase
- func (r *UserPermissionsRepositoryBase) Count(ctx context.Context, c *UserPermissionsCountExpr) (int64, error)
- func (r *UserPermissionsRepositoryBase) Find(ctx context.Context, fe *UserPermissionsFindExpr) ([]*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) FindIter(ctx context.Context, fe *UserPermissionsFindExpr) (*UserPermissionsIterator, error)
- func (r *UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, userPermissionsUserID int64, ...) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) FindQuery(fe *UserPermissionsFindExpr) (string, []interface{}, error)
- func (r *UserPermissionsRepositoryBase) Insert(ctx context.Context, e *UserPermissionsEntity) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) InsertQuery(e *UserPermissionsEntity, read bool) (string, []interface{}, error)
- func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, userPermissionsUserID int64, ...) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, ...) (string, []interface{}, error)
- func (r *UserPermissionsRepositoryBase) Upsert(ctx context.Context, e *UserPermissionsEntity, p *UserPermissionsPatch, ...) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) UpsertQuery(e *UserPermissionsEntity, p *UserPermissionsPatch, inf ...string) (string, []interface{}, error)
- type UserProvider
- type UserRepository
- func (ur *UserRepository) ChangePassword(ctx context.Context, userID int64, password string) error
- func (ur *UserRepository) Count(ctx context.Context) (n int64, err error)
- func (ur *UserRepository) Create(ctx context.Context, username string, password []byte, ...) (*UserEntity, error)
- func (ur *UserRepository) CreateSuperuser(ctx context.Context, username string, password []byte, ...) (*UserEntity, error)
- func (ur *UserRepository) Exists(ctx context.Context, userID int64) (bool, error)
- func (ur *UserRepository) FindOneBy(ctx context.Context, fieldName string, value interface{}) (*UserEntity, error)
- func (ur *UserRepository) FindOneByUsername(ctx context.Context, username string) (*UserEntity, error)
- func (ur *UserRepository) IsGranted(ctx context.Context, id int64, p charon.Permission) (bool, error)
- func (ur *UserRepository) RegistrationConfirmation(ctx context.Context, userID int64, confirmationToken string) (int64, error)
- func (ur *UserRepository) SetPermissions(ctx context.Context, id int64, p ...charon.Permission) (int64, int64, error)
- func (ur *UserRepository) UpdateLastLoginAt(ctx context.Context, userID int64) (int64, error)
- type UserRepositoryBase
- func (r *UserRepositoryBase) Count(ctx context.Context, c *UserCountExpr) (int64, error)
- func (r *UserRepositoryBase) DeleteOneByID(ctx context.Context, pk int64) (int64, error)
- func (r *UserRepositoryBase) Find(ctx context.Context, fe *UserFindExpr) ([]*UserEntity, error)
- func (r *UserRepositoryBase) FindIter(ctx context.Context, fe *UserFindExpr) (*UserIterator, error)
- func (r *UserRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*UserEntity, error)
- func (r *UserRepositoryBase) FindOneByUsername(ctx context.Context, userUsername string) (*UserEntity, error)
- func (r *UserRepositoryBase) FindQuery(fe *UserFindExpr) (string, []interface{}, error)
- func (r *UserRepositoryBase) Insert(ctx context.Context, e *UserEntity) (*UserEntity, error)
- func (r *UserRepositoryBase) InsertQuery(e *UserEntity, read bool) (string, []interface{}, error)
- func (r *UserRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *UserPatch) (*UserEntity, error)
- func (r *UserRepositoryBase) UpdateOneByIDQuery(pk int64, p *UserPatch) (string, []interface{}, error)
- func (r *UserRepositoryBase) UpdateOneByUsername(ctx context.Context, userUsername string, p *UserPatch) (*UserEntity, error)
- func (r *UserRepositoryBase) UpdateOneByUsernameQuery(userUsername string, p *UserPatch) (string, []interface{}, error)
- func (r *UserRepositoryBase) Upsert(ctx context.Context, e *UserEntity, p *UserPatch, inf ...string) (*UserEntity, error)
- func (r *UserRepositoryBase) UpsertQuery(e *UserEntity, p *UserPatch, inf ...string) (string, []interface{}, error)
Constants ¶
const ( TableUser = "charon.user" TableUserColumnConfirmationToken = "confirmation_token" TableUserColumnCreatedAt = "created_at" TableUserColumnCreatedBy = "created_by" TableUserColumnFirstName = "first_name" TableUserColumnID = "id" TableUserColumnIsActive = "is_active" TableUserColumnIsConfirmed = "is_confirmed" TableUserColumnIsStaff = "is_staff" TableUserColumnIsSuperuser = "is_superuser" TableUserColumnLastLoginAt = "last_login_at" TableUserColumnLastName = "last_name" TableUserColumnPassword = "password" TableUserColumnUpdatedAt = "updated_at" TableUserColumnUpdatedBy = "updated_by" TableUserColumnUsername = "username" TableUserConstraintUsernameUnique = "charon.user_username_key" TableUserConstraintPrimaryKey = "charon.user_id_pkey" TableUserConstraintCreatedByForeignKey = "charon.user_created_by_fkey" TableUserConstraintUpdatedByForeignKey = "charon.user_updated_by_fkey" )
const ( TableGroup = "charon.group" TableGroupColumnCreatedAt = "created_at" TableGroupColumnCreatedBy = "created_by" TableGroupColumnDescription = "description" TableGroupColumnID = "id" TableGroupColumnName = "name" TableGroupColumnUpdatedAt = "updated_at" TableGroupColumnUpdatedBy = "updated_by" TableGroupConstraintNameUnique = "charon.group_name_key" TableGroupConstraintPrimaryKey = "charon.group_id_pkey" TableGroupConstraintCreatedByForeignKey = "charon.group_created_by_fkey" TableGroupConstraintUpdatedByForeignKey = "charon.group_updated_by_fkey" )
const ( TablePermission = "charon.permission" TablePermissionColumnAction = "action" TablePermissionColumnCreatedAt = "created_at" TablePermissionColumnID = "id" TablePermissionColumnModule = "module" TablePermissionColumnSubsystem = "subsystem" TablePermissionColumnUpdatedAt = "updated_at" TablePermissionConstraintSubsystemModuleActionUnique = "charon.permission_subsystem_module_action_key" TablePermissionConstraintPrimaryKey = "charon.permission_id_pkey" )
const ( TableUserGroups = "charon.user_groups" TableUserGroupsColumnCreatedAt = "created_at" TableUserGroupsColumnCreatedBy = "created_by" TableUserGroupsColumnGroupID = "group_id" TableUserGroupsColumnUpdatedAt = "updated_at" TableUserGroupsColumnUpdatedBy = "updated_by" TableUserGroupsColumnUserID = "user_id" TableUserGroupsConstraintUserIDForeignKey = "charon.user_groups_user_id_fkey" TableUserGroupsConstraintGroupIDForeignKey = "charon.user_groups_group_id_fkey" TableUserGroupsConstraintUserIDGroupIDUnique = "charon.user_groups_user_id_group_id_key" TableUserGroupsConstraintCreatedByForeignKey = "charon.user_groups_created_by_fkey" TableUserGroupsConstraintUpdatedByForeignKey = "charon.user_groups_updated_by_fkey" )
const ( TableGroupPermissions = "charon.group_permissions" TableGroupPermissionsColumnCreatedAt = "created_at" TableGroupPermissionsColumnCreatedBy = "created_by" TableGroupPermissionsColumnGroupID = "group_id" TableGroupPermissionsColumnPermissionAction = "permission_action" TableGroupPermissionsColumnPermissionModule = "permission_module" TableGroupPermissionsColumnPermissionSubsystem = "permission_subsystem" TableGroupPermissionsColumnUpdatedAt = "updated_at" TableGroupPermissionsColumnUpdatedBy = "updated_by" TableGroupPermissionsConstraintGroupIDForeignKey = "charon.group_permissions_group_id_fkey" TableGroupPermissionsConstraintPermissionSubsystemPermissionModulePermissionActionForeignKey = "charon.group_permissions_subsystem_module_action_fkey" TableGroupPermissionsConstraintGroupIDPermissionSubsystemPermissionModulePermissionActionUnique = "charon.group_permissions_group_id_subsystem_module_action_key" TableGroupPermissionsConstraintCreatedByForeignKey = "charon.group_permissions_created_by_fkey" TableGroupPermissionsConstraintUpdatedByForeignKey = "charon.group_permissions_updated_by_fkey" )
const ( TableUserPermissions = "charon.user_permissions" TableUserPermissionsColumnCreatedAt = "created_at" TableUserPermissionsColumnCreatedBy = "created_by" TableUserPermissionsColumnPermissionAction = "permission_action" TableUserPermissionsColumnPermissionModule = "permission_module" TableUserPermissionsColumnPermissionSubsystem = "permission_subsystem" TableUserPermissionsColumnUpdatedAt = "updated_at" TableUserPermissionsColumnUpdatedBy = "updated_by" TableUserPermissionsColumnUserID = "user_id" TableUserPermissionsConstraintUserIDForeignKey = "charon.user_permissions_user_id_fkey" TableUserPermissionsConstraintPermissionSubsystemPermissionModulePermissionActionForeignKey = "charon.user_permissions_subsystem_module_action_fkey" TableUserPermissionsConstraintUserIDPermissionSubsystemPermissionModulePermissionActionUnique = "charon.user_permissions_user_id_subsystem_module_action_key" TableUserPermissionsConstraintCreatedByForeignKey = "charon.user_permissions_created_by_fkey" TableUserPermissionsConstraintUpdatedByForeignKey = "charon.user_permissions_updated_by_fkey" )
const ( JoinDoNot = iota JoinInner JoinLeft JoinRight JoinCross )
const SQL = `` /* 4404-byte string literal not displayed */
const (
// UserConfirmationTokenUsed ...
UserConfirmationTokenUsed = "!"
)
Variables ¶
var ( // Space is a shorthand composition option that holds space. Space = &CompositionOpts{ Joint: " ", } // And is a shorthand composition option that holds AND operator. And = &CompositionOpts{ Joint: " AND ", } // Or is a shorthand composition option that holds OR operator. Or = &CompositionOpts{ Joint: " OR ", } // Comma is a shorthand composition option that holds comma. Comma = &CompositionOpts{ Joint: ", ", } )
var ( // ExternalPassword is a password that is set when external source of authentication is provided (e.g. LDAP). ExternalPassword = []byte("!") )
var ( TableGroupColumns = []string{ TableGroupColumnCreatedAt, TableGroupColumnCreatedBy, TableGroupColumnDescription, TableGroupColumnID, TableGroupColumnName, TableGroupColumnUpdatedAt, TableGroupColumnUpdatedBy, } )
var ( TableGroupPermissionsColumns = []string{ TableGroupPermissionsColumnCreatedAt, TableGroupPermissionsColumnCreatedBy, TableGroupPermissionsColumnGroupID, TableGroupPermissionsColumnPermissionAction, TableGroupPermissionsColumnPermissionModule, TableGroupPermissionsColumnPermissionSubsystem, TableGroupPermissionsColumnUpdatedAt, TableGroupPermissionsColumnUpdatedBy, } )
var ( TablePermissionColumns = []string{ TablePermissionColumnAction, TablePermissionColumnCreatedAt, TablePermissionColumnID, TablePermissionColumnModule, TablePermissionColumnSubsystem, TablePermissionColumnUpdatedAt, } )
var ( TableUserColumns = []string{ TableUserColumnConfirmationToken, TableUserColumnCreatedAt, TableUserColumnCreatedBy, TableUserColumnFirstName, TableUserColumnID, TableUserColumnIsActive, TableUserColumnIsConfirmed, TableUserColumnIsStaff, TableUserColumnIsSuperuser, TableUserColumnLastLoginAt, TableUserColumnLastName, TableUserColumnPassword, TableUserColumnUpdatedAt, TableUserColumnUpdatedBy, TableUserColumnUsername, } )
var ( TableUserGroupsColumns = []string{ TableUserGroupsColumnCreatedAt, TableUserGroupsColumnCreatedBy, TableUserGroupsColumnGroupID, TableUserGroupsColumnUpdatedAt, TableUserGroupsColumnUpdatedBy, TableUserGroupsColumnUserID, } )
var ( TableUserPermissionsColumns = []string{ TableUserPermissionsColumnCreatedAt, TableUserPermissionsColumnCreatedBy, TableUserPermissionsColumnPermissionAction, TableUserPermissionsColumnPermissionModule, TableUserPermissionsColumnPermissionSubsystem, TableUserPermissionsColumnUpdatedAt, TableUserPermissionsColumnUpdatedBy, TableUserPermissionsColumnUserID, } )
Functions ¶
func ErrorConstraint ¶ added in v0.9.0
ErrorConstraint returns the error constraint of err if it was produced by the pq library. Otherwise, it returns empty string.
func GroupCriteriaWhereClause ¶ added in v0.9.7
func GroupCriteriaWhereClause(comp *Composer, c *GroupCriteria, id int) error
func GroupPermissionsCriteriaWhereClause ¶ added in v0.9.7
func GroupPermissionsCriteriaWhereClause(comp *Composer, c *GroupPermissionsCriteria, id int) error
func PermissionCriteriaWhereClause ¶ added in v0.9.7
func PermissionCriteriaWhereClause(comp *Composer, c *PermissionCriteria, id int) error
func QueryFloat64WhereClause ¶ added in v0.9.0
func QueryInt64WhereClause ¶ added in v0.9.0
func QueryStringWhereClause ¶ added in v0.9.0
func QueryTimestampWhereClause ¶ added in v0.9.0
func UserCriteriaWhereClause ¶ added in v0.9.7
func UserCriteriaWhereClause(comp *Composer, c *UserCriteria, id int) error
func UserGroupsCriteriaWhereClause ¶ added in v0.9.7
func UserGroupsCriteriaWhereClause(comp *Composer, c *UserGroupsCriteria, id int) error
func UserPermissionsCriteriaWhereClause ¶ added in v0.9.7
func UserPermissionsCriteriaWhereClause(comp *Composer, c *UserPermissionsCriteria, id int) error
Types ¶
type Composer ¶ added in v0.9.0
type Composer struct { Dirty bool // contains filtered or unexported fields }
Composer holds buffer, arguments and placeholders count. In combination with external buffet can be also used to also generate sub-queries. To do that simply write buffer to the parent buffer, composer will hold all arguments and remember number of last placeholder.
func NewComposer ¶ added in v0.9.0
NewComposer allocates new Composer with inner slice of arguments of given size.
func (*Composer) Add ¶ added in v0.9.0
func (c *Composer) Add(arg interface{})
Add appends list with new element.
func (*Composer) Args ¶ added in v0.9.0
func (c *Composer) Args() []interface{}
Args returns all arguments stored as a slice.
func (*Composer) ResetBuf ¶ added in v0.9.0
func (c *Composer) ResetBuf()
ResetBuf resets internal buffer.
func (*Composer) WriteAlias ¶ added in v0.9.7
func (*Composer) WritePlaceholder ¶ added in v0.9.0
WritePlaceholder writes appropriate placeholder to the query buffer based on current state of the composer.
func (*Composer) WriteString ¶ added in v0.9.0
WriteString appends the contents of s to the query buffer, growing the buffer as needed. The return value n is the length of s; err is always nil. If the buffer becomes too large, WriteString will panic with bytes ErrTooLarge.
type CompositionOpts ¶ added in v0.9.0
type CompositionOpts struct { Joint string PlaceholderFuncs, SelectorFuncs []string PlaceholderCast, SelectorCast string IsJSON bool IsDynamic bool }
CompositionOpts is a container for modification that can be applied.
type CompositionWriter ¶ added in v0.9.0
type CompositionWriter interface { // WriteComposition is a function that allow custom struct type to be used as a part of criteria. // It gives possibility to write custom query based on object that implements this interface. WriteComposition(string, *Composer, *CompositionOpts) error }
CompositionWriter is a simple wrapper for WriteComposition function.
type GroupCountExpr ¶ added in v0.9.7
type GroupCountExpr struct { Where *GroupCriteria JoinAuthor *UserJoin JoinModifier *UserJoin }
type GroupCriteria ¶
type GroupEntity ¶
type GroupEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy ntypes.Int64 // Description ... Description ntypes.String // ID ... ID int64 // Name ... Name string // UpdatedAt ... UpdatedAt pq.NullTime // UpdatedBy ... UpdatedBy ntypes.Int64 // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity // Permissions ... Permissions []*PermissionEntity // Users ... Users []*UserEntity }
GroupEntity ...
func ScanGroupRows ¶
func ScanGroupRows(rows Rows) (entities []*GroupEntity, err error)
func (*GroupEntity) Message ¶
func (ge *GroupEntity) Message() (*charonrpc.Group, error)
Message maps entity into protobuf message.
func (*GroupEntity) Prop ¶
func (e *GroupEntity) Prop(cn string) (interface{}, bool)
func (*GroupEntity) Props ¶
func (e *GroupEntity) Props(cns ...string) ([]interface{}, error)
type GroupFindExpr ¶ added in v0.9.7
type GroupIterator ¶
type GroupIterator struct {
// contains filtered or unexported fields
}
GroupIterator is not thread safe.
func (*GroupIterator) Close ¶
func (i *GroupIterator) Close() error
func (*GroupIterator) Columns ¶
func (i *GroupIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*GroupIterator) Ent ¶
func (i *GroupIterator) Ent() (interface{}, error)
Ent is wrapper around Group method that makes iterator more generic.
func (*GroupIterator) Err ¶
func (i *GroupIterator) Err() error
func (*GroupIterator) Group ¶
func (i *GroupIterator) Group() (*GroupEntity, error)
func (*GroupIterator) Next ¶
func (i *GroupIterator) Next() bool
type GroupJoin ¶ added in v0.9.7
type GroupJoin struct {
On, Where *GroupCriteria
Fetch bool
Kind JoinType
JoinAuthor *UserJoin
JoinModifier *UserJoin
}
type GroupPatch ¶
type GroupPermissionsCountExpr ¶ added in v0.9.7
type GroupPermissionsCountExpr struct { Where *GroupPermissionsCriteria JoinGroup *GroupJoin JoinAuthor *UserJoin JoinModifier *UserJoin }
type GroupPermissionsEntity ¶
type GroupPermissionsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy ntypes.Int64 // GroupID ... GroupID int64 // PermissionAction ... PermissionAction string // PermissionModule ... PermissionModule string // PermissionSubsystem ... PermissionSubsystem string // UpdatedAt ... UpdatedAt pq.NullTime // UpdatedBy ... UpdatedBy ntypes.Int64 // Group ... Group *GroupEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
GroupPermissionsEntity ...
func ScanGroupPermissionsRows ¶
func ScanGroupPermissionsRows(rows Rows) (entities []*GroupPermissionsEntity, err error)
func (*GroupPermissionsEntity) Prop ¶
func (e *GroupPermissionsEntity) Prop(cn string) (interface{}, bool)
func (*GroupPermissionsEntity) Props ¶
func (e *GroupPermissionsEntity) Props(cns ...string) ([]interface{}, error)
type GroupPermissionsFindExpr ¶ added in v0.9.7
type GroupPermissionsIterator ¶
type GroupPermissionsIterator struct {
// contains filtered or unexported fields
}
GroupPermissionsIterator is not thread safe.
func (*GroupPermissionsIterator) Close ¶
func (i *GroupPermissionsIterator) Close() error
func (*GroupPermissionsIterator) Columns ¶
func (i *GroupPermissionsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*GroupPermissionsIterator) Ent ¶
func (i *GroupPermissionsIterator) Ent() (interface{}, error)
Ent is wrapper around GroupPermissions method that makes iterator more generic.
func (*GroupPermissionsIterator) Err ¶
func (i *GroupPermissionsIterator) Err() error
func (*GroupPermissionsIterator) GroupPermissions ¶
func (i *GroupPermissionsIterator) GroupPermissions() (*GroupPermissionsEntity, error)
func (*GroupPermissionsIterator) Next ¶
func (i *GroupPermissionsIterator) Next() bool
type GroupPermissionsJoin ¶ added in v0.9.7
type GroupPermissionsPatch ¶
type GroupPermissionsProvider ¶
type GroupPermissionsProvider interface {
Insert(context.Context, *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
}
GroupPermissionsProvider ...
func NewGroupPermissionsRepository ¶
func NewGroupPermissionsRepository(dbPool *sql.DB) GroupPermissionsProvider
NewGroupPermissionsRepository ...
type GroupPermissionsRepository ¶
type GroupPermissionsRepository struct {
GroupPermissionsRepositoryBase
}
GroupPermissionsRepository extends GroupPermissionsRepositoryBase
type GroupPermissionsRepositoryBase ¶
func (*GroupPermissionsRepositoryBase) Count ¶
func (r *GroupPermissionsRepositoryBase) Count(ctx context.Context, c *GroupPermissionsCountExpr) (int64, error)
func (*GroupPermissionsRepositoryBase) Find ¶
func (r *GroupPermissionsRepositoryBase) Find(ctx context.Context, fe *GroupPermissionsFindExpr) ([]*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) FindIter ¶
func (r *GroupPermissionsRepositoryBase) FindIter(ctx context.Context, fe *GroupPermissionsFindExpr) (*GroupPermissionsIterator, error)
func (*GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, groupPermissionsPermissionModule string, groupPermissionsPermissionAction string) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *GroupPermissionsRepositoryBase) FindQuery(fe *GroupPermissionsFindExpr) (string, []interface{}, error)
func (*GroupPermissionsRepositoryBase) Insert ¶
func (r *GroupPermissionsRepositoryBase) Insert(ctx context.Context, e *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *GroupPermissionsRepositoryBase) InsertQuery(e *GroupPermissionsEntity, read bool) (string, []interface{}, error)
func (*GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, groupPermissionsPermissionModule string, groupPermissionsPermissionAction string, p *GroupPermissionsPatch) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery ¶ added in v0.9.0
func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, groupPermissionsPermissionModule string, groupPermissionsPermissionAction string, p *GroupPermissionsPatch) (string, []interface{}, error)
func (*GroupPermissionsRepositoryBase) Upsert ¶
func (r *GroupPermissionsRepositoryBase) Upsert(ctx context.Context, e *GroupPermissionsEntity, p *GroupPermissionsPatch, inf ...string) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *GroupPermissionsRepositoryBase) UpsertQuery(e *GroupPermissionsEntity, p *GroupPermissionsPatch, inf ...string) (string, []interface{}, error)
type GroupProvider ¶
type GroupProvider interface { Insert(context.Context, *GroupEntity) (*GroupEntity, error) // FindByUserID retrieves all groups for user represented by given id. FindByUserID(context.Context, int64) ([]*GroupEntity, error) // FindOneByID retrieves group for given id. FindOneByID(context.Context, int64) (*GroupEntity, error) // find ... Find(context.Context, *GroupFindExpr) ([]*GroupEntity, error) // Create ... Create(ctx context.Context, createdBy int64, name string, description *ntypes.String) (*GroupEntity, error) // updateOneByID ... UpdateOneByID(ctx context.Context, id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error) // DeleteByID ... DeleteOneByID(context.Context, int64) (int64, error) // IsGranted ... IsGranted(context.Context, int64, charon.Permission) (bool, error) // SetPermissions ... SetPermissions(context.Context, int64, ...charon.Permission) (int64, int64, error) }
GroupProvider ...
func NewGroupRepository ¶
func NewGroupRepository(dbPool *sql.DB) GroupProvider
NewGroupRepository ...
type GroupRepository ¶
type GroupRepository struct {
GroupRepositoryBase
}
GroupRepository extends GroupRepositoryBase
func (*GroupRepository) Create ¶
func (gr *GroupRepository) Create(ctx context.Context, createdBy int64, name string, description *ntypes.String) (ent *GroupEntity, err error)
Create ...
func (*GroupRepository) FindByUserID ¶
func (gr *GroupRepository) FindByUserID(ctx context.Context, userID int64) ([]*GroupEntity, error)
FindByUserID implements GroupProvider interface.
func (*GroupRepository) IsGranted ¶
func (gr *GroupRepository) IsGranted(ctx context.Context, id int64, p charon.Permission) (bool, error)
IsGranted ...
func (*GroupRepository) SetPermissions ¶
func (gr *GroupRepository) SetPermissions(ctx context.Context, id int64, p ...charon.Permission) (int64, int64, error)
SetPermissions ...
func (*GroupRepository) UpdateOneByID ¶
func (gr *GroupRepository) UpdateOneByID(ctx context.Context, id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error)
UpdateOneByID ...
type GroupRepositoryBase ¶
func (*GroupRepositoryBase) Count ¶
func (r *GroupRepositoryBase) Count(ctx context.Context, c *GroupCountExpr) (int64, error)
func (*GroupRepositoryBase) DeleteOneByID ¶
func (*GroupRepositoryBase) Find ¶
func (r *GroupRepositoryBase) Find(ctx context.Context, fe *GroupFindExpr) ([]*GroupEntity, error)
func (*GroupRepositoryBase) FindIter ¶
func (r *GroupRepositoryBase) FindIter(ctx context.Context, fe *GroupFindExpr) (*GroupIterator, error)
func (*GroupRepositoryBase) FindOneByID ¶
func (r *GroupRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*GroupEntity, error)
func (*GroupRepositoryBase) FindOneByName ¶
func (r *GroupRepositoryBase) FindOneByName(ctx context.Context, groupName string) (*GroupEntity, error)
func (*GroupRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *GroupRepositoryBase) FindQuery(fe *GroupFindExpr) (string, []interface{}, error)
func (*GroupRepositoryBase) Insert ¶
func (r *GroupRepositoryBase) Insert(ctx context.Context, e *GroupEntity) (*GroupEntity, error)
func (*GroupRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *GroupRepositoryBase) InsertQuery(e *GroupEntity, read bool) (string, []interface{}, error)
func (*GroupRepositoryBase) UpdateOneByID ¶
func (r *GroupRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *GroupPatch) (*GroupEntity, error)
func (*GroupRepositoryBase) UpdateOneByIDQuery ¶ added in v0.9.0
func (r *GroupRepositoryBase) UpdateOneByIDQuery(pk int64, p *GroupPatch) (string, []interface{}, error)
func (*GroupRepositoryBase) UpdateOneByName ¶
func (r *GroupRepositoryBase) UpdateOneByName(ctx context.Context, groupName string, p *GroupPatch) (*GroupEntity, error)
func (*GroupRepositoryBase) UpdateOneByNameQuery ¶ added in v0.9.0
func (r *GroupRepositoryBase) UpdateOneByNameQuery(groupName string, p *GroupPatch) (string, []interface{}, error)
func (*GroupRepositoryBase) Upsert ¶
func (r *GroupRepositoryBase) Upsert(ctx context.Context, e *GroupEntity, p *GroupPatch, inf ...string) (*GroupEntity, error)
func (*GroupRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *GroupRepositoryBase) UpsertQuery(e *GroupEntity, p *GroupPatch, inf ...string) (string, []interface{}, error)
type JSONArrayFloat64 ¶ added in v0.9.0
type JSONArrayFloat64 []float64
JSONArrayFloat64 is a slice of int64s that implements necessary interfaces.
func (*JSONArrayFloat64) Scan ¶ added in v0.9.0
func (a *JSONArrayFloat64) Scan(src interface{}) error
Scan satisfy sql.Scanner interface.
type JSONArrayInt64 ¶ added in v0.9.0
type JSONArrayInt64 []int64
JSONArrayInt64 is a slice of int64s that implements necessary interfaces.
func (*JSONArrayInt64) Scan ¶ added in v0.9.0
func (a *JSONArrayInt64) Scan(src interface{}) error
Scan satisfy sql.Scanner interface.
type JSONArrayString ¶ added in v0.9.0
type JSONArrayString []string
JSONArrayString is a slice of strings that implements necessary interfaces.
func (*JSONArrayString) Scan ¶ added in v0.9.0
func (a *JSONArrayString) Scan(src interface{}) error
Scan satisfy sql.Scanner interface.
type LogFunc ¶ added in v0.10.0
LogFunc represents function that can be passed into repository to log query result.
type MockCompositionWriter ¶ added in v0.9.0
func (*MockCompositionWriter) WriteComposition ¶ added in v0.9.0
func (_m *MockCompositionWriter) WriteComposition(_a0 string, _a1 *Composer, _a2 *CompositionOpts) error
WriteComposition provides a mock function with given fields: _a0, _a1, _a2
type MockGroupPermissionsProvider ¶
func (*MockGroupPermissionsProvider) Insert ¶
func (_m *MockGroupPermissionsProvider) Insert(_a0 context.Context, _a1 *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
Insert provides a mock function with given fields: _a0, _a1
type MockGroupProvider ¶
func (*MockGroupProvider) Create ¶
func (_m *MockGroupProvider) Create(ctx context.Context, createdBy int64, name string, description *ntypes.String) (*GroupEntity, error)
Create provides a mock function with given fields: ctx, createdBy, name, description
func (*MockGroupProvider) DeleteOneByID ¶
DeleteOneByID provides a mock function with given fields: _a0, _a1
func (*MockGroupProvider) Find ¶
func (_m *MockGroupProvider) Find(_a0 context.Context, _a1 *GroupFindExpr) ([]*GroupEntity, error)
Find provides a mock function with given fields: _a0, _a1
func (*MockGroupProvider) FindByUserID ¶
func (_m *MockGroupProvider) FindByUserID(_a0 context.Context, _a1 int64) ([]*GroupEntity, error)
FindByUserID provides a mock function with given fields: _a0, _a1
func (*MockGroupProvider) FindOneByID ¶
func (_m *MockGroupProvider) FindOneByID(_a0 context.Context, _a1 int64) (*GroupEntity, error)
FindOneByID provides a mock function with given fields: _a0, _a1
func (*MockGroupProvider) Insert ¶
func (_m *MockGroupProvider) Insert(_a0 context.Context, _a1 *GroupEntity) (*GroupEntity, error)
Insert provides a mock function with given fields: _a0, _a1
func (*MockGroupProvider) IsGranted ¶
func (_m *MockGroupProvider) IsGranted(_a0 context.Context, _a1 int64, _a2 charon.Permission) (bool, error)
IsGranted provides a mock function with given fields: _a0, _a1, _a2
func (*MockGroupProvider) SetPermissions ¶
func (_m *MockGroupProvider) SetPermissions(_a0 context.Context, _a1 int64, _a2 ...charon.Permission) (int64, int64, error)
SetPermissions provides a mock function with given fields: _a0, _a1, _a2
func (*MockGroupProvider) UpdateOneByID ¶
func (_m *MockGroupProvider) UpdateOneByID(ctx context.Context, id int64, updatedBy int64, name *ntypes.String, description *ntypes.String) (*GroupEntity, error)
UpdateOneByID provides a mock function with given fields: ctx, id, updatedBy, name, description
type MockPermissionProvider ¶
func (*MockPermissionProvider) Find ¶
func (_m *MockPermissionProvider) Find(ctx context.Context, criteria *PermissionFindExpr) ([]*PermissionEntity, error)
Find provides a mock function with given fields: ctx, criteria
func (*MockPermissionProvider) FindByGroupID ¶
func (_m *MockPermissionProvider) FindByGroupID(ctx context.Context, groupID int64) ([]*PermissionEntity, error)
FindByGroupID provides a mock function with given fields: ctx, groupID
func (*MockPermissionProvider) FindByUserID ¶
func (_m *MockPermissionProvider) FindByUserID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
FindByUserID provides a mock function with given fields: ctx, userID
func (*MockPermissionProvider) FindOneByID ¶
func (_m *MockPermissionProvider) FindOneByID(ctx context.Context, id int64) (*PermissionEntity, error)
FindOneByID provides a mock function with given fields: ctx, id
func (*MockPermissionProvider) Insert ¶
func (_m *MockPermissionProvider) Insert(ctx context.Context, entity *PermissionEntity) (*PermissionEntity, error)
Insert provides a mock function with given fields: ctx, entity
type MockPermissionRegistry ¶
func (*MockPermissionRegistry) Exists ¶
func (_m *MockPermissionRegistry) Exists(ctx context.Context, permission charon.Permission) bool
Exists provides a mock function with given fields: ctx, permission
type MockRows ¶ added in v0.10.0
func (*MockRows) ColumnTypes ¶ added in v0.10.0
func (_m *MockRows) ColumnTypes() ([]*sql.ColumnType, error)
ColumnTypes provides a mock function with given fields:
func (*MockRows) NextResultSet ¶ added in v0.10.0
NextResultSet provides a mock function with given fields:
type MockUserGroupsProvider ¶
func (*MockUserGroupsProvider) DeleteByUserID ¶ added in v0.8.4
DeleteByUserID provides a mock function with given fields: ctx, id
func (*MockUserGroupsProvider) Exists ¶
func (_m *MockUserGroupsProvider) Exists(ctx context.Context, userID int64, groupID int64) (bool, error)
Exists provides a mock function with given fields: ctx, userID, groupID
func (*MockUserGroupsProvider) Find ¶
func (_m *MockUserGroupsProvider) Find(ctx context.Context, expr *UserGroupsFindExpr) ([]*UserGroupsEntity, error)
Find provides a mock function with given fields: ctx, expr
func (*MockUserGroupsProvider) Insert ¶
func (_m *MockUserGroupsProvider) Insert(ctx context.Context, ent *UserGroupsEntity) (*UserGroupsEntity, error)
Insert provides a mock function with given fields: ctx, ent
type MockUserPermissionsProvider ¶
func (*MockUserPermissionsProvider) DeleteByUserID ¶ added in v0.8.4
func (_m *MockUserPermissionsProvider) DeleteByUserID(_a0 context.Context, _a1 int64) (int64, error)
DeleteByUserID provides a mock function with given fields: _a0, _a1
func (*MockUserPermissionsProvider) Insert ¶
func (_m *MockUserPermissionsProvider) Insert(_a0 context.Context, _a1 *UserPermissionsEntity) (*UserPermissionsEntity, error)
Insert provides a mock function with given fields: _a0, _a1
type MockUserProvider ¶
func (*MockUserProvider) ChangePassword ¶
ChangePassword provides a mock function with given fields: ctx, id, password
func (*MockUserProvider) Count ¶
func (_m *MockUserProvider) Count(_a0 context.Context) (int64, error)
Count provides a mock function with given fields: _a0
func (*MockUserProvider) Create ¶
func (_m *MockUserProvider) Create(ctx context.Context, username string, password []byte, FirstName string, LastName string, confirmationToken []byte, isSuperuser bool, IsStaff bool, isActive bool, isConfirmed bool) (*UserEntity, error)
Create provides a mock function with given fields: ctx, username, password, FirstName, LastName, confirmationToken, isSuperuser, IsStaff, isActive, isConfirmed
func (*MockUserProvider) CreateSuperuser ¶
func (_m *MockUserProvider) CreateSuperuser(ctx context.Context, username string, password []byte, FirstName string, LastName string) (*UserEntity, error)
CreateSuperuser provides a mock function with given fields: ctx, username, password, FirstName, LastName
func (*MockUserProvider) DeleteOneByID ¶
DeleteOneByID provides a mock function with given fields: _a0, _a1
func (*MockUserProvider) Find ¶
func (_m *MockUserProvider) Find(_a0 context.Context, _a1 *UserFindExpr) ([]*UserEntity, error)
Find provides a mock function with given fields: _a0, _a1
func (*MockUserProvider) FindOneByID ¶
func (_m *MockUserProvider) FindOneByID(_a0 context.Context, _a1 int64) (*UserEntity, error)
FindOneByID provides a mock function with given fields: _a0, _a1
func (*MockUserProvider) FindOneByUsername ¶
func (_m *MockUserProvider) FindOneByUsername(_a0 context.Context, _a1 string) (*UserEntity, error)
FindOneByUsername provides a mock function with given fields: _a0, _a1
func (*MockUserProvider) Insert ¶
func (_m *MockUserProvider) Insert(_a0 context.Context, _a1 *UserEntity) (*UserEntity, error)
Insert provides a mock function with given fields: _a0, _a1
func (*MockUserProvider) IsGranted ¶
func (_m *MockUserProvider) IsGranted(ctx context.Context, id int64, permission charon.Permission) (bool, error)
IsGranted provides a mock function with given fields: ctx, id, permission
func (*MockUserProvider) RegistrationConfirmation ¶
func (_m *MockUserProvider) RegistrationConfirmation(ctx context.Context, id int64, confirmationToken string) (int64, error)
RegistrationConfirmation provides a mock function with given fields: ctx, id, confirmationToken
func (*MockUserProvider) SetPermissions ¶
func (_m *MockUserProvider) SetPermissions(ctx context.Context, id int64, permissions ...charon.Permission) (int64, int64, error)
SetPermissions provides a mock function with given fields: ctx, id, permissions
func (*MockUserProvider) UpdateLastLoginAt ¶
UpdateLastLoginAt provides a mock function with given fields: ctx, id
func (*MockUserProvider) UpdateOneByID ¶
func (_m *MockUserProvider) UpdateOneByID(_a0 context.Context, _a1 int64, _a2 *UserPatch) (*UserEntity, error)
UpdateOneByID provides a mock function with given fields: _a0, _a1, _a2
type NullBoolArray ¶ added in v0.9.0
func (*NullBoolArray) Scan ¶ added in v0.9.0
func (n *NullBoolArray) Scan(value interface{}) error
type NullByteaArray ¶ added in v0.9.0
type NullByteaArray struct { pq.ByteaArray Valid bool }
func (*NullByteaArray) Scan ¶ added in v0.9.0
func (n *NullByteaArray) Scan(value interface{}) error
type NullFloat64Array ¶ added in v0.9.0
type NullFloat64Array struct { pq.Float64Array Valid bool }
func (*NullFloat64Array) Scan ¶ added in v0.9.0
func (n *NullFloat64Array) Scan(value interface{}) error
type NullInt64Array ¶ added in v0.9.0
type NullInt64Array struct { pq.Int64Array Valid bool }
func (*NullInt64Array) Scan ¶ added in v0.9.0
func (n *NullInt64Array) Scan(value interface{}) error
type NullStringArray ¶ added in v0.9.0
type NullStringArray struct { pq.StringArray Valid bool }
func (*NullStringArray) Scan ¶ added in v0.9.0
func (n *NullStringArray) Scan(value interface{}) error
type PermissionCountExpr ¶ added in v0.9.7
type PermissionCountExpr struct {
Where *PermissionCriteria
}
type PermissionCriteria ¶
type PermissionEntity ¶
type PermissionEntity struct { // Action ... Action string // CreatedAt ... CreatedAt time.Time // ID ... ID int64 // Module ... Module string // Subsystem ... Subsystem string // UpdatedAt ... UpdatedAt pq.NullTime // Users ... Users []*UserEntity // Groups ... Groups []*GroupEntity }
PermissionEntity ...
func ScanPermissionRows ¶
func ScanPermissionRows(rows Rows) (entities []*PermissionEntity, err error)
func (*PermissionEntity) Permission ¶
func (pe *PermissionEntity) Permission() charon.Permission
Permission returns charon.Permission value that is concatenated using entity properties like subsystem, module and action.
func (*PermissionEntity) Prop ¶
func (e *PermissionEntity) Prop(cn string) (interface{}, bool)
func (*PermissionEntity) Props ¶
func (e *PermissionEntity) Props(cns ...string) ([]interface{}, error)
type PermissionFindExpr ¶ added in v0.9.7
type PermissionFindExpr struct { Where *PermissionCriteria Offset, Limit int64 Columns []string OrderBy map[string]bool }
type PermissionIterator ¶
type PermissionIterator struct {
// contains filtered or unexported fields
}
PermissionIterator is not thread safe.
func (*PermissionIterator) Close ¶
func (i *PermissionIterator) Close() error
func (*PermissionIterator) Columns ¶
func (i *PermissionIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*PermissionIterator) Ent ¶
func (i *PermissionIterator) Ent() (interface{}, error)
Ent is wrapper around Permission method that makes iterator more generic.
func (*PermissionIterator) Err ¶
func (i *PermissionIterator) Err() error
func (*PermissionIterator) Next ¶
func (i *PermissionIterator) Next() bool
func (*PermissionIterator) Permission ¶
func (i *PermissionIterator) Permission() (*PermissionEntity, error)
type PermissionJoin ¶ added in v0.9.7
type PermissionJoin struct {
On, Where *PermissionCriteria
Fetch bool
Kind JoinType
}
type PermissionPatch ¶
type PermissionProvider ¶
type PermissionProvider interface { Find(ctx context.Context, criteria *PermissionFindExpr) ([]*PermissionEntity, error) FindOneByID(ctx context.Context, id int64) (entity *PermissionEntity, err error) // FindByUserID retrieves all permissions for user represented by given id. FindByUserID(ctx context.Context, userID int64) (entities []*PermissionEntity, err error) // FindByGroupID retrieves all permissions for group represented by given id. FindByGroupID(ctx context.Context, groupID int64) (entities []*PermissionEntity, err error) Register(ctx context.Context, permissions charon.Permissions) (created, untouched, removed int64, err error) Insert(ctx context.Context, entity *PermissionEntity) (*PermissionEntity, error) }
PermissionProvider ...
type PermissionReg ¶
PermissionReg ...
func NewPermissionRegistry ¶
func NewPermissionRegistry(r PermissionProvider) *PermissionReg
NewPermissionRegistry ...
func (*PermissionReg) Exists ¶
func (pr *PermissionReg) Exists(_ context.Context, permission charon.Permission) (ok bool)
Exists ...
func (*PermissionReg) Register ¶
func (pr *PermissionReg) Register(ctx context.Context, permissions charon.Permissions) (created, untouched, removed int64, err error)
Register ...
type PermissionRegistry ¶
type PermissionRegistry interface { // Exists returns true if given charon.Permission was already registered. Exists(ctx context.Context, permission charon.Permission) (exists bool) // Register checks if given collection is valid and // calls PermissionProvider to store provided permissions // in persistent way. Register(ctx context.Context, permissions charon.Permissions) (created, untouched, removed int64, err error) }
PermissionRegistry is an interface that describes in memory storage that holds information about permissions that was registered by 3rd party services. Should be only used as a proxy for registration process to avoid multiple sql hits.
type PermissionRepository ¶
type PermissionRepository struct { PermissionRepositoryBase // contains filtered or unexported fields }
PermissionRepository extends PermissionRepositoryBase
func NewPermissionRepository ¶
func NewPermissionRepository(dbPool *sql.DB) *PermissionRepository
NewPermissionRepository ...
func (*PermissionRepository) FindBy ¶
func (pr *PermissionRepository) FindBy(ctx context.Context, query string, args ...interface{}) ([]*PermissionEntity, error)
FindBy ...
func (*PermissionRepository) FindByGroupID ¶
func (pr *PermissionRepository) FindByGroupID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
FindByGroupID implements PermissionProvider interface.
func (*PermissionRepository) FindByTag ¶
func (pr *PermissionRepository) FindByTag(ctx context.Context, userID int64) ([]*PermissionEntity, error)
FindByTag ...
func (*PermissionRepository) FindByUserID ¶
func (pr *PermissionRepository) FindByUserID(ctx context.Context, userID int64) ([]*PermissionEntity, error)
FindByUserID implements PermissionProvider interface.
func (*PermissionRepository) Register ¶
func (pr *PermissionRepository) Register(ctx context.Context, permissions charon.Permissions) (created, unt, removed int64, err error)
Register ...
type PermissionRepositoryBase ¶
func (*PermissionRepositoryBase) Count ¶
func (r *PermissionRepositoryBase) Count(ctx context.Context, c *PermissionCountExpr) (int64, error)
func (*PermissionRepositoryBase) DeleteOneByID ¶
func (*PermissionRepositoryBase) Find ¶
func (r *PermissionRepositoryBase) Find(ctx context.Context, fe *PermissionFindExpr) ([]*PermissionEntity, error)
func (*PermissionRepositoryBase) FindIter ¶
func (r *PermissionRepositoryBase) FindIter(ctx context.Context, fe *PermissionFindExpr) (*PermissionIterator, error)
func (*PermissionRepositoryBase) FindOneByID ¶
func (r *PermissionRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*PermissionEntity, error)
func (*PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction ¶
func (r *PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction(ctx context.Context, permissionSubsystem string, permissionModule string, permissionAction string) (*PermissionEntity, error)
func (*PermissionRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *PermissionRepositoryBase) FindQuery(fe *PermissionFindExpr) (string, []interface{}, error)
func (*PermissionRepositoryBase) Insert ¶
func (r *PermissionRepositoryBase) Insert(ctx context.Context, e *PermissionEntity) (*PermissionEntity, error)
func (*PermissionRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *PermissionRepositoryBase) InsertQuery(e *PermissionEntity, read bool) (string, []interface{}, error)
func (*PermissionRepositoryBase) UpdateOneByID ¶
func (r *PermissionRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *PermissionPatch) (*PermissionEntity, error)
func (*PermissionRepositoryBase) UpdateOneByIDQuery ¶ added in v0.9.0
func (r *PermissionRepositoryBase) UpdateOneByIDQuery(pk int64, p *PermissionPatch) (string, []interface{}, error)
func (*PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction ¶
func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction(ctx context.Context, permissionSubsystem string, permissionModule string, permissionAction string, p *PermissionPatch) (*PermissionEntity, error)
func (*PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndActionQuery ¶ added in v0.9.0
func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndActionQuery(permissionSubsystem string, permissionModule string, permissionAction string, p *PermissionPatch) (string, []interface{}, error)
func (*PermissionRepositoryBase) Upsert ¶
func (r *PermissionRepositoryBase) Upsert(ctx context.Context, e *PermissionEntity, p *PermissionPatch, inf ...string) (*PermissionEntity, error)
func (*PermissionRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *PermissionRepositoryBase) UpsertQuery(e *PermissionEntity, p *PermissionPatch, inf ...string) (string, []interface{}, error)
type Rows ¶ added in v0.10.0
type Rows interface { io.Closer ColumnTypes() ([]*sql.ColumnType, error) Columns() ([]string, error) Err() error Next() bool NextResultSet() bool Scan(dest ...interface{}) error }
Rows ...
type UserCountExpr ¶ added in v0.9.7
type UserCountExpr struct { Where *UserCriteria JoinAuthor *UserJoin JoinModifier *UserJoin }
type UserCriteria ¶
type UserCriteria struct { ConfirmationToken []byte CreatedAt *qtypes.Timestamp CreatedBy *qtypes.Int64 FirstName *qtypes.String ID *qtypes.Int64 IsActive ntypes.Bool IsConfirmed ntypes.Bool IsStaff ntypes.Bool IsSuperuser ntypes.Bool LastLoginAt *qtypes.Timestamp LastName *qtypes.String Password []byte UpdatedAt *qtypes.Timestamp UpdatedBy *qtypes.Int64 Username *qtypes.String }
type UserEntity ¶
type UserEntity struct { // ConfirmationToken ... ConfirmationToken []byte // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy ntypes.Int64 // FirstName ... FirstName string // ID ... ID int64 // IsActive ... IsActive bool // IsConfirmed ... IsConfirmed bool // IsStaff ... IsStaff bool // IsSuperuser ... IsSuperuser bool // LastLoginAt ... LastLoginAt pq.NullTime // LastName ... LastName string // Password ... Password []byte // UpdatedAt ... UpdatedAt pq.NullTime // UpdatedBy ... UpdatedBy ntypes.Int64 // Username ... Username string // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity // Permissions ... Permissions []*PermissionEntity // Groups ... Groups []*GroupEntity }
UserEntity ...
func ScanUserRows ¶
func ScanUserRows(rows Rows) (entities []*UserEntity, err error)
func (*UserEntity) Message ¶
func (ue *UserEntity) Message() (*charonrpc.User, error)
Message maps entity into protobuf message.
func (*UserEntity) Prop ¶
func (e *UserEntity) Prop(cn string) (interface{}, bool)
func (*UserEntity) Props ¶
func (e *UserEntity) Props(cns ...string) ([]interface{}, error)
func (*UserEntity) String ¶
func (ue *UserEntity) String() string
String return concatenated first and last name of the user. Implements fmt Stringer interface.
type UserFindExpr ¶ added in v0.9.7
type UserGroupsCountExpr ¶ added in v0.9.7
type UserGroupsCountExpr struct { Where *UserGroupsCriteria JoinUser *UserJoin JoinGroup *GroupJoin JoinAuthor *UserJoin JoinModifier *UserJoin }
type UserGroupsCriteria ¶
type UserGroupsEntity ¶
type UserGroupsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy ntypes.Int64 // GroupID ... GroupID int64 // UpdatedAt ... UpdatedAt pq.NullTime // UpdatedBy ... UpdatedBy ntypes.Int64 // UserID ... UserID int64 // User ... User *UserEntity // Group ... Group *GroupEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
UserGroupsEntity ...
func ScanUserGroupsRows ¶
func ScanUserGroupsRows(rows Rows) (entities []*UserGroupsEntity, err error)
func (*UserGroupsEntity) Prop ¶
func (e *UserGroupsEntity) Prop(cn string) (interface{}, bool)
func (*UserGroupsEntity) Props ¶
func (e *UserGroupsEntity) Props(cns ...string) ([]interface{}, error)
type UserGroupsFindExpr ¶ added in v0.9.7
type UserGroupsIterator ¶
type UserGroupsIterator struct {
// contains filtered or unexported fields
}
UserGroupsIterator is not thread safe.
func (*UserGroupsIterator) Close ¶
func (i *UserGroupsIterator) Close() error
func (*UserGroupsIterator) Columns ¶
func (i *UserGroupsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*UserGroupsIterator) Ent ¶
func (i *UserGroupsIterator) Ent() (interface{}, error)
Ent is wrapper around UserGroups method that makes iterator more generic.
func (*UserGroupsIterator) Err ¶
func (i *UserGroupsIterator) Err() error
func (*UserGroupsIterator) Next ¶
func (i *UserGroupsIterator) Next() bool
func (*UserGroupsIterator) UserGroups ¶
func (i *UserGroupsIterator) UserGroups() (*UserGroupsEntity, error)
type UserGroupsJoin ¶ added in v0.9.7
type UserGroupsPatch ¶
type UserGroupsProvider ¶
type UserGroupsProvider interface { Insert(ctx context.Context, ent *UserGroupsEntity) (*UserGroupsEntity, error) Exists(ctx context.Context, userID, groupID int64) (bool, error) Find(ctx context.Context, expr *UserGroupsFindExpr) ([]*UserGroupsEntity, error) Set(ctx context.Context, userID int64, groupIDs []int64) (int64, int64, error) DeleteByUserID(ctx context.Context, id int64) (int64, error) }
UserGroupsProvider ...
func NewUserGroupsRepository ¶
func NewUserGroupsRepository(dbPool *sql.DB) UserGroupsProvider
NewUserGroupsRepository ...
type UserGroupsRepository ¶
type UserGroupsRepository struct { UserGroupsRepositoryBase // contains filtered or unexported fields }
UserGroupsRepository ...
func (*UserGroupsRepository) DeleteByUserID ¶ added in v0.8.4
DeleteByUserID removes user from all groups he belongs to.
type UserGroupsRepositoryBase ¶
func (*UserGroupsRepositoryBase) Count ¶
func (r *UserGroupsRepositoryBase) Count(ctx context.Context, c *UserGroupsCountExpr) (int64, error)
func (*UserGroupsRepositoryBase) Find ¶
func (r *UserGroupsRepositoryBase) Find(ctx context.Context, fe *UserGroupsFindExpr) ([]*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) FindIter ¶
func (r *UserGroupsRepositoryBase) FindIter(ctx context.Context, fe *UserGroupsFindExpr) (*UserGroupsIterator, error)
func (*UserGroupsRepositoryBase) FindOneByUserIDAndGroupID ¶
func (r *UserGroupsRepositoryBase) FindOneByUserIDAndGroupID(ctx context.Context, userGroupsUserID int64, userGroupsGroupID int64) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *UserGroupsRepositoryBase) FindQuery(fe *UserGroupsFindExpr) (string, []interface{}, error)
func (*UserGroupsRepositoryBase) Insert ¶
func (r *UserGroupsRepositoryBase) Insert(ctx context.Context, e *UserGroupsEntity) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *UserGroupsRepositoryBase) InsertQuery(e *UserGroupsEntity, read bool) (string, []interface{}, error)
func (*UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID ¶
func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID(ctx context.Context, userGroupsUserID int64, userGroupsGroupID int64, p *UserGroupsPatch) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupIDQuery ¶ added in v0.9.0
func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupIDQuery(userGroupsUserID int64, userGroupsGroupID int64, p *UserGroupsPatch) (string, []interface{}, error)
func (*UserGroupsRepositoryBase) Upsert ¶
func (r *UserGroupsRepositoryBase) Upsert(ctx context.Context, e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *UserGroupsRepositoryBase) UpsertQuery(e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (string, []interface{}, error)
type UserIterator ¶
type UserIterator struct {
// contains filtered or unexported fields
}
UserIterator is not thread safe.
func (*UserIterator) Close ¶
func (i *UserIterator) Close() error
func (*UserIterator) Columns ¶
func (i *UserIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*UserIterator) Ent ¶
func (i *UserIterator) Ent() (interface{}, error)
Ent is wrapper around User method that makes iterator more generic.
func (*UserIterator) Err ¶
func (i *UserIterator) Err() error
func (*UserIterator) Next ¶
func (i *UserIterator) Next() bool
func (*UserIterator) User ¶
func (i *UserIterator) User() (*UserEntity, error)
type UserJoin ¶ added in v0.9.7
type UserJoin struct {
On, Where *UserCriteria
Fetch bool
Kind JoinType
JoinAuthor *UserJoin
JoinModifier *UserJoin
}
type UserPatch ¶
type UserPatch struct { ConfirmationToken []byte CreatedAt pq.NullTime CreatedBy ntypes.Int64 FirstName ntypes.String IsActive ntypes.Bool IsConfirmed ntypes.Bool IsStaff ntypes.Bool IsSuperuser ntypes.Bool LastLoginAt pq.NullTime LastName ntypes.String Password []byte UpdatedAt pq.NullTime UpdatedBy ntypes.Int64 Username ntypes.String }
type UserPermissionsCountExpr ¶ added in v0.9.7
type UserPermissionsCountExpr struct { Where *UserPermissionsCriteria JoinUser *UserJoin JoinAuthor *UserJoin JoinModifier *UserJoin }
type UserPermissionsCriteria ¶
type UserPermissionsEntity ¶
type UserPermissionsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy ntypes.Int64 // PermissionAction ... PermissionAction string // PermissionModule ... PermissionModule string // PermissionSubsystem ... PermissionSubsystem string // UpdatedAt ... UpdatedAt pq.NullTime // UpdatedBy ... UpdatedBy ntypes.Int64 // UserID ... UserID int64 // User ... User *UserEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
UserPermissionsEntity ...
func ScanUserPermissionsRows ¶
func ScanUserPermissionsRows(rows Rows) (entities []*UserPermissionsEntity, err error)
func (*UserPermissionsEntity) Prop ¶
func (e *UserPermissionsEntity) Prop(cn string) (interface{}, bool)
func (*UserPermissionsEntity) Props ¶
func (e *UserPermissionsEntity) Props(cns ...string) ([]interface{}, error)
type UserPermissionsFindExpr ¶ added in v0.9.7
type UserPermissionsIterator ¶
type UserPermissionsIterator struct {
// contains filtered or unexported fields
}
UserPermissionsIterator is not thread safe.
func (*UserPermissionsIterator) Close ¶
func (i *UserPermissionsIterator) Close() error
func (*UserPermissionsIterator) Columns ¶
func (i *UserPermissionsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache output inside iterator.
func (*UserPermissionsIterator) Ent ¶
func (i *UserPermissionsIterator) Ent() (interface{}, error)
Ent is wrapper around UserPermissions method that makes iterator more generic.
func (*UserPermissionsIterator) Err ¶
func (i *UserPermissionsIterator) Err() error
func (*UserPermissionsIterator) Next ¶
func (i *UserPermissionsIterator) Next() bool
func (*UserPermissionsIterator) UserPermissions ¶
func (i *UserPermissionsIterator) UserPermissions() (*UserPermissionsEntity, error)
type UserPermissionsJoin ¶ added in v0.9.7
type UserPermissionsPatch ¶
type UserPermissionsProvider ¶
type UserPermissionsProvider interface { Insert(context.Context, *UserPermissionsEntity) (*UserPermissionsEntity, error) DeleteByUserID(context.Context, int64) (int64, error) }
UserPermissionsProvider ...
func NewUserPermissionsRepository ¶
func NewUserPermissionsRepository(dbPool *sql.DB) UserPermissionsProvider
NewUserPermissionsRepository ...
type UserPermissionsRepository ¶
type UserPermissionsRepository struct { UserPermissionsRepositoryBase // contains filtered or unexported fields }
UserPermissionsRepository extends UserPermissionsRepositoryBase
func (*UserPermissionsRepository) DeleteByUserID ¶ added in v0.8.4
DeleteByUserID removes all permissions of given user.
type UserPermissionsRepositoryBase ¶
func (*UserPermissionsRepositoryBase) Count ¶
func (r *UserPermissionsRepositoryBase) Count(ctx context.Context, c *UserPermissionsCountExpr) (int64, error)
func (*UserPermissionsRepositoryBase) Find ¶
func (r *UserPermissionsRepositoryBase) Find(ctx context.Context, fe *UserPermissionsFindExpr) ([]*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) FindIter ¶
func (r *UserPermissionsRepositoryBase) FindIter(ctx context.Context, fe *UserPermissionsFindExpr) (*UserPermissionsIterator, error)
func (*UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, userPermissionsUserID int64, userPermissionsPermissionSubsystem string, userPermissionsPermissionModule string, userPermissionsPermissionAction string) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *UserPermissionsRepositoryBase) FindQuery(fe *UserPermissionsFindExpr) (string, []interface{}, error)
func (*UserPermissionsRepositoryBase) Insert ¶
func (r *UserPermissionsRepositoryBase) Insert(ctx context.Context, e *UserPermissionsEntity) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *UserPermissionsRepositoryBase) InsertQuery(e *UserPermissionsEntity, read bool) (string, []interface{}, error)
func (*UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(ctx context.Context, userPermissionsUserID int64, userPermissionsPermissionSubsystem string, userPermissionsPermissionModule string, userPermissionsPermissionAction string, p *UserPermissionsPatch) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery ¶ added in v0.9.0
func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionActionQuery(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, userPermissionsPermissionModule string, userPermissionsPermissionAction string, p *UserPermissionsPatch) (string, []interface{}, error)
func (*UserPermissionsRepositoryBase) Upsert ¶
func (r *UserPermissionsRepositoryBase) Upsert(ctx context.Context, e *UserPermissionsEntity, p *UserPermissionsPatch, inf ...string) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *UserPermissionsRepositoryBase) UpsertQuery(e *UserPermissionsEntity, p *UserPermissionsPatch, inf ...string) (string, []interface{}, error)
type UserProvider ¶
type UserProvider interface { Exists(context.Context, int64) (bool, error) Create(ctx context.Context, username string, password []byte, FirstName, LastName string, confirmationToken []byte, isSuperuser, IsStaff, isActive, isConfirmed bool) (*UserEntity, error) Insert(context.Context, *UserEntity) (*UserEntity, error) CreateSuperuser(ctx context.Context, username string, password []byte, FirstName, LastName string) (*UserEntity, error) // Count retrieves number of all users. Count(context.Context) (int64, error) UpdateLastLoginAt(ctx context.Context, id int64) (int64, error) ChangePassword(ctx context.Context, id int64, password string) error Find(context.Context, *UserFindExpr) ([]*UserEntity, error) FindOneByID(context.Context, int64) (*UserEntity, error) FindOneByUsername(context.Context, string) (*UserEntity, error) DeleteOneByID(context.Context, int64) (int64, error) UpdateOneByID(context.Context, int64, *UserPatch) (*UserEntity, error) RegistrationConfirmation(ctx context.Context, id int64, confirmationToken string) (int64, error) IsGranted(ctx context.Context, id int64, permission charon.Permission) (bool, error) SetPermissions(ctx context.Context, id int64, permissions ...charon.Permission) (int64, int64, error) }
UserProvider wraps UserRepository into interface.
type UserRepository ¶
type UserRepository struct {
UserRepositoryBase
}
UserRepository extends UserRepositoryBase.
func NewUserRepository ¶
func NewUserRepository(dbPool *sql.DB) *UserRepository
NewUserRepository alocates new UserRepository instance
func (*UserRepository) ChangePassword ¶
ChangePassword ...
func (*UserRepository) Count ¶
func (ur *UserRepository) Count(ctx context.Context) (n int64, err error)
Count implements UserProvider interface.
func (*UserRepository) Create ¶
func (ur *UserRepository) Create(ctx context.Context, username string, password []byte, firstName, lastName string, confirmationToken []byte, isSuperuser, isStaff, isActive, isConfirmed bool) (*UserEntity, error)
Create implements UserProvider interface.
func (*UserRepository) CreateSuperuser ¶
func (ur *UserRepository) CreateSuperuser(ctx context.Context, username string, password []byte, firstName, lastName string) (*UserEntity, error)
CreateSuperuser implements UserProvider interface.
func (*UserRepository) FindOneBy ¶
func (ur *UserRepository) FindOneBy(ctx context.Context, fieldName string, value interface{}) (*UserEntity, error)
FindOneBy ...
func (*UserRepository) FindOneByUsername ¶
func (ur *UserRepository) FindOneByUsername(ctx context.Context, username string) (*UserEntity, error)
FindOneByUsername ...
func (*UserRepository) IsGranted ¶
func (ur *UserRepository) IsGranted(ctx context.Context, id int64, p charon.Permission) (bool, error)
IsGranted implements UserProvider interface.
func (*UserRepository) RegistrationConfirmation ¶
func (ur *UserRepository) RegistrationConfirmation(ctx context.Context, userID int64, confirmationToken string) (int64, error)
RegistrationConfirmation ...
func (*UserRepository) SetPermissions ¶
func (ur *UserRepository) SetPermissions(ctx context.Context, id int64, p ...charon.Permission) (int64, int64, error)
SetPermissions implements UserProvider interface.
func (*UserRepository) UpdateLastLoginAt ¶
UpdateLastLoginAt implements UserProvider interface.
type UserRepositoryBase ¶
func (*UserRepositoryBase) Count ¶
func (r *UserRepositoryBase) Count(ctx context.Context, c *UserCountExpr) (int64, error)
func (*UserRepositoryBase) DeleteOneByID ¶
func (*UserRepositoryBase) Find ¶
func (r *UserRepositoryBase) Find(ctx context.Context, fe *UserFindExpr) ([]*UserEntity, error)
func (*UserRepositoryBase) FindIter ¶
func (r *UserRepositoryBase) FindIter(ctx context.Context, fe *UserFindExpr) (*UserIterator, error)
func (*UserRepositoryBase) FindOneByID ¶
func (r *UserRepositoryBase) FindOneByID(ctx context.Context, pk int64) (*UserEntity, error)
func (*UserRepositoryBase) FindOneByUsername ¶
func (r *UserRepositoryBase) FindOneByUsername(ctx context.Context, userUsername string) (*UserEntity, error)
func (*UserRepositoryBase) FindQuery ¶ added in v0.9.0
func (r *UserRepositoryBase) FindQuery(fe *UserFindExpr) (string, []interface{}, error)
func (*UserRepositoryBase) Insert ¶
func (r *UserRepositoryBase) Insert(ctx context.Context, e *UserEntity) (*UserEntity, error)
func (*UserRepositoryBase) InsertQuery ¶ added in v0.9.0
func (r *UserRepositoryBase) InsertQuery(e *UserEntity, read bool) (string, []interface{}, error)
func (*UserRepositoryBase) UpdateOneByID ¶
func (r *UserRepositoryBase) UpdateOneByID(ctx context.Context, pk int64, p *UserPatch) (*UserEntity, error)
func (*UserRepositoryBase) UpdateOneByIDQuery ¶ added in v0.9.0
func (r *UserRepositoryBase) UpdateOneByIDQuery(pk int64, p *UserPatch) (string, []interface{}, error)
func (*UserRepositoryBase) UpdateOneByUsername ¶
func (r *UserRepositoryBase) UpdateOneByUsername(ctx context.Context, userUsername string, p *UserPatch) (*UserEntity, error)
func (*UserRepositoryBase) UpdateOneByUsernameQuery ¶ added in v0.9.0
func (r *UserRepositoryBase) UpdateOneByUsernameQuery(userUsername string, p *UserPatch) (string, []interface{}, error)
func (*UserRepositoryBase) Upsert ¶
func (r *UserRepositoryBase) Upsert(ctx context.Context, e *UserEntity, p *UserPatch, inf ...string) (*UserEntity, error)
func (*UserRepositoryBase) UpsertQuery ¶ added in v0.9.0
func (r *UserRepositoryBase) UpsertQuery(e *UserEntity, p *UserPatch, inf ...string) (string, []interface{}, error)