MCPcopy Create free account
hub / github.com/cloudwan/gohan / DeleteContext

Method DeleteContext

db/sql/sql.go:734–742  ·  view source on GitHub ↗

Delete delete resource from db

(ctx context.Context, s *schema.Schema, resourceID interface{})

Source from the content-addressed store, hash-verified

732
733//Delete delete resource from db
734func (tx *Transaction) DeleteContext(ctx context.Context, s *schema.Schema, resourceID interface{}) error {
735 defer tx.measureTime(time.Now(), s.ID, "delete")
736
737 sql, args, err := sq.Delete(quote(s.GetDbTableName())).Where(sq.Eq{"id": resourceID}).ToSql()
738 if err != nil {
739 return err
740 }
741 return tx.exec(ctx, sql, args...)
742}
743
744func (db *DB) handler(property *schema.Property) propertyHandler {
745 handler, ok := db.handlers[property.Type]

Callers 1

DeleteMethod · 0.95

Calls 5

measureTimeMethod · 0.95
execMethod · 0.95
GetDbTableNameMethod · 0.80
quoteFunction · 0.70
DeleteMethod · 0.65

Tested by

no test coverage detected