<commit_before>package grbinder

import (
	"github.com/gin-gonic/gin"
)

// CreateSupported binds POST: /path create item
type CreateSupported interface {
	CreateHandler(*gin.Context)
}

// ListSupported binds GET: /path list item
type ListSupported interface {
	ListHandler(*gin.Context)
}

// TakeSupported binds GET: /path/:id get item
type TakeSupported interface {
	TakeHandler(*gin.Context)
}

// UpdateSupported binds PUT:  /path/:id change item
type UpdateSupported interface {
	UpdateHandler(*gin.Context)
}

// DeleteSupported binds DELETE: /path/:id delete item
type DeleteSupported interface {
	DeleteHandler(*gin.Context)
}

// CRUD set up 5 handlers for this group
// beside CRUD it includes list
func CRUD(group *gin.RouterGroup, handler interface{}) {
	if handler, ok := handler.(CreateSupported); ok {
		group.POST("", handler.CreateHandler)
	}
	if handler, ok := handler.(ListSupported); ok {
		group.GET("", handler.ListHandler)<commit_msg>Ugly but it less work for now<commit_after>package grbinder

import (
	"github.com/gin-gonic/gin"
)

// InitSupported binds GET: /path_new for the web, init the form
type InitSupported interface {
	InitHandler(*gin.Context)
}

// CreateSupported binds POST: /path create item
type CreateSupported interface {
	CreateHandler(*gin.Context)
}

// ListSupported binds GET: /path list item
type ListSupported interface {
	ListHandler(*gin.Context)
}

// TakeSupported binds GET: /path/:id get item
type TakeSupported interface {
	TakeHandler(*gin.Context)
}

// UpdateSupported binds PUT:  /path/:id change item
type UpdateSupported interface {
	UpdateHandler(*gin.Context)
}

// DeleteSupported binds DELETE: /path/:id delete item
type DeleteSupported interface {
	DeleteHandler(*gin.Context)
}

// CRUD set up 5 handlers for this group
// beside CRUD it includes list
func CRUD(group *gin.RouterGroup, handler interface{}) {
	if handler, ok := handler.(CreateSupported); ok {
		group.POST("", handler.CreateHandler)
	}
	if handler, ok := handler.(ListSupported); ok {
		group.GET("", handler.ListHandler)
	}
	if handler, ok := handler.(TakeSupported); ok {
		group.GET("/:id", handler.TakeHandler)
	}
	if handler, ok := handler.(UpdateSupported); ok {
		group.PUT("/:id", handler.UpdateHandler)
	}
	if handler, ok := handler.(DeleteSupported); ok {
		group.DELETE("/:id", handler.DeleteHandler)
	}
}

// CRUD set up 6 handlers for this group
// beside CRUD it includes list and {path}_new
func CRUDI(path string, handler interface{}, router *gin.Engine, groupHandlers ...gin.HandlerFunc) {
	group := router.Group(path, groupHandlers...)

	if handler, ok := handler.(InitSupported); ok {
		router.GET(path+"_new", handler.InitHandler)
	}
	if handler, ok := handler.(CreateSupported); ok {
		group.POST("", handler.CreateHandler)
	}
	if handler, ok := handler.(ListSupported); ok {
		group.GET("", handler.ListHandler)
{'fraction_non_alphanumeric': 0.12674094707520892, 'fraction_numerical': 0.0010445682451253482, 'mean_word_length': 4.514395393474088, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2672893', 'n_tokens_mistral': 881, 'n_tokens_neox': 855, 'n_words': 260}