Documentation ¶
Index ¶
- Constants
- func IsToken(s string) bool
- type NewStoreOptions
- type Record
- func (v *Record) CreatedAt() string
- func (v *Record) DeletedAt() string
- func (v *Record) ID() string
- func (v *Record) SetCreatedAt(createdAt string) *Record
- func (v *Record) SetDeletedAt(deletedAt string) *Record
- func (v *Record) SetID(id string) *Record
- func (v *Record) SetToken(token string) *Record
- func (v *Record) SetUpdatedAt(updatedAt string) *Record
- func (v *Record) SetValue(value string) *Record
- func (v *Record) Token() string
- func (v *Record) UpdatedAt() string
- func (v *Record) Value() string
- type RecordQueryOptions
- type Store
- func (st *Store) AutoMigrate() error
- func (st *Store) EnableDebug(debug bool)
- func (store *Store) RecordCount(ctx context.Context, options RecordQueryOptions) (int64, error)
- func (store *Store) RecordCreate(ctx context.Context, record Record) error
- func (store *Store) RecordDeleteByID(ctx context.Context, recordID string) error
- func (store *Store) RecordDeleteByToken(ctx context.Context, token string) error
- func (st *Store) RecordFindByID(ctx context.Context, id string) (*Record, error)
- func (st *Store) RecordFindByToken(ctx context.Context, token string) (*Record, error)
- func (store *Store) RecordList(ctx context.Context, options RecordQueryOptions) ([]Record, error)
- func (store *Store) RecordUpdate(ctx context.Context, record Record) error
- func (store *Store) SqlCreateTable() string
- func (st *Store) TokenCreate(ctx context.Context, data string, password string, tokenLength int) (token string, err error)
- func (store *Store) TokenCreateCustom(ctx context.Context, token string, data string, password string) (err error)
- func (st *Store) TokenDelete(ctx context.Context, token string) error
- func (store *Store) TokenExists(ctx context.Context, token string) (bool, error)
- func (st *Store) TokenRead(ctx context.Context, token string, password string) (value string, err error)
- func (st *Store) TokenUpdate(ctx context.Context, token string, value string, password string) (err error)
- func (st *Store) TokensRead(ctx context.Context, tokens []string, password string) (values map[string]string, err error)
- type StoreInterface
Constants ¶
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_DELETED_AT = "deleted_at"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const COLUMN_VAULT_TOKEN = "vault_token"
View Source
const COLUMN_VAULT_VALUE = "vault_value"
View Source
const TOKEN_PREFIX = "tk_"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct { VaultTableName string DB *sql.DB DbDriverName string AutomigrateEnabled bool DebugEnabled bool }
NewStoreOptions define the options for creating a new session store
type Record ¶
type Record struct {
dataobject.DataObject
}
func (*Record) SetCreatedAt ¶
func (*Record) SetDeletedAt ¶
func (*Record) SetUpdatedAt ¶
type RecordQueryOptions ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store defines a session store
func NewStore ¶
func NewStore(opts NewStoreOptions) (*Store, error)
NewStore creates a new entity store
func (*Store) EnableDebug ¶
EnableDebug - enables the debug option
func (*Store) RecordCount ¶
func (*Store) RecordCreate ¶
func (*Store) RecordDeleteByID ¶
func (*Store) RecordDeleteByToken ¶
func (*Store) RecordFindByID ¶
FindByID finds an entry by ID
func (*Store) RecordFindByToken ¶
RecordFindByToken finds a store record by token
func (*Store) RecordList ¶
func (*Store) RecordUpdate ¶
func (*Store) SqlCreateTable ¶
SqlCreateTable returns a SQL string for creating the setting table
func (*Store) TokenCreate ¶
func (st *Store) TokenCreate(ctx context.Context, data string, password string, tokenLength int) (token string, err error)
TokenCreate creates a new record and returns the token
func (*Store) TokenCreateCustom ¶
func (*Store) TokenDelete ¶
TokenDelete deletes a token from the store
func (*Store) TokenExists ¶
func (*Store) TokenRead ¶
func (st *Store) TokenRead(ctx context.Context, token string, password string) (value string, err error)
ValueRetrieve retrieves a value of a vault entry
type StoreInterface ¶
type StoreInterface interface { RecordCreate(ctx context.Context, record Record) error RecordFindByID(ctx context.Context, recordID string) (*Record, error) RecordFindByToken(ctx context.Context, token string) (*Record, error) RecordList(ctx context.Context, options RecordQueryOptions) ([]Record, error) RecordUpdate(ctx context.Context, record Record) error RecordDeleteByID(ctx context.Context, recordID string) error TokenCreate(ctx context.Context, value string, password string, tokenLength int) (token string, err error) TokenCreateCustom(ctx context.Context, token string, value string, password string) (err error) TokenDelete(ctx context.Context, token string) error TokenRead(ctx context.Context, token string, password string) (string, error) //ValueFindByID(id string) (*SearchValue, error) //ValueList(options SearchValueQueryOptions) ([]SearchValue, error) // ValueSoftDelete(valueID string) error // ValueSoftDeleteByID(discountID string) error TokenUpdate(ctx context.Context, token string, value string, password string) error }
Source Files ¶
- Record.go
- Store.go
- consts.go
- encdec.go
- funcs.go
- generate_token.go
- isBase64.go
- is_token.go
- record_count.go
- record_create.go
- record_delete_by_id.go
- record_delete_by_token.go
- record_find_by_id.go
- record_find_by_token.go
- record_list.go
- record_update.go
- sqls.go
- store_interface.go
- store_new.go
- store_new_options.go
- token_create.go
- token_create_custom.go
- token_delete.go
- token_exists.go
- token_read.go
- token_update.go
- tokens_read.go
Click to show internal directories.
Click to hide internal directories.