diff --git a/docs/templates/component.md b/docs/templates/component.md new file mode 100644 index 00000000..7cfcff70 --- /dev/null +++ b/docs/templates/component.md @@ -0,0 +1,48 @@ +--- +name: DataTable +kind: component +lang: typescript +domain: core +version: "1.0.0" +purity: impure +signature: "DataTable(props: { data: T[]; columns: ColumnDef[]; onRowClick?: (row: T) => void }): JSX.Element" +description: "Tabla de datos generica con soporte para columnas configurables y click en fila." +tags: [table, component, generic, ui] +uses_functions: [] +uses_types: [] +returns: [] +returns_optional: false +error_type: "" +imports: [react] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/components/DataTable.tsx" +props: + - name: data + type: "T[]" + required: true + description: "Array de datos a renderizar" + - name: columns + type: "ColumnDef[]" + required: true + description: "Definicion de columnas" + - name: onRowClick + type: "(row: T) => void" + required: false + description: "Callback al hacer click en una fila" +emits: [onRowClick] +has_state: true +framework: react +variant: [default, compact, striped] +--- + +## Ejemplo + +```tsx + +``` + +## Notas + +Componente con estado interno para manejar seleccion y scroll. diff --git a/docs/templates/function.md b/docs/templates/function.md new file mode 100644 index 00000000..6380fc50 --- /dev/null +++ b/docs/templates/function.md @@ -0,0 +1,32 @@ +--- +name: filter_slice +kind: function +lang: go +domain: core +version: "1.0.0" +purity: pure +signature: "func FilterSlice[T any](xs []T, pred func(T) bool) []T" +description: "Filtra un slice aplicando un predicado sin mutar el original." +tags: [slice, functional, generic] +uses_functions: [] +uses_types: [] +returns: [] +returns_optional: false +error_type: "" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/core/filter_slice.go" +--- + +## Ejemplo + +```go +evens := FilterSlice([]int{1, 2, 3, 4}, func(n int) bool { return n%2 == 0 }) +// evens = [2, 4] +``` + +## Notas + +Funcion pura generica. No muta el slice original — crea uno nuevo. diff --git a/docs/templates/pipeline.md b/docs/templates/pipeline.md new file mode 100644 index 00000000..3a2f689a --- /dev/null +++ b/docs/templates/pipeline.md @@ -0,0 +1,31 @@ +--- +name: tick_to_ohlcv +kind: pipeline +lang: go +domain: finance +version: "1.0.0" +purity: impure +signature: "func TickToOHLCV(ctx context.Context, symbol string, interval time.Duration) ([]OHLCV, error)" +description: "Pipeline que obtiene ticks de un exchange y los agrega en velas OHLCV." +tags: [pipeline, finance, ohlcv, ticks] +uses_functions: [fetch_ticks_go_io, aggregate_ohlcv_go_finance] +uses_types: [ohlcv_go_finance, tick_go_finance] +returns: [ohlcv_go_finance] +returns_optional: false +error_type: "error_go_core" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/pipelines/tick_to_ohlcv.go" +--- + +## Ejemplo + +```go +candles, err := TickToOHLCV(ctx, "BTCUSDT", 5*time.Minute) +``` + +## Notas + +Pipeline impuro: orquesta fetch_ticks (IO) y aggregate_ohlcv (pura). diff --git a/docs/templates/type.md b/docs/templates/type.md new file mode 100644 index 00000000..26ef42df --- /dev/null +++ b/docs/templates/type.md @@ -0,0 +1,23 @@ +--- +name: ohlcv +lang: go +domain: finance +version: "1.0.0" +algebraic: product +definition: | + type OHLCV struct { + Open float64 + High float64 + Low float64 + Close float64 + Volume float64 + } +description: "Vela de mercado con precios de apertura, maximo, minimo, cierre y volumen." +tags: [finance, market, candle] +uses_types: [] +file_path: "types/finance/ohlcv.go" +--- + +## Notas + +Tipo producto — todos los campos siempre presentes. Modela una vela de mercado.