// emitQueryEventFn returns function that uses the provided emitter to emit
// an audit event when a database query is executed.
emitQueryEventFn returns function that uses the provided emitter to emit
an audit event when a database query is executed.
// emitQueryEventFn returns function that uses the provided emitter to emit // an audit event when a database query is executed .
func (s *Server) emitQueryEventFn(streamWriter libevents.StreamWriter) func(session.Context, string) error {
	return func(session session.Context, query string) error {
		return streamWriter.EmitAuditEvent(s.closeContext, &events.DatabaseSessionQuery{
			Metadata: events.Metadata{
				Type: libevents.DatabaseSessionQueryEvent,
				Code: libevents.DatabaseSessionQueryCode,
			},
			UserMetadata: events.UserMetadata{
				User: session.Identity.Username,
			},
			SessionMetadata: events.SessionMetadata{
				SessionID: session.ID,
			},
			DatabaseMetadata: events.DatabaseMetadata{
				DatabaseService:  session.Server.GetName(),
				DatabaseProtocol: session.Server.GetProtocol(),
				DatabaseURI:      session.Server.GetURI(),
				DatabaseName:     session.DatabaseName,
				DatabaseUser:     session.DatabaseUser,
			},
			DatabaseQuery: query,
		})
	}
}
func ( s * Server ) emitQueryEventFn ( streamWriter libevents . StreamWriter ) func ( session . Context , string ) error { return func ( session session . Context , query string ) error { return streamWriter . EmitAuditEvent ( s . closeContext , & events . DatabaseSessionQuery { Metadata : events . Metadata { Type : libevents . DatabaseSessionQueryEvent , Code : libevents . DatabaseSessionQueryCode , } , UserMetadata : events . UserMetadata { User : session . Identity . Username , } , SessionMetadata : events . SessionMetadata { SessionID : session . ID , } , DatabaseMetadata : events . DatabaseMetadata { DatabaseService : session . Server . GetName ( ) , DatabaseProtocol : session . Server . GetProtocol ( ) , DatabaseURI : session . Server . GetURI ( ) , DatabaseName : session . DatabaseName , DatabaseUser : session . DatabaseUser , } , DatabaseQuery : query , } ) } }
emitQueryEventFn returns function that uses the provided emitter to emit
an audit event when a database query is executed.
emitQueryEventFn returns function that uses the provided emitter to emit an audit event when a database query is executed .