Documentation
¶
Index ¶
- func ArgsToOrderBy(orderByArgs []string, disallowedFields map[string]string) (orderBy []string, err *errors.ServiceError)
- func FieldNameWalk(n tsl.Node, disallowedFields map[string]string) (newNode tsl.Node, err *errors.ServiceError)
- func GetTableName(g2 *gorm.DB) string
- func MarkForRollback(ctx context.Context, err error)
- func Migrate(g2 *gorm.DB) error
- func MigrateTo(sessionFactory SessionFactory, migrationID string)
- func NewContext(ctx context.Context, connection SessionFactory) (context.Context, error)
- func Resolve(ctx context.Context)
- func TransactionMiddleware(next http.Handler, connection SessionFactory) http.Handler
- type SessionFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgsToOrderBy ¶
func ArgsToOrderBy( orderByArgs []string, disallowedFields map[string]string) (orderBy []string, err *errors.ServiceError)
ArgsToOrderBy returns cleaned orderBy list.
func FieldNameWalk ¶
func FieldNameWalk( n tsl.Node, disallowedFields map[string]string) (newNode tsl.Node, err *errors.ServiceError)
FieldNameWalk walks on the filter tree and check/replace the search fields names: a. the the field name is valid. b. replace the field name with the SQL column name.
func GetTableName ¶
func MarkForRollback ¶
MarkForRollback flags the transaction stored in the context for rollback and logs whatever error caused the rollback
func MigrateTo ¶
func MigrateTo(sessionFactory SessionFactory, migrationID string)
MigrateTo a specific migration will not seed the database, seeds are up to date with the latest schema based on the most recent migration This should be for testing purposes mainly
func NewContext ¶
NewContext returns a new context with transaction stored in it. Upon error, the original context is still returned along with an error
func TransactionMiddleware ¶
func TransactionMiddleware(next http.Handler, connection SessionFactory) http.Handler
TransactionMiddleware creates a new HTTP middleware that begins a database transaction and stores it in the request context.
Types ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package db_context dbContext provides a wrapper around db context handling to allow access to the db context without requiring importing the db package, thus avoiding cyclic imports
|
Package db_context dbContext provides a wrapper around db context handling to allow access to the db context without requiring importing the db package, thus avoiding cyclic imports |